more precise start and end time : use approximation usec for cycles/nsec, then recalc...
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 15 Aug 2004 20:10:39 +0000 (20:10 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 15 Aug 2004 20:10:39 +0000 (20:10 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@778 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ltt/tracefile.c

index 556fe492529e53011e45cb775f842359b2bc2386..6cf54a089bc076c9d5184d9dd652fc456c2bc69c 100644 (file)
@@ -1278,6 +1278,7 @@ gboolean ltt_tracefile_pre_read_cycles(LttTracefile *tf)
     /* The goal of all this pre reading */
     tf->a_block_end->cycle_count = tf->cur_cycle_count;
     g_debug("end of block cycle count : %llu", tf->cur_cycle_count);
+
     return FALSE;
   }
 
@@ -1342,16 +1343,28 @@ int readBlock(LttTracefile * tf, int whichBlock)
   tf->cur_cycle_count = 0;
   g_debug("precalculating cycles begin for block %i", whichBlock);
   while(likely(ltt_tracefile_pre_read_cycles(tf)));
+  /* Rough approximation of cycles per usec to calculate
+   * the real block start and end time.
+   */
+  getCyclePerNsec(tf);
+  /* we are at end position, make end time more precise */
+  tf->a_block_end->time = getEventTime(tf);  
+  
   g_debug("precalculating cycles end for block %i", whichBlock);
 
+  /* put back pointer at the beginning */
   tf->count = 0;
   tf->pre_cycle_count = 0;
   tf->cur_cycle_count = 0;
-  /* put back pointer at the beginning */
   tf->which_event = 1;
   tf->cur_event_pos = tf->buffer;//the beginning of the block, block start ev
   tf->cur_heart_beat_number = 0;
 
+  /* Make start time more precise */
+  tf->a_block_start->time = getEventTime(tf);
+
+  /* recalculate the cycles per nsec, with now more precise start and end time
+   */
   getCyclePerNsec(tf);
 
   tf->current_event_time = getEventTime(tf);  
This page took 0.026695 seconds and 4 git commands to generate.