control flow view works (state computation disabled)
[lttv.git] / ltt / branches / poly / lttv / lttv / batchtest.c
index 7dc1771cfefc828dab813003fe26c5c4828916d0..5cd22fcc51ec02c27ddaba0bfdaa412e04a5f111 100644 (file)
@@ -99,8 +99,11 @@ static void lttv_trace_option(void __UNUSED__ *hook_data)
   LttTrace *trace;
 
   trace = ltt_trace_open(a_trace);
-  if(trace == NULL) g_critical("cannot open trace %s", a_trace);
-  lttv_traceset_add(traceset, lttv_trace_new(trace));
+  if(trace == NULL) {
+    g_critical("cannot open trace %s", a_trace);
+  } else {
+    lttv_traceset_add(traceset, lttv_trace_new(trace));
+  }
 }
 
 static double get_time() 
@@ -166,19 +169,45 @@ gboolean trace_event(void __UNUSED__ *hook_data, void *call_data)
   LttEvent *e = ltt_tracefile_get_event(tfs->parent.tf);
   ltt_event_position(e, a_event_position);
   ltt_event_position_get(a_event_position, &tf, &nb_block, &offset, &tsc);
-  fprintf(stderr,"Event %s %lu.%09lu [%u %u tsc %llu]\n",
+  fprintf(stderr,"Event %s %lu.%09lu [%u 0x%x tsc %llu]\n",
       g_quark_to_string(ltt_eventtype_name(ltt_event_eventtype(e))),
       tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec,
       nb_block, offset, tsc);
   return FALSE;
 }
 
+static LttTime count_previous_time = { 0, 0 };
 
 gboolean count_event(void *hook_data, void __UNUSED__ *call_data)
 {
+  LttvTracefileState *tfs = (LttvTracefileState *)call_data;
+  LttTracefile *tracefile = tfs->parent.tf;
+  guint nb_block, offset;
+  LttTracefile *tf_pos;
+  guint64 tsc;
+  LttEvent * event = ltt_tracefile_get_event(tracefile);
+  LttTime time;
   guint *pcount = (guint *)hook_data;
 
   (*pcount)++;
+  
+  time = ltt_event_time(event);
+  ltt_event_position(event, a_event_position);
+  ltt_event_position_get(a_event_position, &tf_pos, &nb_block, &offset, &tsc);
+  
+  if(ltt_time_compare(time, count_previous_time) < 0) {
+    g_warning("Time decreasing trace %s tracefile %s cpu %u position %u/0x%x",
+  g_quark_to_string(ltt_trace_name(ltt_tracefile_get_trace(tracefile))),
+  g_quark_to_string(ltt_tracefile_name(tracefile)), 
+  ltt_tracefile_num(tracefile), nb_block, offset);
+    g_warning("last time %lu.%lu vs current %lu.%lu",
+  count_previous_time.tv_sec, count_previous_time.tv_nsec,
+  time.tv_sec, time.tv_nsec);
+  } 
+  count_previous_time = time;
+
+
+
   return FALSE;
 }
 
@@ -311,7 +340,7 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data)
         g_quark_to_string(ltt_tracefile_name(tracefile)));
 
     if(ltt_time_compare(time, previous_time) < 0) {
-      g_warning("Time decreasing trace %s tracefile %s cpu %u position %u/%u",
+      g_warning("Time decreasing trace %s tracefile %s cpu %u position %u/0x%x",
     g_quark_to_string(ltt_trace_name(ltt_tracefile_get_trace(tracefile))),
     g_quark_to_string(ltt_tracefile_name(tracefile)), 
     ltt_tracefile_num(tracefile), nb_block, offset);
@@ -423,7 +452,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     lttv_hooks_add(event_hook, count_event, &count, LTTV_PRIO_DEFAULT);
     t = run_one_test(ts, ltt_time_zero, max_time);
     lttv_hooks_remove_data(event_hook, count_event, &count);
-    g_warning(
+    g_message(
         "Processing trace while counting events (%u events in %g seconds)",
        count, t);
   }
@@ -434,7 +463,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     lttv_state_add_event_hooks(ts);
     t = run_one_test(ts, ltt_time_zero, max_time);
     lttv_state_remove_event_hooks(ts);
-    g_warning("Processing trace while updating state (%g seconds)", t);
+    g_message("Processing trace while updating state (%g seconds)", t);
   }
 
   /* Run through all events computing the state and writing it out 
@@ -474,7 +503,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     lttv_stats_add_event_hooks(tscs);
     t = run_one_test(ts, ltt_time_zero, max_time);
     lttv_stats_remove_event_hooks(tscs);
-    g_warning("Processing trace while counting stats (%g seconds)", t);
+    g_message("Processing trace while counting stats (%g seconds)", t);
 
     if(lttv_profile_memory) {
       g_message("Memory summary after computing stats");
@@ -510,7 +539,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     t = run_one_test(ts, ltt_time_zero, max_time);
     lttv_state_remove_event_hooks(ts);
     lttv_stats_remove_event_hooks(tscs);
-    g_warning(
+    g_message(
         "Processing trace while counting state and stats (%g seconds)", t);
 
     if(lttv_profile_memory) {
@@ -549,7 +578,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     if(a_save_state_copy)
         lttv_hooks_remove_data(event_hook,save_state_copy_event, &save_state);
 
-    g_warning("Processing trace while updating/saving state (%g seconds)", t);
+    g_message("Processing trace while updating/saving state (%g seconds)", t);
 
     if(lttv_profile_memory) {
       g_message("Memory summary after computing/saving state");
@@ -569,7 +598,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
         t = run_one_test(ts, save_state.write_time[j], 
             save_state.write_time[j]);
         lttv_state_remove_event_hooks(ts);
-        g_warning("Seeking to %lu.%lu (%g seconds)", 
+        g_message("Seeking to %lu.%lu (%g seconds)", 
             save_state.write_time[j].tv_sec, save_state.write_time[j].tv_nsec,
             t);
 
This page took 0.023946 seconds and 4 git commands to generate.