12 #include "LinuxEvents.h"
14 #define TRACE_HEARTBEAT_ID 19
15 #define PROCESS_FORK_ID 20
16 #define PROCESS_EXIT_ID 21
19 #define OVERFLOW_FIGURE 0x100000000ULL
21 typedef struct _new_process
23 uint32_t event_data1
; /* Data associated with event */
25 } LTT_PACKED_STRUCT new_process
;
27 #define write_to_buffer(DEST, SRC, SIZE) \
30 memcpy(DEST, SRC, SIZE);\
34 int readFile(int fd
, void * buf
, size_t size
, char * mesg
)
36 ssize_t nbBytes
= read(fd
, buf
, size
);
38 if((size_t)nbBytes
!= size
) {
40 perror("Error in readFile : ");
49 void getDataEndianType(char * size
, char * endian
)
53 int sizeInt
=sizeof(int), sizeLong
=sizeof(long), sizePointer
=sizeof(void *);
55 if(c
== 1) strcpy(endian
,"LITTLE_ENDIAN");
56 else strcpy(endian
, "BIG_ENDIAN");
58 if(sizeInt
== 2 && sizeLong
== 4 && sizePointer
== 4)
60 else if(sizeInt
== 4 && sizeLong
== 4 && sizePointer
== 4)
62 else if(sizeInt
== 4 && sizeLong
== 8 && sizePointer
== 8)
64 else if(sizeInt
== 8 && sizeLong
== 8 && sizePointer
== 8)
66 else strcpy(size
,"UNKNOWN");
69 #define BUFFER_SIZE 80
71 typedef struct _buffer_start
{
76 } __attribute__ ((packed
)) buffer_start
;
78 typedef struct _buffer_end
{
83 } __attribute__ ((packed
)) buffer_end
;
86 typedef struct _heartbeat
{
90 } __attribute__ ((packed
)) heartbeat
;
93 int main(int argc
, char ** argv
){
97 int fdFac
, fdIntr
, fdProc
;
98 char arch_size
[BUFFER_SIZE
];
99 char endian
[BUFFER_SIZE
];
100 char node_name
[BUFFER_SIZE
];
101 char domainname
[BUFFER_SIZE
];
102 char kernel_name
[BUFFER_SIZE
];
103 char kernel_release
[BUFFER_SIZE
];
104 char kernel_version
[BUFFER_SIZE
];
105 char machine
[BUFFER_SIZE
];
106 char processor
[BUFFER_SIZE
];
107 char hardware_platform
[BUFFER_SIZE
];
108 char operating_system
[BUFFER_SIZE
];
110 int ltt_block_size
=0;
111 int ltt_major_version
=0;
112 int ltt_minor_version
=0;
114 char buf
[BUFFER_SIZE
];
119 char foo
[4*BUFFER_SIZE
];
120 char foo_eventdefs
[4*BUFFER_SIZE
];
121 char foo_control
[4*BUFFER_SIZE
];
122 char foo_cpu
[4*BUFFER_SIZE
];
123 char foo_info
[4*BUFFER_SIZE
];
125 char foo_control_facilities
[4*BUFFER_SIZE
];
126 char foo_control_processes
[4*BUFFER_SIZE
];
127 char foo_control_interrupts
[4*BUFFER_SIZE
];
128 char foo_info_system
[4*BUFFER_SIZE
];
130 struct stat lTDFStat
;
132 int block_number
, block_size
;
133 char * buffer
, *buf_out
, cpuStr
[4*BUFFER_SIZE
];
134 char * buf_fac
, * buf_intr
, * buf_proc
;
135 void * write_pos
, *write_pos_fac
, * write_pos_intr
, *write_pos_proc
;
137 trace_buffer_start
*tBufStart
;
138 trace_buffer_end
*tBufEnd
;
139 trace_file_system
* tFileSys
;
140 uint16_t newId
, startId
, tmpId
;
142 uint32_t time_delta
, startTimeDelta
;
143 void * cur_pos
, *end_pos
;
144 buffer_start start
, start_proc
, start_intr
;
145 buffer_end end
, end_proc
, end_intr
;
149 int reserve_size
= sizeof(buffer_start
) + sizeof(uint16_t) + 2*sizeof(uint32_t);//lost_size and buffer_end event
155 printf("Usage : ./convert processfile_name number_of_cpu tracefile1 tracefile2 ... trace_creation_directory\n");
156 printf("For more details, see README.\n");
161 printf("cpu number = %d\n", cpu
);
164 if(argc
!= nb_para
&& argc
!= nb_para
+1){
165 printf("need trace files and cpu number or root directory for the new tracefile\n");
171 strcpy(foo_eventdefs
, "foo/eventdefs");
172 strcpy(foo_control
, "foo/control");
173 strcpy(foo_cpu
, "foo/cpu");
174 strcpy(foo_info
, "foo/info");
176 strcpy(foo
, argv
[nb_para
]);
177 strcpy(foo_eventdefs
, argv
[nb_para
]);
178 strcat(foo_eventdefs
,"/eventdefs");
179 strcpy(foo_control
, argv
[nb_para
]);
180 strcat(foo_control
,"/control");
181 strcpy(foo_cpu
, argv
[nb_para
]);
182 strcat(foo_cpu
,"/cpu");
183 strcpy(foo_info
, argv
[nb_para
]);
184 strcat(foo_info
,"/info");
186 strcpy(foo_control_facilities
, foo_control
);
187 strcat(foo_control_facilities
,"/facilities");
188 strcpy(foo_control_processes
, foo_control
);
189 strcat(foo_control_processes
, "/processes");
190 strcpy(foo_control_interrupts
, foo_control
);
191 strcat(foo_control_interrupts
, "/interrupts");
192 strcpy(foo_info_system
, foo_info
);
193 strcat(foo_info_system
, "/system.xml");
196 getDataEndianType(arch_size
, endian
);
197 printf("Arch_size: %s, Endian: %s\n", arch_size
, endian
);
199 fp
= fopen("sysInfo.out","r");
201 g_error("Unable to open file sysInfo.out\n");
204 for(i
=0;i
<INFO_ENTRY
;i
++){
205 if(!fgets(buf
,BUFFER_SIZE
-1,fp
))
206 g_error("The format of sysInfo.out is not right\n");
207 if(strncmp(buf
,"node_name=",10)==0){
208 strcpy(node_name
,&buf
[10]);
209 node_name
[strlen(node_name
)-1] = '\0';
210 }else if(strncmp(buf
,"domainname=",11)==0){
211 strcpy(domainname
,&buf
[11]);
212 domainname
[strlen(domainname
)-1] = '\0';
213 }else if(strncmp(buf
,"kernel_name=",12)==0){
214 strcpy(kernel_name
,&buf
[12]);
215 kernel_name
[strlen(kernel_name
)-1] = '\0';
216 }else if(strncmp(buf
,"kernel_release=",15)==0){
217 strcpy(kernel_release
,&buf
[15]);
218 kernel_release
[strlen(kernel_release
)-1] = '\0';
219 }else if(strncmp(buf
,"kernel_version=",15)==0){
220 strcpy(kernel_version
,&buf
[15]);
221 kernel_version
[strlen(kernel_version
)-1] = '\0';
222 }else if(strncmp(buf
,"machine=",8)==0){
223 strcpy(machine
,&buf
[8]);
224 machine
[strlen(machine
)-1] = '\0';
225 }else if(strncmp(buf
,"processor=",10)==0){
226 strcpy(processor
,&buf
[10]);
227 processor
[strlen(processor
)-1] = '\0';
228 }else if(strncmp(buf
,"hardware_platform=",18)==0){
229 strcpy(hardware_platform
,&buf
[18]);
230 hardware_platform
[strlen(hardware_platform
)-1] = '\0';
231 }else if(strncmp(buf
,"operating_system=",17)==0){
232 strcpy(operating_system
,&buf
[17]);
233 operating_system
[strlen(operating_system
)-1] = '\0';
238 if(mkdir(foo
, S_IFDIR
| S_IRWXU
| S_IRGRP
| S_IROTH
))
239 g_error("can not make %s directory", foo
);
240 if(mkdir(foo_info
, S_IFDIR
| S_IRWXU
| S_IRGRP
| S_IROTH
))
241 g_error("can not make %s directory", foo_info
);
242 if(mkdir(foo_cpu
, S_IFDIR
| S_IRWXU
| S_IRGRP
| S_IROTH
))
243 g_error("can not make %s directory", foo_cpu
);
244 if(mkdir(foo_control
, S_IFDIR
| S_IRWXU
| S_IRGRP
| S_IROTH
))
245 g_error("can not make %s directory", foo_control
);
246 if(mkdir(foo_eventdefs
, S_IFDIR
| S_IRWXU
| S_IRGRP
| S_IROTH
))
247 g_error("can not make %s directory", foo_eventdefs
);
249 fp
= fopen(foo_info_system
,"w");
251 g_error("Unable to open file system.xml\n");
254 fdFac
= open(foo_control_facilities
,O_CREAT
| O_RDWR
| O_TRUNC
,S_IRUSR
|S_IWUSR
| S_IRGRP
| S_IROTH
);
256 g_error("Unable to open file facilities\n");
258 fdIntr
= open(foo_control_interrupts
,O_CREAT
| O_RDWR
| O_TRUNC
,S_IRUSR
|S_IWUSR
| S_IRGRP
| S_IROTH
);
260 g_error("Unable to open file interrupts\n");
262 fdProc
= open(foo_control_processes
,O_CREAT
| O_RDWR
| O_TRUNC
,S_IRUSR
|S_IWUSR
| S_IRGRP
| S_IROTH
);
264 g_error("Unable to open file process\n");
269 fd
= open(argv
[nb_para
-cpu
+k
], O_RDONLY
, 0);
271 g_error("Unable to open input data file %s\n", argv
[nb_para
-cpu
+k
]);
274 if(fstat(fd
, &lTDFStat
) < 0){
275 g_error("Unable to get the status of the input data file\n");
277 file_size
= lTDFStat
.st_size
;
279 buffer
= g_new(char, 4000);
280 readFile(fd
,(void*)buffer
, 3500, "Unable to read block header");
283 evId
= *(uint8_t *)cur_pos
;
284 cur_pos
+= sizeof(uint8_t);
286 time_delta
= *(uint32_t*)cur_pos
;
287 cur_pos
+= sizeof(uint32_t);
288 tBufStart
= (trace_buffer_start
*)cur_pos
;
289 cur_pos
+= sizeof(trace_buffer_start
);
290 cur_pos
+= sizeof(uint16_t); //Skip event size
292 evId
= *(uint8_t *)cur_pos
;
293 cur_pos
+= sizeof(uint8_t);
294 cur_pos
+= sizeof(uint32_t);
295 tStart
= (trace_start
*)cur_pos
;
298 startTimeDelta
= time_delta
;
299 start
.seconds
= tBufStart
->Time
.tv_sec
;
301 start
.nanoseconds
= tBufStart
->Time
.tv_usec
* 1000;
302 start
.cycle_count
= tBufStart
->TSC
;
303 start
.block_id
= tBufStart
->ID
;
304 end
.block_id
= start
.block_id
;
306 ltt_major_version
= tStart
->MajorVersion
;
307 ltt_minor_version
= tStart
->MinorVersion
;
308 ltt_block_size
= tStart
->BufferSize
;
309 ltt_log_cpu
= tStart
->LogCPUID
;
311 block_size
= ltt_block_size
;//FIXME
312 block_number
= file_size
/ltt_block_size
;
315 buffer
= g_new(char, ltt_block_size
);
316 buf_fac
= g_new(char, block_size
);
317 write_pos_fac
= buf_fac
;
318 buf_intr
= g_new(char, block_size
);
319 write_pos_intr
= buf_intr
;
320 buf_proc
= g_new(char, block_size
);
321 write_pos_proc
= buf_proc
;
323 buf_out
= g_new(char, block_size
);
325 sprintf(cpuStr
,"%s/%d",foo_cpu
,k
);
326 fdCpu
= open(cpuStr
, O_CREAT
| O_RDWR
| O_TRUNC
,S_IRUSR
|S_IWUSR
| S_IRGRP
| S_IROTH
); //for cpu k
327 if(fdCpu
< 0) g_error("Unable to open cpu file %d\n", k
);
328 lseek(fd
,0,SEEK_SET
);
330 for(i
=0;i
<block_number
;i
++){
333 memset((void*)buf_out
, 0, block_size
);
335 memset((void*)buf_intr
, 0, block_size
);
336 memset((void*)buf_fac
, 0, block_size
);
337 memset((void*)buf_proc
, 0, block_size
);
338 write_pos_intr
= buf_intr
;
339 write_pos_fac
= buf_fac
;
340 write_pos_proc
= buf_proc
;
342 memset((void*)buffer
,0,ltt_block_size
);
343 readFile(fd
,(void*)buffer
, ltt_block_size
, "Unable to read block header");
346 evId
= *(uint8_t *)cur_pos
;
347 cur_pos
+= sizeof(uint8_t);
349 time_delta
= *(uint32_t*)cur_pos
;
350 cur_pos
+= sizeof(uint32_t);
351 tBufStart
= (trace_buffer_start
*)cur_pos
;
352 cur_pos
+= sizeof(trace_buffer_start
);
353 cur_pos
+= sizeof(uint16_t); //Skip event size
356 startTimeDelta
= time_delta
;
357 start
.seconds
= tBufStart
->Time
.tv_sec
;
358 /* usec -> nsec (Mathieu) */
359 start
.nanoseconds
= tBufStart
->Time
.tv_usec
* 1000;
360 start
.cycle_count
= tBufStart
->TSC
;
361 beat_count
= start
.cycle_count
;
362 start
.block_id
= tBufStart
->ID
;
363 end
.block_id
= start
.block_id
;
365 end_pos
= buffer
+ ltt_block_size
; //end of the buffer
366 size_lost
= *(uint32_t*)(end_pos
- sizeof(uint32_t));
368 end_pos
= buffer
+ ltt_block_size
- size_lost
; //buffer_end event
370 tBufEnd
= (trace_buffer_end
*)(end_pos
+ 2 * sizeof(uint8_t)+sizeof(uint32_t));
372 tBufEnd
= (trace_buffer_end
*)(end_pos
+sizeof(uint8_t)+sizeof(uint32_t));
374 end
.seconds
= tBufEnd
->Time
.tv_sec
;
375 /* usec -> nsec (Mathieu) */
376 end
.nanoseconds
= tBufEnd
->Time
.tv_usec
* 1000;
377 end
.cycle_count
= tBufEnd
->TSC
;
379 //skip buffer start and trace start events
380 if(i
==0) //the first block
381 cur_pos
= buffer
+ sizeof(trace_buffer_start
) + sizeof(trace_start
) + 2*(sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint32_t));
383 cur_pos
= buffer
+ sizeof(trace_buffer_start
) + sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint32_t);
385 //write start block event
386 write_to_buffer(write_pos
,(void*)&startId
, sizeof(uint16_t));
387 write_to_buffer(write_pos
,(void*)&startTimeDelta
, sizeof(uint32_t));
388 write_to_buffer(write_pos
,(void*)&start
, sizeof(buffer_start
));
390 //write start block event into processes and interrupts files
391 write_to_buffer(write_pos_intr
,(void*)&startId
, sizeof(uint16_t));
392 write_to_buffer(write_pos_intr
,(void*)&startTimeDelta
, sizeof(uint32_t));
394 start_intr
.nanoseconds
-= 20;
395 write_to_buffer(write_pos_intr
,(void*)&start_intr
, sizeof(buffer_start
));
397 write_to_buffer(write_pos_proc
,(void*)&startId
, sizeof(uint16_t));
398 write_to_buffer(write_pos_proc
,(void*)&startTimeDelta
, sizeof(uint32_t));
400 start_proc
.nanoseconds
-= 40;
401 write_to_buffer(write_pos_proc
,(void*)&start_proc
, sizeof(buffer_start
));
403 //parse *.proc file to get process and irq info
405 int lIntID
; /* Interrupt ID */
406 int lPID
, lPPID
; /* Process PID and Parent PID */
407 char lName
[256]; /* Process name */
412 fProc
= fopen(argv
[1],"r");
414 g_error("Unable to open file %s\n", argv
[1]);
417 while(fscanf(fProc
, "PID: %d; PPID: %d; NAME: %s\n", &lPID
, &lPPID
, lName
) > 0){
418 defaultId
= PROCESS_FORK_ID
;
419 process
.event_data1
= lPID
;
420 process
.event_data2
= lPPID
;
421 write_to_buffer(write_pos_proc
,(void*)&defaultId
, sizeof(uint16_t));
422 write_to_buffer(write_pos_proc
,(void*)&startTimeDelta
, sizeof(uint32_t));
423 write_to_buffer(write_pos_proc
,(void*)&process
, sizeof(new_process
));
426 while(fscanf(fProc
, "IRQ: %d; NAME: ", &lIntID
) > 0){
427 /* Read 'til the end of the line */
428 fgets(lName
, 200, fProc
);
430 defaultId
= TRACE_IRQ_ENTRY
;
433 write_to_buffer(write_pos_intr
,(void*)&defaultId
, sizeof(uint16_t));
434 write_to_buffer(write_pos_intr
,(void*)&startTimeDelta
, sizeof(uint32_t));
435 write_to_buffer(write_pos_intr
,(void*)&irq
, sizeof(trace_irq_entry
));
446 cpu_id
= *(uint8_t*)cur_pos
;
447 cur_pos
+= sizeof(uint8_t);
449 evId
= *(uint8_t *)cur_pos
;
451 if(evId
== TRACE_HEARTBEAT
) {
452 newId
= TRACE_HEARTBEAT_ID
;
454 cur_pos
+= sizeof(uint8_t);
455 time_delta
= *(uint32_t*)cur_pos
;
456 cur_pos
+= sizeof(uint32_t);
458 //write event_id and time_delta
459 write_to_buffer(write_pos
,(void*)&newId
,sizeof(uint16_t));
460 write_to_buffer(write_pos
,(void*)&time_delta
, sizeof(uint32_t));
462 if(evId
== TRACE_BUFFER_END
){
463 #if 0 //(Mathieu : already set correctly to tBufEnd.TSC)
464 end
.cycle_count
= start
.cycle_count
465 + beat_count
* OVERFLOW_FIGURE
;
467 int size
= (void*)buf_out
+ block_size
- write_pos
468 - sizeof(buffer_end
) - sizeof(uint32_t);
471 //int size = (void*)buf_out + block_size - write_pos
472 // + sizeof(uint16_t) + sizeof(uint32_t);
473 g_assert((void*)write_pos
< (void*)buf_out
+ block_size
);
474 write_to_buffer(write_pos
,(void*)&end
,sizeof(buffer_end
));
475 write_pos
= buf_out
+ block_size
- sizeof(uint32_t);
476 write_to_buffer(write_pos
,(void*)&size
, sizeof(uint32_t));
477 write(fdCpu
,(void*)buf_out
, block_size
);
479 //write out processes and intrrupts files
481 int size_intr
= block_size
+ (void*)buf_intr
- write_pos_intr
482 - sizeof(buffer_end
) - sizeof(uint32_t);
483 int size_proc
= block_size
+ (void*)buf_proc
- write_pos_proc
484 - sizeof(buffer_end
) - sizeof(uint32_t);
485 //int size_intr = block_size - (write_pos_intr - (void*)buf_intr);
486 //int size_proc = block_size - (write_pos_proc - (void*)buf_proc);
487 write_to_buffer(write_pos_intr
,(void*)&newId
,sizeof(uint16_t));
488 write_to_buffer(write_pos_intr
,(void*)&time_delta
, sizeof(uint32_t));
490 end_intr
.nanoseconds
-= 20;
491 write_to_buffer(write_pos_intr
,(void*)&end_intr
,sizeof(buffer_start
));
493 write_to_buffer(write_pos_proc
,(void*)&newId
,sizeof(uint16_t));
494 write_to_buffer(write_pos_proc
,(void*)&time_delta
, sizeof(uint32_t));
496 end_proc
.nanoseconds
-= 40;
497 write_to_buffer(write_pos_proc
,(void*)&end_proc
,sizeof(buffer_start
));
499 write_pos_intr
= buf_intr
+ block_size
- sizeof(uint32_t);
500 write_pos_proc
= buf_proc
+ block_size
- sizeof(uint32_t);
501 write_to_buffer(write_pos_intr
,(void*)&size_intr
, sizeof(uint32_t));
502 write_to_buffer(write_pos_proc
,(void*)&size_proc
, sizeof(uint32_t));
503 //for now don't output processes and interrupt information
504 // write(fdIntr,(void*)buf_intr,block_size);
505 // write(fdProc,(void*)buf_proc,block_size);
512 case TRACE_SYSCALL_ENTRY
:
513 event_size
= sizeof(trace_syscall_entry
);
515 case TRACE_SYSCALL_EXIT
:
518 case TRACE_TRAP_ENTRY
:
519 event_size
= sizeof(trace_trap_entry
);
521 case TRACE_TRAP_EXIT
:
524 case TRACE_IRQ_ENTRY
:
525 event_size
= sizeof(trace_irq_entry
);
526 timeDelta
= time_delta
;
527 write_to_buffer(write_pos_intr
,(void*)&newId
, sizeof(uint16_t));
528 write_to_buffer(write_pos_intr
,(void*)&timeDelta
, sizeof(uint32_t));
529 write_to_buffer(write_pos_intr
,cur_pos
, event_size
);
533 timeDelta
= time_delta
;
534 write_to_buffer(write_pos_intr
,(void*)&newId
, sizeof(uint16_t));
535 write_to_buffer(write_pos_intr
,(void*)&timeDelta
, sizeof(uint32_t));
537 case TRACE_SCHEDCHANGE
:
538 event_size
= sizeof(trace_schedchange
);
540 case TRACE_KERNEL_TIMER
:
544 event_size
= sizeof(trace_soft_irq
);
545 // timeDelta = time_delta;
546 // write_to_buffer(write_pos_intr,(void*)&newId, sizeof(uint16_t));
547 // write_to_buffer(write_pos_intr,(void*)&timeDelta, sizeof(uint32_t));
548 // write_to_buffer(write_pos_intr,cur_pos, event_size);
551 event_size
= sizeof(trace_process
);
552 timeDelta
= time_delta
;
553 subId
= *(uint8_t*)cur_pos
;
554 if(subId
== TRACE_PROCESS_FORK
|| subId
==TRACE_PROCESS_EXIT
){
555 if( subId
== TRACE_PROCESS_FORK
)tmpId
= PROCESS_FORK_ID
;
556 else tmpId
= PROCESS_EXIT_ID
;
557 write_to_buffer(write_pos_proc
,(void*)&tmpId
, sizeof(uint16_t));
558 write_to_buffer(write_pos_proc
,(void*)&timeDelta
, sizeof(uint32_t));
560 process
= *(new_process
*)(cur_pos
+ sizeof(uint8_t));
561 write_to_buffer(write_pos_proc
,(void*)&process
, sizeof(new_process
));
564 case TRACE_FILE_SYSTEM
:
565 event_size
= sizeof(trace_file_system
)- sizeof(char*);
568 event_size
= sizeof(trace_timer
);
571 event_size
= sizeof(trace_memory
);
574 event_size
= sizeof(trace_socket
);
577 event_size
= sizeof(trace_ipc
);
580 event_size
= sizeof(trace_network
);
582 case TRACE_HEARTBEAT
:
584 if(timeDelta
< (0xFFFFFFFF&beat_count
)) {
586 beat_count
+= 0x100000000ULL
- (uint64_t)(0xFFFFFFFF&beat_count
)
587 + (uint64_t)timeDelta
;
590 beat_count
+= timeDelta
- (0xFFFFFFFF&beat_count
);
593 beat
.nanoseconds
= 0;
594 beat
.cycle_count
= beat_count
;
597 write_to_buffer(write_pos_intr
,(void*)&newId
, sizeof(uint16_t));
598 write_to_buffer(write_pos_intr
,(void*)&timeDelta
, sizeof(uint32_t));
599 write_to_buffer(write_pos_intr
,(void*)&beat
, sizeof(heartbeat
));
600 write_to_buffer(write_pos_proc
,(void*)&newId
, sizeof(uint16_t));
601 write_to_buffer(write_pos_proc
,(void*)&timeDelta
, sizeof(uint32_t));
602 write_to_buffer(write_pos_proc
,(void*)&beat
, sizeof(heartbeat
));
608 if(evId
!= TRACE_FILE_SYSTEM
&& event_size
>=0){
609 write_to_buffer(write_pos
, cur_pos
, event_size
);
611 if(evId
== TRACE_HEARTBEAT
){
612 write_to_buffer(write_pos
, (void*)&beat
, sizeof(heartbeat
));
615 cur_pos
+= event_size
+ sizeof(uint16_t); //skip data_size
616 }else if(evId
== TRACE_FILE_SYSTEM
){
619 tFileSys
= (trace_file_system
*)cur_pos
;
620 subId
= tFileSys
->event_sub_id
;
621 if(subId
== TRACE_FILE_SYSTEM_OPEN
|| subId
== TRACE_FILE_SYSTEM_EXEC
){
622 nbBytes
= tFileSys
->event_data2
+1;
625 write_to_buffer(write_pos
, cur_pos
, event_size
);
626 cur_pos
+= event_size
+ sizeof(char*);
628 write_to_buffer(write_pos
, cur_pos
, nbBytes
);
630 write_to_buffer(write_pos
, (void*)&c
, 1);
632 cur_pos
+= nbBytes
+ sizeof(uint16_t); //skip data_size
633 }else if(event_size
== -1){
634 printf("Unknown event: evId=%d, i=%d, event_count=%d\n", newId
, i
, event_count
);
653 //write to system.xml
654 fprintf(fp
,"<system \n");
655 fprintf(fp
,"node_name=\"%s\" \n", node_name
);
656 fprintf(fp
,"domainname=\"%s\" \n", domainname
);
657 fprintf(fp
,"cpu=\"%d\" \n", cpu
);
658 fprintf(fp
,"arch_size=\"%s\" \n", arch_size
);
659 fprintf(fp
,"endian=\"%s\" \n",endian
);
660 fprintf(fp
,"kernel_name=\"%s\" \n",kernel_name
);
661 fprintf(fp
,"kernel_release=\"%s\" \n",kernel_release
);
662 fprintf(fp
,"kernel_version=\"%s\" \n",kernel_version
);
663 fprintf(fp
,"machine=\"%s\" \n",machine
);
664 fprintf(fp
,"processor=\"%s\" \n",processor
);
665 fprintf(fp
,"hardware_platform=\"%s\" \n",hardware_platform
);
666 fprintf(fp
,"operating_system=\"%s\" \n",operating_system
);
667 fprintf(fp
,"ltt_major_version=\"%d\" \n",ltt_major_version
);
668 fprintf(fp
,"ltt_minor_version=\"%d\" \n",ltt_minor_version
);
669 fprintf(fp
,"ltt_block_size=\"%d\" \n",ltt_block_size
);
671 fprintf(fp
,"This is just a test\n");
672 fprintf(fp
,"</system>\n");