X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Ftracefile.c;h=ad2cf51af5c93f680e3a273da8f580a414957033;hb=a4fa48a2c30e710db39d3a7093961257ead5eb0d;hp=470eb5e09a619570bffa7a6e57d2a456fe3cb02c;hpb=791dffa6f060fe553546337fde7ed58a16f41178;p=lttv.git diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 470eb5e0..ad2cf51a 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -259,6 +259,10 @@ 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.tv_nsec *= 1000; /* microsec to nanosec */ + + t->start_time_from_tsc = ltt_time_from_uint64( + (double)t->start_tsc * 1000000.0 / (double)t->start_freq); } } break; @@ -1532,10 +1536,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 +1771,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 +1794,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; @@ -2552,13 +2557,17 @@ char * ltt_trace_system_description_description (LttSystemDescription * s) } -/* get the start time of the trace */ - -LttTime ltt_trace_system_description_trace_start_time(LttSystemDescription *s) +/* get the NTP corrected start time of the trace */ +LttTime ltt_trace_start_time(LttTrace *t) { - return s->trace_start; + return t->start_time; } +/* get the monotonic start time of the trace */ +LttTime ltt_trace_start_time_monotonic(LttTrace *t) +{ + return t->start_time_from_tsc; +} LttTracefile *ltt_tracefile_new() {