batchtest with tracecontext shown no more time going back
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 24 Aug 2005 16:13:58 +0000 (16:13 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 24 Aug 2005 16:13:58 +0000 (16:13 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1072 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ltt/tracefile.c
ltt/branches/poly/lttv/lttv/batchtest.c
ltt/branches/poly/lttv/lttv/tracecontext.c

index 24fe6fe5f5e7d8760e661a1531fa7db1f50e3015..da5b356c15b092c8d66c419ec72b402532a606e4 100644 (file)
@@ -1883,6 +1883,7 @@ static int ltt_seek_next_event(LttTracefile *tf)
     ret = ERANGE;
     goto found;
   }
+  g_assert(tf->event.offset < tf->buf_size - tf->buffer.lost_size);
 
 found:
   return ret;
index a7de1fd71aee30f0c18d3c68cd5569d6d2f39d8e..5cd22fcc51ec02c27ddaba0bfdaa412e04a5f111 100644 (file)
@@ -169,7 +169,7 @@ 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);
@@ -196,7 +196,7 @@ gboolean count_event(void *hook_data, void __UNUSED__ *call_data)
   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/%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);
@@ -340,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);
index 03cee2cca190717b05e880ddcaf1d73e0f1e59db..c78907909d10bc2846d2d6bd339bcdd50143e983 100644 (file)
@@ -659,6 +659,8 @@ void lttv_process_traceset_begin(LttvTracesetContext *self,
   
 }
 
+enum read_state { LAST_NONE, LAST_OK, LAST_EMPTY };
+
 /* Note : a _middle must be preceded from a _seek or another middle */
 guint lttv_process_traceset_middle(LttvTracesetContext *self,
                               LttTime end,
@@ -675,7 +677,9 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
   
   unsigned count = 0;
 
-  guint read_ret = FALSE;
+  guint read_ret;
+
+  enum read_state last_read_state = LAST_NONE;
 
   gboolean last_ret = FALSE; /* return value of the last hook list called */
 
@@ -709,7 +713,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
     {
       return count;
     }
-
+    
     /* Get the tracefile with an event for the smallest time found. If two
        or more tracefiles have events for the same time, hope that lookup
        and remove are consistent. */
@@ -725,15 +729,20 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
     g_tree_foreach(pqueue, test_tree, tfc);
 #endif //DEBUG
 
-    count++;
-    
     e = ltt_tracefile_get_event(tfc->tf);
-    fac_id = ltt_event_facility_id(e);
-    ev_id = ltt_event_eventtype_id(e);
-    id = GET_HOOK_ID(fac_id, ev_id);
-    last_ret = lttv_hooks_call_merge(tfc->event, tfc,
-                        lttv_hooks_by_id_get(tfc->event_by_id, id), tfc);
 
+    if(last_read_state != LAST_EMPTY) {
+      /* Only call hooks if the last read has given an event or if we are at the
+       * first pass (not if last read returned end of tracefile) */
+      count++;
+      
+      fac_id = ltt_event_facility_id(e);
+      ev_id = ltt_event_eventtype_id(e);
+      id = GET_HOOK_ID(fac_id, ev_id);
+      last_ret = lttv_hooks_call_merge(tfc->event, tfc,
+                          lttv_hooks_by_id_get(tfc->event_by_id, id), tfc);
+    }
+    
     read_ret = ltt_tracefile_read(tfc->tf);
 
     if(likely(!read_ret)) {
@@ -741,12 +750,14 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
       tfc->timestamp = ltt_event_time(e);
       
            g_tree_insert(pqueue, tfc, tfc);
+      last_read_state = LAST_OK;
     } else {
       tfc->timestamp = ltt_time_infinite;
 
-      if(read_ret == ERANGE)
+      if(read_ret == ERANGE) {
+        last_read_state = LAST_EMPTY;
         g_debug("End of trace");
-      else
+      else
         g_error("Error happened in lttv_process_traceset_middle");
     }
   }
This page took 0.027574 seconds and 4 git commands to generate.