add process_fork process_exit in core.xml
authoryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 27 Aug 2003 20:16:43 +0000 (20:16 +0000)
committeryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 27 Aug 2003 20:16:43 +0000 (20:16 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@209 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ltt/convert/convert.c
ltt/branches/poly/ltt/convert/core.xml

index 8bead005964dc0c5560c8d2b7df4e5a3e2f0e4c0..e319b420147d1bc9bbe0fcfdb1379a5b08912c43 100644 (file)
@@ -9,9 +9,18 @@
 #include "LinuxEvents.h"
 
 #define TRACE_HEARTBEAT_ID  19
+#define PROCESS_FORK_ID     20
+#define PROCESS_EXIT_ID     21
+
 #define INFO_ENTRY          9
 #define OVERFLOW_FIGURE     4294967296
 
+typedef struct _new_process
+{
+  uint32_t  event_data1;     /* Data associated with event */
+  uint32_t  event_data2;    
+} LTT_PACKED_STRUCT new_process;
+
 #define write_to_buffer(DEST, SRC, SIZE) \
 do\
 {\
@@ -113,7 +122,7 @@ int main(int argc, char ** argv){
   trace_buffer_start *tBufStart;
   trace_buffer_end *tBufEnd;
   trace_file_system * tFileSys;
-  uint16_t newId, startId;
+  uint16_t newId, startId, tmpId;
   uint8_t  evId;
   uint32_t time_delta, startTimeDelta;
   void * cur_pos, *end_pos;
@@ -125,6 +134,8 @@ int main(int argc, char ** argv){
   uint32_t size_lost;
   int reserve_size = sizeof(buffer_start) + sizeof(uint16_t) + 2*sizeof(uint32_t);//lost_size and buffer_end event
 
+  new_process process;
+
   if(argc != 4 && argc != 5){
     printf("need a trace file and cpu number or root directory for the new tracefile\n");
     exit(1);
@@ -383,7 +394,6 @@ int main(int argc, char ** argv){
       char       lName[256];             /* Process name */
       FILE *          fProc;
       uint16_t        defaultId;
-      trace_process   process;
       trace_irq_entry irq;
 
       fProc = fopen(argv[2],"r");
@@ -392,13 +402,12 @@ int main(int argc, char ** argv){
       }
 
       while(fscanf(fProc, "PID: %d; PPID: %d; NAME: %s\n", &lPID, &lPPID, lName) > 0){
-       defaultId = TRACE_PROCESS;
-       process.event_sub_id = TRACE_PROCESS_FORK;
+       defaultId = PROCESS_FORK_ID;
        process.event_data1 = lPID;
        process.event_data2 = lPPID;
        write_to_buffer(write_pos_proc,(void*)&defaultId, sizeof(uint16_t));    
        write_to_buffer(write_pos_proc,(void*)&startTimeDelta, sizeof(uint32_t));
-       write_to_buffer(write_pos_proc,(void*)&process, sizeof(trace_process)); 
+       write_to_buffer(write_pos_proc,(void*)&process, sizeof(new_process));   
       }
 
       while(fscanf(fProc, "IRQ: %d; NAME: ", &lIntID) > 0){
@@ -539,9 +548,13 @@ int main(int argc, char ** argv){
          timeDelta = time_delta;
          subId = *(uint8_t*)cur_pos;
          if(subId == TRACE_PROCESS_FORK || subId ==TRACE_PROCESS_EXIT){
-           write_to_buffer(write_pos_proc,(void*)&newId, sizeof(uint16_t));
+           if( subId == TRACE_PROCESS_FORK)tmpId = PROCESS_FORK_ID;
+           else tmpId = PROCESS_EXIT_ID;
+           write_to_buffer(write_pos_proc,(void*)&tmpId, sizeof(uint16_t));
            write_to_buffer(write_pos_proc,(void*)&timeDelta, sizeof(uint32_t));
-           write_to_buffer(write_pos_proc,cur_pos, event_size);
+
+           process = *(new_process*)(cur_pos + sizeof(uint8_t));
+           write_to_buffer(write_pos_proc,(void*)&process, sizeof(new_process));
          } 
          break;
        case TRACE_FILE_SYSTEM:
index c7c2449b4cad53efc654b329cb78d88efb31db5b..1193af42aa4328659770d8b57c7194937cccd16a 100644 (file)
   </type>
 
 
+  <event name=process_fork>
+    <description>Fork a new process</description>
+    <struct>
+      <field name="event_data1"> <description>Data associated with event</description> <uint size=4/> </field>
+      <field name="event_data2"> <description>Data associated with event</description> <uint size=4/> </field>
+     </struct>
+  </event>
+
+  <event name=process_exit>
+    <description>Exit from a process</description>
+    <struct>
+      <field name="event_data1"> <description>Data associated with event</description> <uint size=4/> </field>
+      <field name="event_data2"> <description>Data associated with event</description> <uint size=4/> </field>
+     </struct>
+  </event>
+
 </facility>
 
 
This page took 0.02597 seconds and 4 git commands to generate.