From 39ae3eedb47e168da0ad74dfd240907bc06fd115 Mon Sep 17 00:00:00 2001 From: compudj Date: Sun, 15 Aug 2004 20:10:39 +0000 Subject: [PATCH] more precise start and end time : use approximation usec for cycles/nsec, then recalculate it git-svn-id: http://ltt.polymtl.ca/svn@778 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/tracefile.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 556fe492..6cf54a08 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -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); -- 2.34.1