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

Tvrtko Ursulin tursulin at ursulin.net
Mon Jul 9 13:19:56 UTC 2018


From: Tvrtko Ursulin <tvrtko.ursulin at 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 at intel.com>
Suggested-by: John Harrison <John.C.Harrison at Intel.com>
Cc: John Harrison <John.C.Harrison at Intel.com>
---
 scripts/trace.pl | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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;
 
-- 
2.17.1



More information about the igt-dev mailing list