]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/trace: don't shift trace slices to 0
authorAustin Clements <austin@google.com>
Tue, 25 Jul 2017 20:38:39 +0000 (16:38 -0400)
committerAustin Clements <austin@google.com>
Fri, 11 Aug 2017 17:53:17 +0000 (17:53 +0000)
Currently all trace slices get shifted to start at time 0. This makes
it very difficult to find specific points in time unless they fall in
the first slice.

For example, right now when you click "View trace
(6.005646218s-8.155419698s)" on the trace tool's main page, the trace
view puts the first event in that slice at time 0. If you're looking
for something that happened at time 7s, you have to look at time
0.9943537s in the trace view. And if you want to subtract times taken
from different slices, you have to figure out what those time really
correspond to.

Fix this by telling the trace viewer not to shift the times when it
imports the trace. In the above example, this makes the view of that
second trace slice start at time 6.005646218s, so you don't have to do
any gymnastics to find or calculate times in later slices.

Change-Id: I04e0afda60f5573fdd8ad96238c24013297ef263
Reviewed-on: https://go-review.googlesource.com/54633
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
src/cmd/trace/trace.go

index 52ef73cd10ce0b1b90a01556fc9e634a859c4cad..30dde5ae26b550d5d2e2c7c5e374a57746a4c6a8 100644 (file)
@@ -102,7 +102,9 @@ var templTrace = `
 
   function onResult(result) {
     model = new tr.Model();
-    var i = new tr.importer.Import(model);
+    var opts = new tr.importer.ImportOptions();
+    opts.shiftWorldToZero = false;
+    var i = new tr.importer.Import(model, opts);
     var p = i.importTracesWithProgressDialog([result]);
     p.then(onModelLoaded, onImportFail);
   }