<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:<br>
<blockquote type="cite"
cite="mid:20180713095537.21080-1-tvrtko.ursulin@linux.intel.com">
<pre wrap="">From: Tvrtko Ursulin <a class="moz-txt-link-rfc2396E" href="mailto:tvrtko.ursulin@intel.com"><tvrtko.ursulin@intel.com></a>
It is possible to customize the axis display so change it to display
timestamps in seconds on the major axis (with six decimal spaces) and
millisecond offsets on the minor axis.
v2:
* Give up on broken relative timestamps.
Signed-off-by: Tvrtko Ursulin <a class="moz-txt-link-rfc2396E" href="mailto:tvrtko.ursulin@intel.com"><tvrtko.ursulin@intel.com></a>
Suggested-by: Chris Wilson <a class="moz-txt-link-rfc2396E" href="mailto:chris@chris-wilson.co.uk"><chris@chris-wilson.co.uk></a>
Cc: Chris Wilson <a class="moz-txt-link-rfc2396E" href="mailto:chris@chris-wilson.co.uk"><chris@chris-wilson.co.uk></a>
Cc: John Harrison <a class="moz-txt-link-rfc2396E" href="mailto:John.C.Harrison@Intel.com"><John.C.Harrison@Intel.com></a>
---
scripts/trace.pl | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/scripts/trace.pl b/scripts/trace.pl
index fc1713e4f9a7..41f10749a153 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -1000,6 +1000,42 @@ $first_ts = ts($first_ts);
print <<ENDHTML;
]);
+ function majorAxis(date, scale, step) {
+ var s = date / 1000;
+ var precision;
+
+ if (scale == 'millisecond')
+ precision = 6;
+ else if (scale == 'second')
+ precision = 3;
+ else
+ precision = 0;
+
+ return s.toFixed(precision) + "s";
+ }
+
+ function minorAxis(date, scale, step) {
+ var ms = date;
+ var precision;
+ var unit;
+
+ if (scale == 'millisecond') {
+ ms %= 1000;
+ precision = 0;
+ unit = 'ms';
+ } else if (scale == 'second') {
+ ms /= 1000;
+ precision = 1;
+ unit = 's';
+ } else {
+ ms /= 1000;
+ precision = 0;
+ unit = 's';
+ }
+
+ return ms.toFixed(precision) + unit;
+ }
+
// Configuration for the Timeline
var options = { groupOrder: 'content',
horizontalScroll: true,
@@ -1007,6 +1043,7 @@ print <<ENDHTML;
stackSubgroups: false,
zoomKey: 'ctrlKey',
orientation: 'top',
+ format: { majorLabels: majorAxis, minorLabels: minorAxis },
start: '$first_ts',
end: '$end_ts'};
</pre>
</blockquote>
<br>
I'm still seeing some kind of strange offset. However, it appears to
be browser dependent. If I use Chrome then the offset is +28.8
seconds. With Firefox it is -59958115.2 seconds! On the other hand,
if I try Edge or IE then I don't get a graph at all. I'm wondering
if the issue is with Vis browser compatibility rather than anything
in the trace.pl script. Are you seeing anything at all similar?<br>
<br>
Hmm, if I comment out the 'format:' line and go back to the
unformatted time stamps then IE & Edge still show nothing.
However, Firefox shows dates based on a year of 0097 whereas Chrome
says 1997.<br>
<br>
Either way, I can't spot anything in this patch that could cause a
random offset. So...<br>
<pre wrap="">Reviewed-by: John Harrison <a class="moz-txt-link-rfc2396E" href="mailto:John.C.Harrison@Intel.com"><John.C.Harrison@Intel.com></a>
</pre>
<br>
<br>
</body>
</html>