use only TSC
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 13 Sep 2005 19:01:35 +0000 (19:01 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 13 Sep 2005 19:01:35 +0000 (19:01 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1174 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ltt/ltt-private.h
ltt/branches/poly/ltt/tracefile.c

index 9e263c565b2675bbb5422cb3292eb04a8874b38f..55374263f0bce980335fac2aca3bbcbcd80d794d 100644 (file)
@@ -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
 };
index 470eb5e09a619570bffa7a6e57d2a456fe3cb02c..d2b6f898b1b7b4c342a4a431333626bf40ff5303 100644 (file)
@@ -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;
This page took 0.027892 seconds and 4 git commands to generate.