correct statedump end
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 3 Oct 2006 04:10:25 +0000 (04:10 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 3 Oct 2006 04:10:25 +0000 (04:10 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2149 04897980-b3bd-0310-b5e0-8ef037075253

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

index 6dd2663f10bd49d1fd51ad1bab614e3ca30b97ac..712fa0f700d58961916300e86de04ac5ed7ee8e4 100644 (file)
@@ -2359,19 +2359,19 @@ static void fix_process(gpointer key, gpointer value,
   LttvTracefileContext *tfc = (LttvTracefileContext *)user_data;
   LttTime *timestamp = (LttTime*)user_data;
 
-printf("%s %s\n", g_quark_to_string(process->type), g_quark_to_string(process->state->t));
-
   if(process->type == LTTV_STATE_KERNEL_THREAD) {
-    if(process->state->t == LTTV_STATE_MODE_UNKNOWN) {
-      process->state->t = LTTV_STATE_SYSCALL;
-      process->state->s = LTTV_STATE_WAIT;
-      process->state->n = LTTV_STATE_SUBMODE_NONE;
+    es = &g_array_index(process->execution_stack, LttvExecutionState, 0);
+    if(es->t == LTTV_STATE_MODE_UNKNOWN) {
+      es->t = LTTV_STATE_SYSCALL;
+      es->s = LTTV_STATE_WAIT;
+      es->n = LTTV_STATE_SUBMODE_NONE;
+      es->entry = *timestamp;
+      es->change = *timestamp;
+      es->cum_cpu_time = ltt_time_zero;
     }
   } else {
-    if(process->state->t == LTTV_STATE_MODE_UNKNOWN) {
-      process->execution_stack = g_array_set_size(process->execution_stack, 2);
-      es = process->state = &g_array_index(process->execution_stack, 
-          LttvExecutionState, 0);
+    es = &g_array_index(process->execution_stack, LttvExecutionState, 0);
+    if(es->t == LTTV_STATE_MODE_UNKNOWN) {
       es->t = LTTV_STATE_USER_MODE;
       es->n = LTTV_STATE_SUBMODE_NONE;
       es->entry = *timestamp;
@@ -2380,15 +2380,20 @@ printf("%s %s\n", g_quark_to_string(process->type), g_quark_to_string(process->s
       es->cum_cpu_time = ltt_time_zero;
       es->s = LTTV_STATE_RUN;
 
-      es = process->state = &g_array_index(process->execution_stack, 
+      if(process->execution_stack->len == 1) {
+        /* Still in user mode, means never scheduled */
+        process->execution_stack =
+          g_array_set_size(process->execution_stack, 2);
+        es = process->state = &g_array_index(process->execution_stack, 
           LttvExecutionState, 1);
-      es->t = LTTV_STATE_SYSCALL;
-      es->n = LTTV_STATE_SUBMODE_NONE;
-      es->entry = *timestamp;
-      //g_assert(timestamp->tv_sec != 0);
-      es->change = *timestamp;
-      es->cum_cpu_time = ltt_time_zero;
-      es->s = LTTV_STATE_WAIT;
+        es->t = LTTV_STATE_SYSCALL;
+        es->n = LTTV_STATE_SUBMODE_NONE;
+        es->entry = *timestamp;
+        //g_assert(timestamp->tv_sec != 0);
+        es->change = *timestamp;
+        es->cum_cpu_time = ltt_time_zero;
+        es->s = LTTV_STATE_WAIT;
+      }
     }
   }
 }
This page took 0.025902 seconds and 4 git commands to generate.