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