git-svn-id: http://ltt.polymtl.ca/svn@212 04897980-b3bd-0310-b5e0-8ef037075253
authoryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 29 Aug 2003 16:25:15 +0000 (16:25 +0000)
committeryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 29 Aug 2003 16:25:15 +0000 (16:25 +0000)
ltt/branches/poly/lttv/state.c
ltt/branches/poly/lttv/textDump.c

index bb221a77f99c49523164310bee3c0ddbbd159b40..1a79246ee04df9ba7ec8b0a98b218cec7a79401b 100644 (file)
@@ -23,6 +23,8 @@ static GQuark
 
 void remove_all_processes(GHashTable *processes);
 
+LttvProcessState *create_process(LttvTracefileState *tfs, 
+                                LttvProcessState *parent, guint pid);
 
 static void
 init(LttvTracesetState *self, LttvTraceset *ts)
@@ -36,6 +38,8 @@ init(LttvTracesetState *self, LttvTraceset *ts)
   LttvTracefileContext *tfc;
 
   LttvTracefileState *tfcs;
+  
+  LttTime timestamp = {0,0};
 
   LTTV_TRACESET_CONTEXT_CLASS(g_type_class_peek_parent(LTTV_TRACESET_STATE_GET_CLASS(self)))->init((LttvTracesetContext *)self, ts);
 
@@ -47,13 +51,15 @@ init(LttvTracesetState *self, LttvTraceset *ts)
     nb_tracefile = ltt_trace_control_tracefile_number(tc->t);
     for(j = 0 ; j < nb_tracefile ; j++) {
       tfcs = (LttvTracefileState *)tfc = tc->control_tracefiles[j];
-      tfcs->process = NULL;
+      tfc->timestamp = timestamp;
+      tfcs->process = create_process(tfcs, NULL,0);
     }
 
     nb_tracefile = ltt_trace_per_cpu_tracefile_number(tc->t);
     for(j = 0 ; j < nb_tracefile ; j++) {
       tfcs = (LttvTracefileState *)tfc = tc->per_cpu_tracefiles[j];
-      tfcs->process = NULL;
+      tfc->timestamp = timestamp;
+      tfcs->process = create_process(tfcs, NULL,0);
     }
   }
 }
@@ -282,7 +288,11 @@ static void pop_state(LttvTracefileState *tfs, LttvInterruptType t)
 
   guint depth = process->interrupt_stack->len - 1;
 
-  g_assert(process->state->t == t);
+  //  g_assert(process->state->t == t);
+  if(process->state->t != t){
+    g_warning("Different interrupt type: ignore it\n");
+    return;
+  }
   g_array_remove_index(process->interrupt_stack, depth);
   depth--;
   process->state = &g_array_index(process->interrupt_stack, LttvInterruptState,
@@ -427,14 +437,17 @@ gboolean schedchange(void *hook_data, void *call_data)
 
   guint pid_in, pid_out, state_out;
 
-  pid_in = ltt_event_get_int(s->parent.e, h->f1);
-  pid_out = ltt_event_get_int(s->parent.e, h->f2);
-  state_out = ltt_event_get_int(s->parent.e, h->f3);
+  pid_in = ltt_event_get_unsigned(s->parent.e, h->f1);
+  pid_out = ltt_event_get_unsigned(s->parent.e, h->f2);
+  state_out = ltt_event_get_unsigned(s->parent.e, h->f3);
   if(s->process != NULL) {
     if(state_out == 0) s->process->state->s = LTTV_STATE_WAIT_CPU;
     else if(s->process->state->s == LTTV_STATE_EXIT) 
         exit_process(s, s->process);
     else s->process->state->s = LTTV_STATE_WAIT;
+
+    if(s->process->pid == 0)
+      s->process->pid == pid_out;
   }
   s->process = find_process(s, pid_in);
   s->process->state->s = LTTV_STATE_RUN;
@@ -450,7 +463,7 @@ gboolean process_fork(void *hook_data, void *call_data)
 
   guint child_pid;
 
-  child_pid = ltt_event_get_int(s->parent.e, f);
+  child_pid = ltt_event_get_unsigned(s->parent.e, f);
   create_process(s, s->process, child_pid);
   return FALSE;
 }
@@ -591,7 +604,6 @@ lttv_state_add_event_hooks(LttvTracesetState *self)
                        "in", "out", "out_state", schedchange);
     g_array_append_val(hooks, hook_id);
 
-/* for now, in core facility there is no process_fork and process_exit event
     hook_id = find_hook(ts->parent.t, "core", "process_fork", 
                        "child_pid", NULL, NULL, process_fork);
     g_array_append_val(hooks, hook_id);
@@ -599,7 +611,6 @@ lttv_state_add_event_hooks(LttvTracesetState *self)
     hook_id = find_hook(ts->parent.t, "core", "process_exit", 
                        NULL, NULL, NULL, process_exit);
     g_array_append_val(hooks, hook_id);
-*/
 
     /* Add these hooks to each before_event_by_id hooks list */
 
index 2734e3beea9266c7873345007435c6bbbf0c1b7c..797e7a12429e8d602257b3eeefffe80a1de8af43 100644 (file)
@@ -92,8 +92,8 @@ void print_field(LttEvent *e, LttField *f, GString *s, gboolean field_names) {
 
 
 void lttv_event_to_string(LttEvent *e, LttTracefile *tf, GString *s,
-    gboolean mandatory_fields, gboolean field_names)
-{
+    gboolean mandatory_fields, gboolean field_names, LttvTracefileState *tfs)
+{ 
   LttFacility *facility;
 
   LttEventType *event_type;
@@ -116,6 +116,8 @@ void lttv_event_to_string(LttEvent *e, LttTracefile *tf, GString *s,
         ltt_eventtype_name(event_type), (long)time.tv_sec, time.tv_nsec,
         ltt_tracefile_name(tf));
     /* Print the process id and the state/interrupt type of the process */
+    g_string_append_printf(s,", %d, %s", tfs->process->pid,
+                          g_quark_to_string(tfs->process->state->t));
   }
 
   if(field)
@@ -181,7 +183,7 @@ static int write_event_content(void *hook_data, void *call_data)
 
   e = tfc->e;
 
-  lttv_event_to_string(e, tfc->tf, a_string, TRUE, a_field_names);
+  lttv_event_to_string(e, tfc->tf, a_string, TRUE, a_field_names, tfs);
   g_string_append_printf(a_string,"\n");  
 
   if(a_state) {
This page took 0.027274 seconds and 4 git commands to generate.