fix the unknown time at beginning of trace : the world should turn round now
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 18 May 2006 18:39:53 +0000 (18:39 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 18 May 2006 18:39:53 +0000 (18:39 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1830 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/lttv/stats.c

index 9201c81803d947a924e72da46b47b1a771d0c87c..e8bc78c13561aafd6311f11754c85094152ca5bc 100644 (file)
@@ -203,6 +203,8 @@ restore_init_state(LttvTraceState *self)
   guint i, nb_cpus;
 
   LttvTracefileState *tfcs;
+
+  LttTime start_time, end_time;
   
   /* Free the process tables */
   if(self->processes != NULL) lttv_state_free_process_table(self->processes);
@@ -218,6 +220,7 @@ restore_init_state(LttvTraceState *self)
   //g_tree_destroy(self->parent.ts_context->pqueue);
   //self->parent.ts_context->pqueue = g_tree_new(compare_tracefile);
   
+  ltt_trace_time_span_get(self->parent.t, &start_time, &end_time);
   
   //lttv_process_trace_seek_time(&self->parent, ltt_time_zero);
 
@@ -226,7 +229,7 @@ restore_init_state(LttvTraceState *self)
   /* Put the per cpu running_process to beginning state : process 0. */
   for(i=0; i< nb_cpus; i++) {
     self->running_process[i] = lttv_state_create_process(self, NULL, i, 0,
-        LTTV_STATE_UNNAMED, &ltt_time_zero);
+        LTTV_STATE_UNNAMED, &start_time);
     self->running_process[i]->state->s = LTTV_STATE_RUN;
     self->running_process[i]->cpu = i;
   }
index 89da304621e490582c7ccb7ea3561ff3d335103a..7944bcd68e2bd326d4131e8c9c4723adea6ba881 100644 (file)
@@ -724,6 +724,20 @@ gboolean process_exit(void *hook_data, void *call_data)
   return FALSE;
 }
 
+gboolean before_enum_process_state(void *hook_data, void *call_data)
+{
+  mode_end((LttvTracefileStats *)call_data);
+  after_mode_end((LttvTracefileStats *)call_data);
+  mode_change((LttvTracefileStats *)call_data);
+  return FALSE;
+}
+
+gboolean after_enum_process_state(void *hook_data, void *call_data)
+{
+  update_event_tree((LttvTracefileStats *)call_data);
+  return FALSE;
+}
+
 gboolean process_free(void *hook_data, void *call_data)
 {
   return FALSE;
@@ -1000,9 +1014,9 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
     /* Find the eventtype id for the following events and register the
        associated by id hooks. */
 
-    hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 11);
-    g_array_set_size(hooks, 11);
-               hn=0;
+    hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 12);
+    g_array_set_size(hooks, 12);
+    hn=0;
 
     ret = lttv_trace_find_hook(ts->parent.parent.t,
         LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
@@ -1080,14 +1094,22 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
         before_function_exit, NULL,
         &g_array_index(hooks, LttvTraceHook, hn++));
     if(ret) hn--;
-               
+
+    /* statedump-related hooks */
+    ret = lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_STATEDUMP, LTT_EVENT_ENUM_PROCESS_STATE,
+        LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
+        before_enum_process_state, NULL,
+        &g_array_index(hooks, LttvTraceHook, hn++));
+    if(ret) hn--;
+
     g_array_set_size(hooks, hn);
 
     before_hooks = hooks;
 
-    hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 14);
-    g_array_set_size(hooks, 14);
-               hn=0;
+    hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 15);
+    g_array_set_size(hooks, 15);
+    hn=0;
 
     ret = lttv_trace_find_hook(ts->parent.parent.t,
         LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
@@ -1186,7 +1208,15 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
         after_function_exit, NULL,
         &g_array_index(hooks, LttvTraceHook, hn++));
     if(ret) hn--;
-       
+
+    /* statedump-related hooks */
+    ret = lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_STATEDUMP, LTT_EVENT_ENUM_PROCESS_STATE,
+        LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
+        after_enum_process_state, NULL,
+        &g_array_index(hooks, LttvTraceHook, hn++));
+    if(ret) hn--;
+
     g_array_set_size(hooks, hn);
 
     after_hooks = hooks;
This page took 0.026715 seconds and 4 git commands to generate.