diff mbox

[i-g-t,03/11] trace.pl: Scale timeline for better precision

Message ID 20180709132004.14468-4-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin July 9, 2018, 1:19 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

vis library has a limited precision compared to our trace data which
prevents zooming into the timeline and seeing the fine detail.

Scale the HTML view by a thousand to work around it.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: John Harrison <John.C.Harrison@Intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
---
 scripts/trace.pl | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Chris Wilson July 9, 2018, 1:26 p.m. UTC | #1
Quoting Tvrtko Ursulin (2018-07-09 14:19:56)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> vis library has a limited precision compared to our trace data which
> prevents zooming into the timeline and seeing the fine detail.
> 
> Scale the HTML view by a thousand to work around it.

Shouldn't there be some clue in the HTML as to the time scale?
Although it's quite easy to tally the numbers against the details to
work it out.
-Chris
Tvrtko Ursulin July 9, 2018, 1:40 p.m. UTC | #2
On 09/07/2018 14:26, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-07-09 14:19:56)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> vis library has a limited precision compared to our trace data which
>> prevents zooming into the timeline and seeing the fine detail.
>>
>> Scale the HTML view by a thousand to work around it.
> 
> Shouldn't there be some clue in the HTML as to the time scale?
> Although it's quite easy to tally the numbers against the details to
> work it out.

One clue is that each box contains it's duration. If that is not enough 
I can look into whether the timeline axis can be custom formatted. It 
would be useful in general to get rid of the annoying date based 
display, but no promises that it is possible.

Regards,

Tvrtko
John Harrison July 11, 2018, 5:52 p.m. UTC | #3
On 7/9/2018 6:19 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> vis library has a limited precision compared to our trace data which
> prevents zooming into the timeline and seeing the fine detail.
>
> Scale the HTML view by a thousand to work around it.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Suggested-by: John Harrison <John.C.Harrison@Intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> ---

Maybe add a comment to the HTML page's description text when scaling is 
enabled to say that the timeline units are not entirely accurate? 
Although, I guess the date was never actually correct in the first 
place! Either way...

Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
diff mbox

Patch

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 1ec8b297d15e..4d3e06434f05 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -40,6 +40,7 @@  my $trace = 0;
 my $avg_delay_stats = 0;
 my $gpu_timeline = 0;
 my $colour_contexts = 0;
+my $no_timeline_scaling = 0;
 
 my @args;
 
@@ -281,6 +282,18 @@  sub arg_colour_contexts
 	return @_;
 }
 
+sub arg_no_timeline_scaling
+{
+	return unless scalar(@_);
+
+	if ($_[0] eq '--no-timeline-scaling') {
+		shift @_;
+		$no_timeline_scaling = 1;
+	}
+
+	return @_;
+}
+
 @args = @ARGV;
 while (@args) {
 	my $left = scalar(@args);
@@ -296,6 +309,7 @@  while (@args) {
 	@args = arg_ignore_ring(@args);
 	@args = arg_skip_box(@args);
 	@args = arg_colour_contexts(@args);
+	@args = arg_no_timeline_scaling(@args);
 
 	last if $left == scalar(@args);
 }
@@ -334,6 +348,8 @@  sub ts
 	my ($us) = @_;
 	my ($d, $h, $m, $s);
 
+	$us *= 1000 unless $no_timeline_scaling;
+
 	$s = int($us / 1000000);
 	$us = $us % 1000000;