From: compudj Date: Tue, 13 Sep 2005 19:01:35 +0000 (+0000) Subject: use only TSC X-Git-Tag: v0.12.20~2315 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88612d178eface14d8ba8304f9264f3324f78f42;p=lttv.git use only TSC git-svn-id: http://ltt.polymtl.ca/svn@1174 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/ltt/ltt-private.h b/ltt/branches/poly/ltt/ltt-private.h index 9e263c56..55374263 100644 --- a/ltt/branches/poly/ltt/ltt-private.h +++ b/ltt/branches/poly/ltt/ltt-private.h @@ -418,6 +418,7 @@ struct _LttTrace{ uint64_t start_tsc; uint64_t start_monotonic; LttTime start_time; + LttTime start_time_from_tsc; GData *tracefiles; //tracefiles groups }; diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 470eb5e0..d2b6f898 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -259,6 +259,8 @@ int parse_trace_header(void *header, LttTracefile *tf, LttTrace *t) &vheader->start_monotonic); t->start_time = ltt_get_time(LTT_GET_BO(tf), &vheader->start_time); + t->start_time_from_tsc = ltt_time_from_uint64( + (double)t->start_tsc * 1000000.0 / (double)t->start_freq); } } break; @@ -1532,10 +1534,11 @@ LttTime ltt_interpolate_time(LttTracefile *tf, LttEvent *event) // time = ltt_time_from_uint64( // cycles_2_ns(tf, (guint64)(tf->buffer.tsc - tf->buffer.begin.cycle_count))); - time = ltt_time_from_uint64((tf->buffer.tsc - tf->trace->start_tsc) * 1000000 + time = ltt_time_from_uint64( + (double)(tf->buffer.tsc - tf->trace->start_tsc) * 1000000.0 / (double)tf->trace->start_freq); //time = ltt_time_add(tf->buffer.begin.timestamp, time); - time = ltt_time_add(tf->trace->start_time, time); + time = ltt_time_add(tf->trace->start_time_from_tsc, time); return time; } @@ -1766,10 +1769,10 @@ static gint map_block(LttTracefile * tf, guint block_num) &header->begin.freq); tf->buffer.begin.timestamp = ltt_time_add( ltt_time_from_uint64( - (tf->buffer.begin.cycle_count - - tf->trace->start_tsc) * 1000000 + (double)(tf->buffer.begin.cycle_count + - tf->trace->start_tsc) * 1000000.0 / (double)tf->trace->start_freq), - tf->trace->start_time); + tf->trace->start_time_from_tsc); #if 0 tf->buffer.end.timestamp = ltt_time_add( @@ -1789,10 +1792,10 @@ static gint map_block(LttTracefile * tf, guint block_num) &header->lost_size); tf->buffer.end.timestamp = ltt_time_add( ltt_time_from_uint64( - (tf->buffer.end.cycle_count - - tf->trace->start_tsc) * 1000000 + (double)(tf->buffer.end.cycle_count + - tf->trace->start_tsc) * 1000000.0 / (double)tf->trace->start_freq), - tf->trace->start_time); + tf->trace->start_time_from_tsc); tf->buffer.tsc = tf->buffer.begin.cycle_count; tf->event.tsc = tf->buffer.tsc;