Filter for selecting trace and tracefile
[lttv.git] / ltt / branches / poly / ltt / tracefile.c
1 #include <stdio.h>
2 #include <fcntl.h>
3 #include <sys/stat.h>
4 #include <sys/types.h>
5 #include <dirent.h>
6 #include <linux/errno.h>
7
8 #include "parser.h"
9 #include <ltt/trace.h>
10
11 #define DIR_NAME_SIZE 256
12
13 /* set the offset of the fields belonging to the event,
14 need the information of the archecture */
15 void setFieldsOffset(LttTracefile *tf,LttEventType *evT,void *evD,LttTrace *t);
16
17 /* get the size of the field type according to the archtecture's
18 size and endian type(info of the archecture) */
19 int getFieldtypeSize(LttTracefile * tf, LttEventType * evT, int offsetRoot,
20 int offsetParent, LttField *fld, void *evD, LttTrace* t);
21
22 /* read a fixed size or a block information from the file (fd) */
23 int readFile(int fd, void * buf, size_t size, char * mesg);
24 int readBlock(LttTracefile * tf, int whichBlock);
25
26 /* calculate cycles per nsec for current block */
27 void getCyclePerNsec(LttTracefile * t);
28
29 /* reinitialize the info of the block which is already in the buffer */
30 void updateTracefile(LttTracefile * tf);
31
32 /* go to the next event */
33 int skipEvent(LttTracefile * t);
34
35
36 /*****************************************************************************
37 *Function name
38 * ltt_tracefile_open : open a trace file, construct a LttTracefile
39 *Input params
40 * t : the trace containing the tracefile
41 * fileName : path name of the trace file
42 *Return value
43 * : a pointer to a tracefile
44 ****************************************************************************/
45
46 LttTracefile* ltt_tracefile_open(LttTrace * t, char * fileName)
47 {
48 LttTracefile * tf;
49 struct stat lTDFStat; /* Trace data file status */
50 BlockStart a_block_start;
51
52 tf = g_new(LttTracefile, 1);
53
54 //open the file
55 tf->name = g_strdup(fileName);
56 tf->trace = t;
57 tf->fd = open(fileName, O_RDONLY, 0);
58 if(tf->fd < 0){
59 g_error("Unable to open input data file %s\n", fileName);
60 }
61
62 // Get the file's status
63 if(fstat(tf->fd, &lTDFStat) < 0){
64 g_error("Unable to get the status of the input data file %s\n", fileName);
65 }
66
67 // Is the file large enough to contain a trace
68 if(lTDFStat.st_size < sizeof(BlockStart) + EVENT_HEADER_SIZE){
69 g_print("The input data file %s does not contain a trace\n", fileName);
70 g_free(tf->name);
71 close(tf->fd);
72 g_free(tf);
73 return NULL;
74 }
75
76 //store the size of the file
77 tf->file_size = lTDFStat.st_size;
78 tf->block_size = t->system_description->ltt_block_size;
79 tf->block_number = tf->file_size / tf->block_size;
80 tf->which_block = 0;
81
82 //allocate memory to contain the info of a block
83 tf->buffer = (void *) g_new(char, t->system_description->ltt_block_size);
84
85 //read the first block
86 if(readBlock(tf,1)) exit(1);
87
88 return tf;
89 }
90
91
92 /*****************************************************************************
93 *Open control and per cpu tracefiles
94 ****************************************************************************/
95
96 void ltt_tracefile_open_cpu(LttTrace *t, char * tracefile_name)
97 {
98 LttTracefile * tf;
99 tf = ltt_tracefile_open(t,tracefile_name);
100 if(!tf) return;
101 t->per_cpu_tracefile_number++;
102 g_ptr_array_add(t->per_cpu_tracefiles, tf);
103 }
104
105 void ltt_tracefile_open_control(LttTrace *t, char * control_name)
106 {
107 LttTracefile * tf;
108 LttEvent * ev;
109 LttFacility * f;
110 guint16 evId;
111 void * pos;
112 FacilityLoad fLoad;
113 int i;
114
115 tf = ltt_tracefile_open(t,control_name);
116 if(!tf) return;
117 t->control_tracefile_number++;
118 g_ptr_array_add(t->control_tracefiles,tf);
119
120 //parse facilities tracefile to get base_id
121 if(strcmp(&control_name[strlen(control_name)-10],"facilities") ==0){
122 while(1){
123 ev = ltt_tracefile_read(tf);
124 if(!ev)return; // end of file
125
126 if(ev->event_id == TRACE_FACILITY_LOAD){
127 pos = ev->data;
128 fLoad.name = (char*)pos;
129 fLoad.checksum = *(LttChecksum*)(pos + strlen(fLoad.name));
130 fLoad.base_code = *(guint32 *)(pos + strlen(fLoad.name) + sizeof(LttChecksum));
131
132 for(i=0;i<t->facility_number;i++){
133 f = (LttFacility*)g_ptr_array_index(t->facilities,i);
134 if(strcmp(f->name,fLoad.name)==0 && fLoad.checksum==f->checksum){
135 f->base_id = fLoad.base_code;
136 break;
137 }
138 }
139 if(i==t->facility_number)
140 g_error("Facility: %s, checksum: %d is not founded\n",
141 fLoad.name,fLoad.checksum);
142 }else if(ev->event_id == TRACE_BLOCK_START){
143 continue;
144 }else if(ev->event_id == TRACE_BLOCK_END){
145 break;
146 }else g_error("Not valid facilities trace file\n");
147 }
148 }
149 }
150
151 /*****************************************************************************
152 *Function name
153 * ltt_tracefile_close: close a trace file,
154 *Input params
155 * t : tracefile which will be closed
156 ****************************************************************************/
157
158 void ltt_tracefile_close(LttTracefile *t)
159 {
160 g_free(t->name);
161 g_free(t->buffer);
162 close(t->fd);
163 g_free(t);
164 }
165
166
167 /*****************************************************************************
168 *Get system information
169 ****************************************************************************/
170 void getSystemInfo(LttSystemDescription* des, char * pathname)
171 {
172 FILE * fp;
173 int i;
174 int entry_number = 15;
175 char buf[DIR_NAME_SIZE];
176 char description[4*DIR_NAME_SIZE];
177 char * ptr;
178
179 fp = fopen(pathname,"r");
180 if(!fp){
181 g_error("Can not open file : %s\n", pathname);
182 }
183
184 while(fgets(buf,DIR_NAME_SIZE, fp)!= NULL){
185 ptr = buf;
186 while(isspace(*ptr)) ptr++;
187 if(strlen(ptr) == 0) continue;
188 break;
189 }
190
191 if(strlen(ptr) == 0) g_error("Not a valid file: %s\n", pathname);
192 if(strncmp("<system",ptr,7) !=0)g_error("Not a valid file: %s\n", pathname);
193
194 for(i=0;i<entry_number;i++){
195 if(fgets(buf,DIR_NAME_SIZE, fp)== NULL)
196 g_error("Not a valid file: %s\n", pathname);
197 buf[strlen(buf)-1] = '\0';
198 ptr = buf;
199 while(isspace(*ptr)) ptr++;
200 switch(i){
201 case 0:
202 if(strncmp("node_name=",ptr,10)!=0)
203 g_error("Not a valid file: %s\n", pathname);
204 des->node_name = g_strdup(ptr+10);
205 break;
206 case 1:
207 if(strncmp("domainname=",ptr,11)!=0)
208 g_error("Not a valid file: %s\n", pathname);
209 des->domain_name = g_strdup(ptr+11);
210 break;
211 case 2:
212 if(strncmp("cpu=",ptr,4)!=0)
213 g_error("Not a valid file: %s\n", pathname);
214 des->nb_cpu = (unsigned)atoi(ptr+4);
215 break;
216 case 3:
217 if(strncmp("arch_size=",ptr,10)!=0)
218 g_error("Not a valid file: %s\n", pathname);
219 if(strcmp(ptr+10,"\"LP32\"") == 0) des->size = LTT_LP32;
220 else if(strcmp(ptr+10,"\"ILP32\"") == 0) des->size = LTT_ILP32;
221 else if(strcmp(ptr+10,"\"LP64\"") == 0) des->size = LTT_LP64;
222 else if(strcmp(ptr+10,"\"ILP64\"") == 0) des->size = LTT_ILP64;
223 else if(strcmp(ptr+10,"\"UNKNOWN\"") == 0) des->size = LTT_UNKNOWN;
224 break;
225 case 4:
226 if(strncmp("endian=",ptr,7)!=0)
227 g_error("Not a valid file: %s\n", pathname);
228 if(strcmp(ptr+7,"\"LITTLE_ENDIAN\"") == 0)
229 des->endian = LTT_LITTLE_ENDIAN;
230 else if(strcmp(ptr+7,"\"BIG_ENDIAN\"") == 0)
231 des->endian = LTT_BIG_ENDIAN;
232 break;
233 case 5:
234 if(strncmp("kernel_name=",ptr,12)!=0)
235 g_error("Not a valid file: %s\n", pathname);
236 des->kernel_name = g_strdup(ptr+12);
237 break;
238 case 6:
239 if(strncmp("kernel_release=",ptr,15)!=0)
240 g_error("Not a valid file: %s\n", pathname);
241 des->kernel_release = g_strdup(ptr+15);
242 break;
243 case 7:
244 if(strncmp("kernel_version=",ptr,15)!=0)
245 g_error("Not a valid file: %s\n", pathname);
246 des->kernel_version = g_strdup(ptr+15);
247 break;
248 case 8:
249 if(strncmp("machine=",ptr,8)!=0)
250 g_error("Not a valid file: %s\n", pathname);
251 des->machine = g_strdup(ptr+8);
252 break;
253 case 9:
254 if(strncmp("processor=",ptr,10)!=0)
255 g_error("Not a valid file: %s\n", pathname);
256 des->processor = g_strdup(ptr+10);
257 break;
258 case 10:
259 if(strncmp("hardware_platform=",ptr,18)!=0)
260 g_error("Not a valid file: %s\n", pathname);
261 des->hardware_platform = g_strdup(ptr+18);
262 break;
263 case 11:
264 if(strncmp("operating_system=",ptr,17)!=0)
265 g_error("Not a valid file: %s\n", pathname);
266 des->operating_system = g_strdup(ptr+17);
267 break;
268 case 12:
269 if(strncmp("ltt_major_version=",ptr,18)!=0)
270 g_error("Not a valid file: %s\n", pathname);
271 ptr += 18;
272 // ptr++;//skip begining "
273 // ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
274 des->ltt_major_version = (unsigned)atoi(ptr);
275 break;
276 case 13:
277 if(strncmp("ltt_minor_version=",ptr,18)!=0)
278 g_error("Not a valid file: %s\n", pathname);
279 ptr += 18;
280 // ptr++;//skip begining "
281 // ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
282 des->ltt_minor_version = (unsigned)atoi(ptr);
283 break;
284 case 14:
285 if(strncmp("ltt_block_size=",ptr,15)!=0)
286 g_error("Not a valid file: %s\n", pathname);
287 ptr += 15;
288 // ptr++;//skip begining "
289 // ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
290 des->ltt_block_size = (unsigned)atoi(ptr);
291 break;
292 default:
293 g_error("Not a valid file: %s\n", pathname);
294 }
295 }
296
297 //get description
298 description[0] = '\0';
299 if(fgets(buf,DIR_NAME_SIZE, fp)== NULL)
300 g_error("Not a valid file: %s\n", pathname);
301 ptr = buf;
302 while(isspace(*ptr)) ptr++;
303 if(*ptr != '>') g_error("Not a valid file: %s\n", pathname);
304 while((ptr=fgets(buf,DIR_NAME_SIZE, fp))!= NULL){
305 ptr = buf;
306 while(isspace(*ptr)) ptr++;
307 if(strncmp("</system>",ptr,9) == 0 )break;
308 strcat(description, buf);
309 }
310 if(!ptr)g_error("Not a valid file: %s\n", pathname);
311 if(description[0] = '\0')des->description = NULL;
312 des->description = g_strdup(description);
313
314 fclose(fp);
315 }
316
317 /*****************************************************************************
318 *The following functions get facility/tracefile information
319 ****************************************************************************/
320
321 void getFacilityInfo(LttTrace *t, char* eventdefs)
322 {
323 DIR * dir;
324 struct dirent *entry;
325 char * ptr;
326 int i,j;
327 LttFacility * f;
328 LttEventType * et;
329 char name[DIR_NAME_SIZE];
330
331 dir = opendir(eventdefs);
332 if(!dir) g_error("Can not open directory: %s\n", eventdefs);
333
334 while((entry = readdir(dir)) != NULL){
335 ptr = &entry->d_name[strlen(entry->d_name)-4];
336 if(strcmp(ptr,".xml") != 0) continue;
337 strcpy(name,eventdefs);
338 strcat(name,entry->d_name);
339 ltt_facility_open(t,name);
340 }
341 closedir(dir);
342
343 for(j=0;j<t->facility_number;j++){
344 f = (LttFacility*)g_ptr_array_index(t->facilities, j);
345 for(i=0; i<f->event_number; i++){
346 et = f->events[i];
347 setFieldsOffset(NULL, et, NULL, t);
348 }
349 }
350 }
351
352 void getControlFileInfo(LttTrace *t, char* control)
353 {
354 DIR * dir;
355 struct dirent *entry;
356 char name[DIR_NAME_SIZE];
357
358 dir = opendir(control);
359 if(!dir) g_error("Can not open directory: %s\n", control);
360
361 while((entry = readdir(dir)) != NULL){
362 if(strcmp(entry->d_name,"facilities") != 0 &&
363 strcmp(entry->d_name,"interrupts") != 0 &&
364 strcmp(entry->d_name,"processes") != 0) continue;
365
366 strcpy(name,control);
367 strcat(name,entry->d_name);
368 ltt_tracefile_open_control(t,name);
369 }
370 closedir(dir);
371 }
372
373 void getCpuFileInfo(LttTrace *t, char* cpu)
374 {
375 DIR * dir;
376 struct dirent *entry;
377 char name[DIR_NAME_SIZE];
378
379 dir = opendir(cpu);
380 if(!dir) g_error("Can not open directory: %s\n", cpu);
381
382 while((entry = readdir(dir)) != NULL){
383 if(strcmp(entry->d_name,".") != 0 &&
384 strcmp(entry->d_name,"..") != 0 ){
385 strcpy(name,cpu);
386 strcat(name,entry->d_name);
387 ltt_tracefile_open_cpu(t,name);
388 }else continue;
389 }
390 closedir(dir);
391 }
392
393 /*****************************************************************************
394 *A trace is specified as a pathname to the directory containing all the
395 *associated data (control tracefiles, per cpu tracefiles, event
396 *descriptions...).
397 *
398 *When a trace is closed, all the associated facilities, types and fields
399 *are released as well.
400 ****************************************************************************/
401
402 LttTrace *ltt_trace_open(const char *pathname)
403 {
404 LttTrace * t;
405 LttSystemDescription * sys_description;
406 char eventdefs[DIR_NAME_SIZE];
407 char info[DIR_NAME_SIZE];
408 char control[DIR_NAME_SIZE];
409 char cpu[DIR_NAME_SIZE];
410 char tmp[DIR_NAME_SIZE];
411 gboolean has_slash = FALSE;
412
413 //establish the pathname to different directories
414 if(pathname[strlen(pathname)-1] == '/')has_slash = TRUE;
415 strcpy(eventdefs,pathname);
416 if(!has_slash)strcat(eventdefs,"/");
417 strcat(eventdefs,"eventdefs/");
418
419 strcpy(info,pathname);
420 if(!has_slash)strcat(info,"/");
421 strcat(info,"info/");
422
423 strcpy(control,pathname);
424 if(!has_slash)strcat(control,"/");
425 strcat(control,"control/");
426
427 strcpy(cpu,pathname);
428 if(!has_slash)strcat(cpu,"/");
429 strcat(cpu,"cpu/");
430
431 //new trace
432 t = g_new(LttTrace, 1);
433 sys_description = g_new(LttSystemDescription, 1);
434 t->pathname = g_strdup(pathname);
435 t->facility_number = 0;
436 t->control_tracefile_number = 0;
437 t->per_cpu_tracefile_number = 0;
438 t->system_description = sys_description;
439 t->control_tracefiles = g_ptr_array_new();
440 t->per_cpu_tracefiles = g_ptr_array_new();
441 t->facilities = g_ptr_array_new();
442 getDataEndianType(&(t->my_arch_size), &(t->my_arch_endian));
443
444 //get system description
445 strcpy(tmp,info);
446 strcat(tmp,"system.xml");
447 getSystemInfo(sys_description, tmp);
448
449 //get facilities info
450 getFacilityInfo(t,eventdefs);
451
452 //get control tracefile info
453 getControlFileInfo(t,control);
454
455 //get cpu tracefile info
456 getCpuFileInfo(t,cpu);
457
458 return t;
459 }
460
461 char * ltt_trace_name(LttTrace *t)
462 {
463 return t->pathname;
464 }
465
466
467 /******************************************************************************
468 * When we copy a trace, we want all the opening actions to happen again :
469 * the trace will be reopened and totally independant from the original.
470 * That's why we call ltt_trace_open.
471 *****************************************************************************/
472 LttTrace *ltt_trace_copy(LttTrace *self)
473 {
474 return ltt_trace_open(self->pathname);
475 }
476
477 void ltt_trace_close(LttTrace *t)
478 {
479 int i;
480 LttTracefile * tf;
481 LttFacility * f;
482
483 g_free(t->pathname);
484
485 //free system_description
486 g_free(t->system_description->description);
487 g_free(t->system_description->node_name);
488 g_free(t->system_description->domain_name);
489 g_free(t->system_description->kernel_name);
490 g_free(t->system_description->kernel_release);
491 g_free(t->system_description->kernel_version);
492 g_free(t->system_description->machine);
493 g_free(t->system_description->processor);
494 g_free(t->system_description->hardware_platform);
495 g_free(t->system_description->operating_system);
496 g_free(t->system_description);
497
498 //free control_tracefiles
499 for(i=0;i<t->control_tracefile_number;i++){
500 tf = (LttTracefile*)g_ptr_array_index(t->control_tracefiles,i);
501 ltt_tracefile_close(tf);
502 }
503 g_ptr_array_free(t->control_tracefiles, TRUE);
504
505 //free per_cpu_tracefiles
506 for(i=0;i<t->per_cpu_tracefile_number;i++){
507 tf = (LttTracefile*)g_ptr_array_index(t->per_cpu_tracefiles,i);
508 ltt_tracefile_close(tf);
509 }
510 g_ptr_array_free(t->per_cpu_tracefiles, TRUE);
511
512 //free facilities
513 for(i=0;i<t->facility_number;i++){
514 f = (LttFacility*)g_ptr_array_index(t->facilities,i);
515 ltt_facility_close(f);
516 }
517 g_ptr_array_free(t->facilities, TRUE);
518
519 g_free(t);
520
521 g_blow_chunks();
522 }
523
524
525 /*****************************************************************************
526 *Get the system description of the trace
527 ****************************************************************************/
528
529 LttSystemDescription *ltt_trace_system_description(LttTrace *t)
530 {
531 return t->system_description;
532 }
533
534 /*****************************************************************************
535 * The following functions discover the facilities of the trace
536 ****************************************************************************/
537
538 unsigned ltt_trace_facility_number(LttTrace *t)
539 {
540 return (unsigned)(t->facility_number);
541 }
542
543 LttFacility *ltt_trace_facility_get(LttTrace *t, unsigned i)
544 {
545 return (LttFacility*)g_ptr_array_index(t->facilities, i);
546 }
547
548 /*****************************************************************************
549 *Function name
550 * ltt_trace_facility_find : find facilities in the trace
551 *Input params
552 * t : the trace
553 * name : facility name
554 *Output params
555 * position : position of the facility in the trace
556 *Return value
557 * : the number of facilities
558 ****************************************************************************/
559
560 unsigned ltt_trace_facility_find(LttTrace *t, char *name, unsigned *position)
561 {
562 int i, count=0;
563 LttFacility * f;
564 for(i=0;i<t->facility_number;i++){
565 f = (LttFacility*)g_ptr_array_index(t->facilities, i);
566 if(strcmp(f->name,name)==0){
567 count++;
568 if(count==1) *position = i;
569 }else{
570 if(count) break;
571 }
572 }
573 return count;
574 }
575
576 /*****************************************************************************
577 * Functions to discover all the event types in the trace
578 ****************************************************************************/
579
580 unsigned ltt_trace_eventtype_number(LttTrace *t)
581 {
582 int i;
583 unsigned count = 0;
584 LttFacility * f;
585 for(i=0;i<t->facility_number;i++){
586 f = (LttFacility*)g_ptr_array_index(t->facilities, i);
587 count += f->event_number;
588 }
589 return count;
590 }
591
592 LttFacility * ltt_trace_facility_by_id(LttTrace * trace, unsigned id)
593 {
594 LttFacility * facility;
595 int i;
596 for(i=0;i<trace->facility_number;i++){
597 facility = (LttFacility*) g_ptr_array_index(trace->facilities,i);
598 if(id >= facility->base_id &&
599 id < facility->base_id + facility->event_number)
600 break;
601 }
602 if(i==trace->facility_number) return NULL;
603 else return facility;
604 }
605
606 LttEventType *ltt_trace_eventtype_get(LttTrace *t, unsigned evId)
607 {
608 LttFacility * f;
609 f = ltt_trace_facility_by_id(t,evId);
610 if(!f) return NULL;
611 return f->events[evId - f->base_id];
612 }
613
614 /*****************************************************************************
615 *There is one "per cpu" tracefile for each CPU, numbered from 0 to
616 *the maximum number of CPU in the system. When the number of CPU installed
617 *is less than the maximum, some positions are unused. There are also a
618 *number of "control" tracefiles (facilities, interrupts...).
619 ****************************************************************************/
620 unsigned ltt_trace_control_tracefile_number(LttTrace *t)
621 {
622 return t->control_tracefile_number;
623 }
624
625 unsigned ltt_trace_per_cpu_tracefile_number(LttTrace *t)
626 {
627 return t->per_cpu_tracefile_number;
628 }
629
630 /*****************************************************************************
631 *It is possible to search for the tracefiles by name or by CPU position.
632 *The index within the tracefiles of the same type is returned if found
633 *and a negative value otherwise.
634 ****************************************************************************/
635
636 int ltt_trace_control_tracefile_find(LttTrace *t, char *name)
637 {
638 LttTracefile * tracefile;
639 int i;
640 for(i=0;i<t->control_tracefile_number;i++){
641 tracefile = (LttTracefile*)g_ptr_array_index(t->control_tracefiles, i);
642 if(strcmp(tracefile->name, name)==0)break;
643 }
644 if(i == t->control_tracefile_number) return -1;
645 return i;
646 }
647
648 int ltt_trace_per_cpu_tracefile_find(LttTrace *t, unsigned i)
649 {
650 LttTracefile * tracefile;
651 int j, name;
652 for(j=0;j<t->per_cpu_tracefile_number;j++){
653 tracefile = (LttTracefile*)g_ptr_array_index(t->per_cpu_tracefiles, j);
654 name = atoi(tracefile->name);
655 if(name == (int)i)break;
656 }
657 if(j == t->per_cpu_tracefile_number) return -1;
658 return j;
659 }
660
661 /*****************************************************************************
662 *Get a specific tracefile
663 ****************************************************************************/
664
665 LttTracefile *ltt_trace_control_tracefile_get(LttTrace *t, unsigned i)
666 {
667 return (LttTracefile*)g_ptr_array_index(t->control_tracefiles, i);
668 }
669
670 LttTracefile *ltt_trace_per_cpu_tracefile_get(LttTrace *t, unsigned i)
671 {
672 return (LttTracefile*)g_ptr_array_index(t->per_cpu_tracefiles, i);
673 }
674
675 /*****************************************************************************
676 * Get the start time and end time of the trace
677 ****************************************************************************/
678
679 void ltt_trace_time_span_get(LttTrace *t, LttTime *start, LttTime *end)
680 {
681 LttTime startSmall, startTmp, endBig, endTmp;
682 int i, j=0;
683 LttTracefile * tf;
684
685 for(i=0;i<t->control_tracefile_number;i++){
686 tf = g_ptr_array_index(t->control_tracefiles, i);
687 readBlock(tf,1);
688 startTmp = tf->a_block_start->time;
689 readBlock(tf,tf->block_number);
690 endTmp = tf->a_block_end->time;
691 if(i==0){
692 startSmall = startTmp;
693 endBig = endTmp;
694 j = 1;
695 continue;
696 }
697 if(ltt_time_compare(startSmall,startTmp) > 0) startSmall = startTmp;
698 if(ltt_time_compare(endBig,endTmp) < 0) endBig = endTmp;
699 }
700
701 for(i=0;i<t->per_cpu_tracefile_number;i++){
702 tf = g_ptr_array_index(t->per_cpu_tracefiles, i);
703 readBlock(tf,1);
704 startTmp = tf->a_block_start->time;
705 readBlock(tf,tf->block_number);
706 endTmp = tf->a_block_end->time;
707 if(j == 0 && i==0){
708 startSmall = startTmp;
709 endBig = endTmp;
710 continue;
711 }
712 if(ltt_time_compare(startSmall,startTmp) > 0) startSmall = startTmp;
713 if(ltt_time_compare(endBig,endTmp) < 0) endBig = endTmp;
714 }
715
716 *start = startSmall;
717 *end = endBig;
718 }
719
720
721 /*****************************************************************************
722 *Get the name of a tracefile
723 ****************************************************************************/
724
725 char *ltt_tracefile_name(LttTracefile *tf)
726 {
727 return tf->name;
728 }
729
730 /*****************************************************************************
731 * Get the number of blocks in the tracefile
732 ****************************************************************************/
733
734 unsigned ltt_tracefile_block_number(LttTracefile *tf)
735 {
736 return tf->block_number;
737 }
738
739 /*****************************************************************************
740 *Function name
741 * ltt_tracefile_seek_time: seek to the first event of the trace with time
742 * larger or equal to time
743 *Input params
744 * t : tracefile
745 * time : criteria of the time
746 ****************************************************************************/
747 void ltt_tracefile_find_time_block(LttTracefile *t, LttTime time,
748 int start_block, int end_block)
749 {
750 int err, tmp_block, s, e;
751 int headTime;
752 int tailTime;
753
754 err=readBlock(t,start_block);
755 if(err) g_error("Can not read tracefile: %s\n", t->name);
756 if(start_block == end_block)return;
757
758 tailTime = ltt_time_compare(t->a_block_end->time, time);
759 if(tailTime >= 0) return;
760
761 err=readBlock(t,end_block);
762 if(err) g_error("Can not read tracefile: %s\n", t->name);
763 if(start_block+1 == end_block)return;
764
765 headTime = ltt_time_compare(t->a_block_start->time, time);
766 if(headTime <= 0 ) return;
767
768 tmp_block = (end_block + start_block)/2;
769 err=readBlock(t,tmp_block);
770 if(err) g_error("Can not read tracefile: %s\n", t->name);
771
772 headTime = ltt_time_compare(t->a_block_start->time, time);
773 tailTime = ltt_time_compare(t->a_block_end->time, time);
774 if(headTime <= 0 && tailTime >= 0) return;
775
776 if(headTime > 0){
777 s = start_block + 1;
778 e = tmp_block - 1;
779 if(s <= e)
780 ltt_tracefile_find_time_block(t, time, s, e);
781 else return;
782 }
783
784 if(tailTime < 0){
785 s = tmp_block + 1;
786 e = end_block - 1;
787 if(s <= e)
788 ltt_tracefile_find_time_block(t, time, s, e);
789 else return;
790 }
791 }
792
793 void ltt_tracefile_backward_find_time_block(LttTracefile *t, LttTime time)
794 {
795 int t_time, h_time, err;
796 err=readBlock(t,t->which_block-1);
797 if(err) g_error("Can not read tracefile: %s\n", t->name);
798 h_time = ltt_time_compare(t->a_block_start->time, time);
799 t_time = ltt_time_compare(t->a_block_end->time, time);
800 if(h_time == 0){
801 int tmp;
802 if(t->which_block == 1) return;
803 err=readBlock(t,t->which_block-1);
804 if(err) g_error("Can not read tracefile: %s\n", t->name);
805 tmp = ltt_time_compare(t->a_block_end->time, time);
806 if(tmp == 0) return ltt_tracefile_seek_time(t, time);
807 err=readBlock(t,t->which_block+1);
808 if(err) g_error("Can not read tracefile: %s\n", t->name);
809 }else if(h_time > 0){
810 ltt_tracefile_find_time_block(t, time, 1, t->which_block);
811 return ltt_tracefile_seek_time(t, time) ;
812 }else{
813 if(t_time >= 0) return ltt_tracefile_seek_time(t, time);
814 err=readBlock(t,t->which_block+1);
815 if(err) g_error("Can not read tracefile: %s\n", t->name);
816 }
817 }
818
819 void ltt_tracefile_seek_time(LttTracefile *t, LttTime time)
820 {
821 int err;
822 LttTime lttTime;
823 int headTime = ltt_time_compare(t->a_block_start->time, time);
824 int tailTime = ltt_time_compare(t->a_block_end->time, time);
825 LttEvent * ev;
826
827 if(headTime < 0 && tailTime > 0){
828 if(ltt_time_compare(t->a_block_end->time, t->current_event_time) !=0) {
829 lttTime = getEventTime(t);
830 err = ltt_time_compare(lttTime, time);
831 if(err > 0){
832 if(t->which_event==2 || (&t->prev_event_time,&time)<0){
833 return;
834 }else{
835 updateTracefile(t);
836 return ltt_tracefile_seek_time(t, time);
837 }
838 }else if(err < 0){
839 while(1){
840 ev = ltt_tracefile_read(t);
841 if(ev == NULL){
842 g_print("End of file\n");
843 return;
844 }
845 lttTime = getEventTime(t);
846 err = ltt_time_compare(lttTime, time);
847 if(err >= 0)return;
848 }
849 }else return;
850 }else{//we are at the end of the block
851 updateTracefile(t);
852 return ltt_tracefile_seek_time(t, time);
853 }
854 }else if(headTime >= 0){
855 if(t->which_block == 1){
856 updateTracefile(t);
857 }else{
858 if(ltt_time_compare(t->prev_block_end_time, time) >= 0 ||
859 (t->prev_block_end_time.tv_sec == 0 &&
860 t->prev_block_end_time.tv_nsec == 0 )){
861 ltt_tracefile_backward_find_time_block(t, time);
862 }else{
863 updateTracefile(t);
864 }
865 }
866 }else if(tailTime < 0){
867 if(t->which_block != t->block_number){
868 ltt_tracefile_find_time_block(t, time, t->which_block+1, t->block_number);
869 return ltt_tracefile_seek_time(t, time);
870 }else {
871 g_print("End of file\n");
872 return;
873 }
874 }else if(tailTime == 0){
875 t->cur_event_pos = t->last_event_pos;
876 t->current_event_time = time;
877 t->cur_heart_beat_number = 0;
878 t->prev_event_time.tv_sec = 0;
879 t->prev_event_time.tv_nsec = 0;
880 return;
881 }
882 }
883
884 /*****************************************************************************
885 * Seek to the first event with position equal or larger to ep
886 ****************************************************************************/
887
888 void ltt_tracefile_seek_position(LttTracefile *t, LttEventPosition *ep)
889 {
890 //if we are at the right place, just return
891 if(t->which_block == ep->block_num && t->which_event == ep->event_num)
892 return;
893
894 if(t->which_block == ep->block_num) updateTracefile(t);
895 else readBlock(t,ep->block_num);
896
897 //event offset is availiable
898 if(ep->old_position){
899 t->cur_heart_beat_number = ep->heart_beat_number;
900 t->cur_event_pos = t->buffer + ep->event_offset;
901 return;
902 }
903
904 //only block number and event index are availiable
905 while(t->which_event < ep->event_num) ltt_tracefile_read(t);
906
907 return;
908 }
909
910 /*****************************************************************************
911 *Function name
912 * ltt_tracefile_read : read the current event, set the pointer to the next
913 *Input params
914 * t : tracefile
915 *Return value
916 * LttEvent * : an event to be processed
917 ****************************************************************************/
918
919 LttEvent *ltt_tracefile_read(LttTracefile *t)
920 {
921 LttEvent * lttEvent = &t->an_event;
922 int err;
923
924 if(t->cur_event_pos == t->buffer + t->block_size){
925 if(t->which_block == t->block_number){
926 return NULL;
927 }
928 err = readBlock(t, t->which_block + 1);
929 if(err)g_error("Can not read tracefile");
930 }
931
932 lttEvent->event_id = (int)(*(guint16 *)(t->cur_event_pos));
933 if(lttEvent->event_id == TRACE_TIME_HEARTBEAT)
934 t->cur_heart_beat_number++;
935
936 t->prev_event_time = t->current_event_time;
937 // t->current_event_time = getEventTime(t);
938
939 lttEvent->time_delta = *(guint32 *)(t->cur_event_pos + EVENT_ID_SIZE);
940 lttEvent->event_time = t->current_event_time;
941
942 lttEvent->tracefile = t;
943 lttEvent->data = t->cur_event_pos + EVENT_HEADER_SIZE;
944 lttEvent->which_block = t->which_block;
945 lttEvent->which_event = t->which_event;
946
947 //update the fields of the current event and go to the next event
948 err = skipEvent(t);
949 if(err == ERANGE) g_error("event id is out of range\n");
950
951 lttEvent->event_cycle_count = t->cur_cycle_count;
952
953 return lttEvent;
954 }
955
956 /****************************************************************************
957 *Function name
958 * readFile : wrap function to read from a file
959 *Input Params
960 * fd : file descriptor
961 * buf : buf to contain the content
962 * size : number of bytes to be read
963 * mesg : message to be printed if some thing goes wrong
964 *return value
965 * 0 : success
966 * EIO : can not read from the file
967 ****************************************************************************/
968
969 int readFile(int fd, void * buf, size_t size, char * mesg)
970 {
971 ssize_t nbBytes;
972 nbBytes = read(fd, buf, size);
973 if(nbBytes != size){
974 printf("%s\n",mesg);
975 return EIO;
976 }
977 return 0;
978 }
979
980 /****************************************************************************
981 *Function name
982 * readBlock : read a block from the file
983 *Input Params
984 * lttdes : ltt trace file
985 * whichBlock : the block which will be read
986 *return value
987 * 0 : success
988 * EINVAL : lseek fail
989 * EIO : can not read from the file
990 ****************************************************************************/
991
992 int readBlock(LttTracefile * tf, int whichBlock)
993 {
994 off_t nbBytes;
995 guint32 lostSize;
996
997 if(whichBlock - tf->which_block == 1 && tf->which_block != 0){
998 tf->prev_block_end_time = tf->a_block_end->time;
999 tf->prev_event_time = tf->a_block_end->time;
1000 }else{
1001 tf->prev_block_end_time.tv_sec = 0;
1002 tf->prev_block_end_time.tv_nsec = 0;
1003 tf->prev_event_time.tv_sec = 0;
1004 tf->prev_event_time.tv_nsec = 0;
1005 }
1006
1007 nbBytes=lseek(tf->fd,(off_t)((whichBlock-1)*tf->block_size), SEEK_SET);
1008 if(nbBytes == -1) return EINVAL;
1009
1010 if(readFile(tf->fd,tf->buffer,tf->block_size,"Unable to read a block"))
1011 return EIO;
1012
1013 tf->a_block_start=(BlockStart *) (tf->buffer + EVENT_HEADER_SIZE);
1014 lostSize = *(guint32 *)(tf->buffer + tf->block_size - sizeof(guint32));
1015 tf->a_block_end=(BlockEnd *)(tf->buffer + tf->block_size -
1016 lostSize + EVENT_HEADER_SIZE);
1017 tf->last_event_pos = tf->buffer + tf->block_size - lostSize;
1018
1019 tf->which_block = whichBlock;
1020 tf->which_event = 1;
1021 tf->cur_event_pos = tf->buffer;//the beginning of the block, block start ev
1022 tf->cur_heart_beat_number = 0;
1023
1024 getCyclePerNsec(tf);
1025
1026 tf->current_event_time = getEventTime(tf);
1027
1028 return 0;
1029 }
1030
1031 /*****************************************************************************
1032 *Function name
1033 * updateTracefile : reinitialize the info of the block which is already
1034 * in the buffer
1035 *Input params
1036 * tf : tracefile
1037 ****************************************************************************/
1038
1039 void updateTracefile(LttTracefile * tf)
1040 {
1041 tf->which_event = 1;
1042 tf->cur_event_pos = tf->buffer;
1043 tf->current_event_time = getEventTime(tf);
1044 tf->cur_heart_beat_number = 0;
1045
1046 tf->prev_event_time.tv_sec = 0;
1047 tf->prev_event_time.tv_nsec = 0;
1048 }
1049
1050 /*****************************************************************************
1051 *Function name
1052 * skipEvent : go to the next event, update the fields of the current event
1053 *Input params
1054 * t : tracefile
1055 *return value
1056 * 0 : success
1057 * ERANGE : event id is out of range
1058 ****************************************************************************/
1059
1060 int skipEvent(LttTracefile * t)
1061 {
1062 int evId, err;
1063 void * evData;
1064 LttEventType * evT;
1065 LttField * rootFld;
1066
1067 evId = (int)(*(guint16 *)(t->cur_event_pos));
1068 evData = t->cur_event_pos + EVENT_HEADER_SIZE;
1069
1070 evT = ltt_trace_eventtype_get(t->trace,(unsigned)evId);
1071
1072 if(evT) rootFld = evT->root_field;
1073 else return ERANGE;
1074
1075 if(rootFld){
1076 //event has string/sequence or the last event is not the same event
1077 if((evT->latest_block!=t->which_block || evT->latest_event!=t->which_event)
1078 && rootFld->field_fixed == 0){
1079 setFieldsOffset(t, evT, evData, t->trace);
1080 }
1081 t->cur_event_pos += EVENT_HEADER_SIZE + rootFld->field_size;
1082 }else t->cur_event_pos += EVENT_HEADER_SIZE;
1083
1084 evT->latest_block = t->which_block;
1085 evT->latest_event = t->which_event;
1086
1087 //the next event is in the next block
1088 if(evId == TRACE_BLOCK_END){
1089 t->cur_event_pos = t->buffer + t->block_size;
1090 }else{
1091 t->which_event++;
1092 t->current_event_time = getEventTime(t);
1093 }
1094
1095 return 0;
1096 }
1097
1098 /*****************************************************************************
1099 *Function name
1100 * getCyclePerNsec : calculate cycles per nsec for current block
1101 *Input Params
1102 * t : tracefile
1103 ****************************************************************************/
1104
1105 void getCyclePerNsec(LttTracefile * t)
1106 {
1107 LttTime lBufTotalTime; /* Total time for this buffer */
1108 LttCycleCount lBufTotalNSec; /* Total time for this buffer in nsecs */
1109 LttCycleCount lBufTotalCycle;/* Total cycles for this buffer */
1110
1111 /* Calculate the total time for this buffer */
1112 lBufTotalTime = ltt_time_sub(t->a_block_end->time, t->a_block_start->time);
1113
1114 /* Calculate the total cycles for this bufffer */
1115 lBufTotalCycle = t->a_block_end->cycle_count;
1116 lBufTotalCycle -= t->a_block_start->cycle_count;
1117
1118 /* Convert the total time to nsecs */
1119 lBufTotalNSec = lBufTotalTime.tv_sec;
1120 lBufTotalNSec *= NANOSECONDS_PER_SECOND;
1121 lBufTotalNSec += lBufTotalTime.tv_nsec;
1122
1123 t->cycle_per_nsec = (double)lBufTotalCycle / (double)lBufTotalNSec;
1124 }
1125
1126 /****************************************************************************
1127 *Function name
1128 * getEventTime : obtain the time of an event
1129 *Input params
1130 * tf : tracefile
1131 *Return value
1132 * LttTime : the time of the event
1133 ****************************************************************************/
1134
1135 LttTime getEventTime(LttTracefile * tf)
1136 {
1137 LttTime time;
1138 LttCycleCount cycle_count; // cycle count for the current event
1139 LttCycleCount lEventTotalCycle; // Total cycles from start for event
1140 double lEventNSec; // Total usecs from start for event
1141 LttTime lTimeOffset; // Time offset in struct LttTime
1142 guint16 evId;
1143 gint64 nanoSec, tmpCycleCount = (((guint64)1)<<32);
1144 static LttCycleCount preCycleCount = 0;
1145 static int count = 0;
1146
1147 evId = *(guint16 *)tf->cur_event_pos;
1148 if(evId == TRACE_BLOCK_START){
1149 count = 0;
1150 preCycleCount = 0;
1151 tf->cur_cycle_count = tf->a_block_start->cycle_count;
1152 return tf->a_block_start->time;
1153 }else if(evId == TRACE_BLOCK_END){
1154 count = 0;
1155 preCycleCount = 0;
1156 tf->cur_cycle_count = tf->a_block_end->cycle_count;
1157 return tf->a_block_end->time;
1158 }
1159
1160 // Calculate total time in cycles from start of buffer for this event
1161 cycle_count = (LttCycleCount)*(guint32 *)(tf->cur_event_pos + EVENT_ID_SIZE);
1162
1163 if(cycle_count < preCycleCount)count++;
1164 preCycleCount = cycle_count;
1165 cycle_count += tmpCycleCount * count;
1166
1167 if(tf->cur_heart_beat_number > count)
1168 cycle_count += tmpCycleCount * (tf->cur_heart_beat_number - count);
1169
1170 tf->cur_cycle_count = cycle_count;
1171
1172 lEventTotalCycle = cycle_count;
1173 lEventTotalCycle -= tf->a_block_start->cycle_count;
1174
1175 // Convert it to nsecs
1176 lEventNSec = lEventTotalCycle / tf->cycle_per_nsec;
1177 nanoSec = lEventNSec;
1178
1179 // Determine offset in struct LttTime
1180 lTimeOffset.tv_nsec = nanoSec % NANOSECONDS_PER_SECOND;
1181 lTimeOffset.tv_sec = nanoSec / NANOSECONDS_PER_SECOND;
1182
1183 time = ltt_time_add(tf->a_block_start->time, lTimeOffset);
1184
1185 return time;
1186 }
1187
1188 /*****************************************************************************
1189 *Function name
1190 * setFieldsOffset : set offset of the fields
1191 *Input params
1192 * tracefile : opened trace file
1193 * evT : the event type
1194 * evD : event data, it may be NULL
1195 ****************************************************************************/
1196
1197 void setFieldsOffset(LttTracefile *tf,LttEventType *evT,void *evD,LttTrace* t)
1198 {
1199 LttField * rootFld = evT->root_field;
1200 // rootFld->base_address = evD;
1201
1202 if(rootFld)
1203 rootFld->field_size = getFieldtypeSize(tf, evT, 0,0,rootFld, evD,t);
1204 }
1205
1206 /*****************************************************************************
1207 *Function name
1208 * getFieldtypeSize: get the size of the field type (primitive type)
1209 *Input params
1210 * tracefile : opened trace file
1211 * evT : event type
1212 * offsetRoot : offset from the root
1213 * offsetParent : offset from the parrent
1214 * fld : field
1215 * evD : event data, it may be NULL
1216 *Return value
1217 * int : size of the field
1218 ****************************************************************************/
1219
1220 int getFieldtypeSize(LttTracefile * t, LttEventType * evT, int offsetRoot,
1221 int offsetParent, LttField * fld, void *evD, LttTrace *trace)
1222 {
1223 int size, size1, element_number, i, offset1, offset2;
1224 LttType * type = fld->field_type;
1225
1226 if(t){
1227 if(evT->latest_block==t->which_block && evT->latest_event==t->which_event){
1228 return fld->field_size;
1229 }
1230 }
1231
1232 if(fld->field_fixed == 1){
1233 if(fld == evT->root_field) return fld->field_size;
1234 }
1235
1236 if(type->type_class != LTT_STRUCT && type->type_class != LTT_ARRAY &&
1237 type->type_class != LTT_SEQUENCE && type->type_class != LTT_STRING){
1238 if(fld->field_fixed == -1){
1239 size = (int) ltt_type_size(trace, type);
1240 fld->field_fixed = 1;
1241 }else size = fld->field_size;
1242
1243 }else if(type->type_class == LTT_ARRAY){
1244 element_number = (int) type->element_number;
1245 if(fld->field_fixed == -1){
1246 size = getFieldtypeSize(t, evT, offsetRoot,0,fld->child[0], NULL, trace);
1247 if(size == 0){ //has string or sequence
1248 fld->field_fixed = 0;
1249 }else{
1250 fld->field_fixed = 1;
1251 size *= element_number;
1252 }
1253 }else if(fld->field_fixed == 0){// has string or sequence
1254 size = 0;
1255 for(i=0;i<element_number;i++){
1256 size += getFieldtypeSize(t, evT, offsetRoot+size,size,
1257 fld->child[0], evD+size, trace);
1258 }
1259 }else size = fld->field_size;
1260
1261 }else if(type->type_class == LTT_SEQUENCE){
1262 size1 = (int) ltt_type_size(trace, type);
1263 if(fld->field_fixed == -1){
1264 fld->sequ_number_size = size1;
1265 fld->field_fixed = 0;
1266 size = getFieldtypeSize(t, evT, offsetRoot,0,fld->child[0], NULL, trace);
1267 fld->element_size = size;
1268 }else{//0: sequence
1269 element_number = getIntNumber(size1,evD);
1270 type->element_number = element_number;
1271 if(fld->element_size > 0){
1272 size = element_number * fld->element_size;
1273 }else{//sequence has string or sequence
1274 size = 0;
1275 for(i=0;i<element_number;i++){
1276 size += getFieldtypeSize(t, evT, offsetRoot+size+size1,size+size1,
1277 fld->child[0], evD+size+size1, trace);
1278 }
1279 }
1280 size += size1;
1281 }
1282
1283 }else if(type->type_class == LTT_STRING){
1284 size = 0;
1285 if(fld->field_fixed == -1){
1286 fld->field_fixed = 0;
1287 }else{//0: string
1288 size = strlen((char*)evD) + 1; //include end : '\0'
1289 }
1290
1291 }else if(type->type_class == LTT_STRUCT){
1292 element_number = (int) type->element_number;
1293 size = 0;
1294 if(fld->field_fixed == -1){
1295 offset1 = offsetRoot;
1296 offset2 = 0;
1297 for(i=0;i<element_number;i++){
1298 size1=getFieldtypeSize(t, evT,offset1,offset2, fld->child[i], NULL, trace);
1299 if(size1 > 0 && size >= 0){
1300 size += size1;
1301 if(offset1 >= 0) offset1 += size1;
1302 offset2 += size1;
1303 }else{
1304 size = -1;
1305 offset1 = -1;
1306 offset2 = -1;
1307 }
1308 }
1309 if(size == -1){
1310 fld->field_fixed = 0;
1311 size = 0;
1312 }else fld->field_fixed = 1;
1313 }else if(fld->field_fixed == 0){
1314 offset1 = offsetRoot;
1315 offset2 = 0;
1316 for(i=0;i<element_number;i++){
1317 size=getFieldtypeSize(t,evT,offset1,offset2,fld->child[i],evD+offset2, trace);
1318 offset1 += size;
1319 offset2 += size;
1320 }
1321 size = offset2;
1322 }else size = fld->field_size;
1323 }
1324
1325 fld->offset_root = offsetRoot;
1326 fld->offset_parent = offsetParent;
1327 if(!evD){
1328 fld->fixed_root = (offsetRoot==-1) ? 0 : 1;
1329 fld->fixed_parent = (offsetParent==-1) ? 0 : 1;
1330 }
1331 fld->field_size = size;
1332
1333 return size;
1334 }
1335
1336
1337 /*****************************************************************************
1338 *Function name
1339 * getIntNumber : get an integer number
1340 *Input params
1341 * size : the size of the integer
1342 * evD : the event data
1343 *Return value
1344 * int : an integer
1345 ****************************************************************************/
1346
1347 int getIntNumber(int size, void *evD)
1348 {
1349 gint64 i;
1350 if(size == 1) i = *(gint8 *)evD;
1351 else if(size == 2) i = *(gint16 *)evD;
1352 else if(size == 4) i = *(gint32 *)evD;
1353 else if(size == 8) i = *(gint64 *)evD;
1354
1355 return (int) i;
1356 }
1357
1358 /*****************************************************************************
1359 *Function name
1360 * getDataEndianType : get the data type size and endian type of the local
1361 * machine
1362 *Input params
1363 * size : size of data type
1364 * endian : endian type, little or big
1365 ****************************************************************************/
1366
1367 void getDataEndianType(LttArchSize * size, LttArchEndian * endian)
1368 {
1369 int i = 1;
1370 char c = (char) i;
1371 int sizeInt=sizeof(int), sizeLong=sizeof(long), sizePointer=sizeof(void *);
1372
1373 if(c == 1) *endian = LTT_LITTLE_ENDIAN;
1374 else *endian = LTT_BIG_ENDIAN;
1375
1376 if(sizeInt == 2 && sizeLong == 4 && sizePointer == 4)
1377 *size = LTT_LP32;
1378 else if(sizeInt == 4 && sizeLong == 4 && sizePointer == 4)
1379 *size = LTT_ILP32;
1380 else if(sizeInt == 4 && sizeLong == 8 && sizePointer == 8)
1381 *size = LTT_LP64;
1382 else if(sizeInt == 8 && sizeLong == 8 && sizePointer == 8)
1383 *size = LTT_ILP64;
1384 else *size = LTT_UNKNOWN;
1385 }
1386
This page took 0.064567 seconds and 4 git commands to generate.