All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/9] trace.pl fixes and improvements
@ 2018-07-12 10:59 ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Latest state of patches preceding the virtual engine support.

John Harrison (1):
  trace.pl: Improved key/colours

Tvrtko Ursulin (8):
  trace.pl: Improve time axis labels
  trace.pl: Scale timeline for better precision
  trace.pl: Improve readability of graphical timeline representation
  trace.pl: Improve context colouring for large context id's
  trace.pl: Context save only applies to last request of a bunch
  trace.pl: Fix incomplete request handling
  trace.pl: Basic preemption support
  trace.pl: Fix request split mode

 scripts/media-bench.pl |   2 +-
 scripts/trace.pl       | 541 ++++++++++++++++++++++++++++++++---------
 2 files changed, 425 insertions(+), 118 deletions(-)

-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 0/9] trace.pl fixes and improvements
@ 2018-07-12 10:59 ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Latest state of patches preceding the virtual engine support.

John Harrison (1):
  trace.pl: Improved key/colours

Tvrtko Ursulin (8):
  trace.pl: Improve time axis labels
  trace.pl: Scale timeline for better precision
  trace.pl: Improve readability of graphical timeline representation
  trace.pl: Improve context colouring for large context id's
  trace.pl: Context save only applies to last request of a bunch
  trace.pl: Fix incomplete request handling
  trace.pl: Basic preemption support
  trace.pl: Fix request split mode

 scripts/media-bench.pl |   2 +-
 scripts/trace.pl       | 541 ++++++++++++++++++++++++++++++++---------
 2 files changed, 425 insertions(+), 118 deletions(-)

-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 1/9] trace.pl: Improve time axis labels
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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
relative millisecond offsets on the minor axis.

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index fc1713e4f9a7..89491125490d 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -1000,6 +1000,37 @@ $first_ts = ts($first_ts);
 print <<ENDHTML;
   ]);
 
+  var last_major_ms;
+
+  function majorAxis(date, scale, step) {
+	var s = date / 1000;
+
+	last_major_ms = date;
+
+	if (scale == 'millisecond')
+		return s.toFixed(6) + "s";
+	else if (scale == 'second')
+		return s.toFixed(3) + "s";
+	else
+		return s.toFixed(0) + "s";
+  }
+
+  function minorAxis(date, scale, step) {
+	var ms = date;
+
+	ms -= last_major_ms;
+
+	if (ms < 0)
+		return '';
+
+	if (scale == 'millisecond')
+		return "+" + ms.toFixed(3) + "ms";
+	else if (scale == 'second')
+		return ms.toFixed(3) + "s";
+	else
+		return ms.toFixed(0) + "s";
+  }
+
   // Configuration for the Timeline
   var options = { groupOrder: 'content',
 		  horizontalScroll: true,
@@ -1007,6 +1038,7 @@ print <<ENDHTML;
 		  stackSubgroups: false,
 		  zoomKey: 'ctrlKey',
 		  orientation: 'top',
+		  format: { majorLabels: majorAxis, minorLabels: minorAxis },
 		  start: '$first_ts',
 		  end: '$end_ts'};
 
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 1/9] trace.pl: Improve time axis labels
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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
relative millisecond offsets on the minor axis.

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index fc1713e4f9a7..89491125490d 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -1000,6 +1000,37 @@ $first_ts = ts($first_ts);
 print <<ENDHTML;
   ]);
 
+  var last_major_ms;
+
+  function majorAxis(date, scale, step) {
+	var s = date / 1000;
+
+	last_major_ms = date;
+
+	if (scale == 'millisecond')
+		return s.toFixed(6) + "s";
+	else if (scale == 'second')
+		return s.toFixed(3) + "s";
+	else
+		return s.toFixed(0) + "s";
+  }
+
+  function minorAxis(date, scale, step) {
+	var ms = date;
+
+	ms -= last_major_ms;
+
+	if (ms < 0)
+		return '';
+
+	if (scale == 'millisecond')
+		return "+" + ms.toFixed(3) + "ms";
+	else if (scale == 'second')
+		return ms.toFixed(3) + "s";
+	else
+		return ms.toFixed(0) + "s";
+  }
+
   // Configuration for the Timeline
   var options = { groupOrder: 'content',
 		  horizontalScroll: true,
@@ -1007,6 +1038,7 @@ print <<ENDHTML;
 		  stackSubgroups: false,
 		  zoomKey: 'ctrlKey',
 		  orientation: 'top',
+		  format: { majorLabels: majorAxis, minorLabels: minorAxis },
 		  start: '$first_ts',
 		  end: '$end_ts'};
 
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 2/9] trace.pl: Scale timeline for better precision
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

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.

v2: Rebase for time axis changes.

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>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com> # v1
---
 scripts/trace.pl | 46 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 89491125490d..726c90d44547 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 ($y, $mo, $d, $h, $m, $s);
 
+	$us *= 1000 unless $no_timeline_scaling;
+
 	$s = int($us / 1000000);
 	$us = $us % 1000000;
 
@@ -1001,11 +1017,28 @@ print <<ENDHTML;
   ]);
 
   var last_major_ms;
+ENDHTML
+
+if ($html) {
+	if ($no_timeline_scaling) {
+		say "  timeDiv = 1;";
+	} else {
+		say "  timeDiv = 1000;";
+	}
+}
 
+print <<ENDHTML;
   function majorAxis(date, scale, step) {
-	var s = date / 1000;
+	var s = date / 1000 / timeDiv;
+
+	last_major_ms = date / timeDiv;
 
-	last_major_ms = date;
+	if (timeDiv == 1000) {
+		if (scale == 'second')
+			scale = 'millisecond';
+		else if (scale == 'minute')
+			scale = 'second'
+	}
 
 	if (scale == 'millisecond')
 		return s.toFixed(6) + "s";
@@ -1016,13 +1049,20 @@ print <<ENDHTML;
   }
 
   function minorAxis(date, scale, step) {
-	var ms = date;
+	var ms = date / timeDiv;
 
 	ms -= last_major_ms;
 
 	if (ms < 0)
 		return '';
 
+	if (timeDiv > 1) {
+		if (scale == 'second')
+			scale = 'millisecond';
+		else if (scale == 'minute')
+			scale = 'second';
+	}
+
 	if (scale == 'millisecond')
 		return "+" + ms.toFixed(3) + "ms";
 	else if (scale == 'second')
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 2/9] trace.pl: Scale timeline for better precision
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

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.

v2: Rebase for time axis changes.

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>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com> # v1
---
 scripts/trace.pl | 46 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 89491125490d..726c90d44547 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 ($y, $mo, $d, $h, $m, $s);
 
+	$us *= 1000 unless $no_timeline_scaling;
+
 	$s = int($us / 1000000);
 	$us = $us % 1000000;
 
@@ -1001,11 +1017,28 @@ print <<ENDHTML;
   ]);
 
   var last_major_ms;
+ENDHTML
+
+if ($html) {
+	if ($no_timeline_scaling) {
+		say "  timeDiv = 1;";
+	} else {
+		say "  timeDiv = 1000;";
+	}
+}
 
+print <<ENDHTML;
   function majorAxis(date, scale, step) {
-	var s = date / 1000;
+	var s = date / 1000 / timeDiv;
+
+	last_major_ms = date / timeDiv;
 
-	last_major_ms = date;
+	if (timeDiv == 1000) {
+		if (scale == 'second')
+			scale = 'millisecond';
+		else if (scale == 'minute')
+			scale = 'second'
+	}
 
 	if (scale == 'millisecond')
 		return s.toFixed(6) + "s";
@@ -1016,13 +1049,20 @@ print <<ENDHTML;
   }
 
   function minorAxis(date, scale, step) {
-	var ms = date;
+	var ms = date / timeDiv;
 
 	ms -= last_major_ms;
 
 	if (ms < 0)
 		return '';
 
+	if (timeDiv > 1) {
+		if (scale == 'second')
+			scale = 'millisecond';
+		else if (scale == 'minute')
+			scale = 'second';
+	}
+
 	if (scale == 'millisecond')
 		return "+" + ms.toFixed(3) + "ms";
 	else if (scale == 'second')
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 3/9] trace.pl: Improve readability of graphical timeline representation
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

We add stripes for different stages of request execution so it is easier
to follow one context in the multi-colour mode.

Vertical stripe pattern indicates pipeline "blockages" - requests waiting
for dependencies before they are runnable.

Diagonal stripes indicate runnable requests waiting for GPU time.

Horizontal strips are requests executing on the GPU.

Also use this new multi-coloured mode from media-bench.pl.

v2:
 John Harrison:
 * Mention media-bench.pl in the commit.
 * Fix HTML for single colour mode.

v3:
 * Rebase.
 * Apply stripes to legacy colouring as well.

v4:
 John Harrison:
 * Use per context colours for ctxsave and incomplete boxes.
 * Clearer timeline legend.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
---
 scripts/media-bench.pl |   2 +-
 scripts/trace.pl       | 112 ++++++++++++++++++++++++++++++++---------
 2 files changed, 90 insertions(+), 24 deletions(-)

diff --git a/scripts/media-bench.pl b/scripts/media-bench.pl
index c5628c7f2836..375844d9cdf6 100755
--- a/scripts/media-bench.pl
+++ b/scripts/media-bench.pl
@@ -207,7 +207,7 @@ sub trace_workload
 	show_cmd($cmd);
 	system($cmd);
 
-	$cmd = "perf script | $tracepl --html -x ctxsave -s ";
+	$cmd = "perf script | $tracepl --html -x ctxsave -s -c ";
 	$cmd .= join ' ', map("-i $_", @skip_engine);
 	$cmd .= " > ${file}.html";
 	show_cmd($cmd);
diff --git a/scripts/trace.pl b/scripts/trace.pl
index 726c90d44547..56a4d4fd8bb2 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -737,9 +737,14 @@ foreach my $key (keys %reqwait) {
 say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
-my $queued_colour = $colour_contexts ? 'multi-colour light' : 'blue';
-my $runnable_colour = $colour_contexts ? 'multi-colour dark' : 'grey';
-my $execute_colour = $colour_contexts ? 'multi-colour' : 'pink';
+my $timeline_text = $colour_contexts ?
+		    'Per context coloured shading like:' : 'Box shading like:';
+
+my $queued_style = box_style($min_ctx, 'queue');
+my $ready_style = box_style($min_ctx, 'ready');
+my $execute_style = box_style($min_ctx, 'execute');
+my $ctxsave_style = box_style($min_ctx, 'ctxsave');
+my $incomplete_style = box_style($min_ctx, 'incomplete');
 
 print <<ENDHTML if $html;
 <!DOCTYPE HTML>
@@ -758,9 +763,28 @@ print <<ENDHTML if $html;
 </head>
 <body>
 <p>
-$execute_colour = requests executing on the GPU<br>
-$runnable_colour = runnable requests waiting for a slot on GPU<br>
-$queued_colour = requests waiting on fences and dependencies before they are runnable<br>
+<b>Timeline request view:</b>
+<table>
+<tr><td colspan='4'>$timeline_text</td></tr>
+<tr>
+<td align='center'><div style='$queued_style'>QUEUED</div></td>
+<td align='center'><div style='$ready_style'>READY</div></td>
+<td align='center'><div style='$execute_style'>EXECUTE</div></td>
+<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
+</tr><tr>
+<td></td>
+<td></td>
+<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
+<td></td>
+</tr/></table>
+</p>
+<p>
+<small>
+QUEUED = requests executing on the GPU<br>
+READY = runnable requests waiting for a slot on GPU<br>
+EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
+CTXSAVE = GPU saving the context image<br>
+</small>
 </p>
 <p>
 Boxes are in format 'ctx-id/seqno'.
@@ -880,17 +904,31 @@ sub sortQueue {
 
 sub ctx_colour
 {
-	my ($ctx, $stage) = (@_);
+	my ($ctx, $stage, $lfac) = (@_);
 	my ($s, $l);
 	my $val;
 
 	unless ($colour_contexts) {
 		if ($stage eq 'queue') {
-			return 'lightblue;';
+			$val = 210;
+			$s = 65;
+			$l = 52;
 		} elsif ($stage eq 'ready') {
-			return 'lightgrey;';
+			$val = 0;
+			$s = 0;
+			$l = 47;
 		} elsif ($stage eq 'execute') {
-			return 'pink;';
+			$val = 346;
+			$s = 68;
+			$l = 65;
+		} elsif ($stage eq 'ctxsave') {
+			$val = 26;
+			$s = 90;
+			$l = 52;
+		} elsif ($stage eq 'incomplete') {
+			$val = 0;
+			$s = 85;
+			$l = 50;
 		}
 	} else {
 		if ($stage eq 'queue') {
@@ -902,12 +940,45 @@ sub ctx_colour
 		} elsif ($stage eq 'execute') {
 			$s = 80;
 			$l = 65;
+		} elsif ($stage eq 'ctxsave') {
+			$s = 75;
+			$l = 70;
+		} elsif ($stage eq 'incomplete') {
+			$s = 80;
+			$l = 25;
 		}
+
+		$val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx);
 	}
 
-	$val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx);
+	$l = int($l * $lfac);
 
-	return "hsl($val, $s%, $l%);";
+	return "hsl($val, $s%, $l%)";
+}
+
+sub box_style
+{
+	my ($ctx, $stage) = @_;
+	my $deg;
+
+	if ($stage eq 'queue') {
+		$deg = 90;
+	} elsif ($stage eq 'ready') {
+		$deg = 45;
+	} elsif ($stage eq 'execute') {
+		$deg = 0;
+	} elsif ($stage eq 'ctxsave') {
+		$deg = 105;
+	} elsif ($stage eq 'incomplete') {
+		$deg = 0;
+	}
+
+	return 'color: black; background: repeating-linear-gradient(' .
+		$deg . 'deg, ' .
+		ctx_colour($ctx, $stage, 1.0) . ', ' .
+		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
+		ctx_colour($ctx, $stage, 0.90) . ' 10px, ' .
+		ctx_colour($ctx, $stage, 0.90) . ' 20px);';
 }
 
 my $i = 0;
@@ -925,8 +996,7 @@ foreach my $key (sort sortQueue keys %db) {
 	# submit to execute
 	unless (exists $skip_box{'queue'}) {
 		$skey = 2 * $max_seqno * $ctx + 2 * $seqno;
-		$style = 'color: black; background-color: ' .
-			 ctx_colour($ctx, 'queue');
+		$style = box_style($ctx, 'queue');
 		$content = "$name<br>$db{$key}->{'submit-delay'}us <small>($db{$key}->{'execute-delay'}us)</small>";
 		$startend = 'start: \'' . ts($queue) . '\', end: \'' . ts($submit) . '\'';
 		print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n";
@@ -936,8 +1006,7 @@ foreach my $key (sort sortQueue keys %db) {
 	# execute to start
 	unless (exists $skip_box{'ready'}) {
 		$skey = 2 * $max_seqno * $ctx + 2 * $seqno + 1;
-		$style = 'color: black; background-color: ' .
-			 ctx_colour($ctx, 'ready');
+		$style = box_style($ctx, 'ready');
 		$content = "<small>$name<br>$db{$key}->{'execute-delay'}us</small>";
 		$startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($start) . '\'';
 		print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n";
@@ -947,12 +1016,9 @@ foreach my $key (sort sortQueue keys %db) {
 	# start to user interrupt
 	unless (exists $skip_box{'execute'}) {
 		$skey = -2 * $max_seqno * $ctx - 2 * $seqno - 1;
-		if (exists $db{$key}->{'incomplete'}) {
-			$style = 'color: white; background-color: red;';
-		} else {
-			$style = 'color: black; background-color: ' .
-				  ctx_colour($ctx, 'execute');
-		}
+		$style = box_style($ctx,
+				   exists $db{$key}->{'incomplete'} ?
+				   'incomplete' : 'execute');
 		$content = "$name <small>$db{$key}->{'port'}</small>";
 		$content .= ' <small><i>???</i></small> ' if exists $db{$key}->{'incomplete'};
 		$content .= ' <small><i>++</i></small> ' if exists $db{$key}->{'no-end'};
@@ -966,7 +1032,7 @@ foreach my $key (sort sortQueue keys %db) {
 	# user interrupt to context complete
 	unless (exists $skip_box{'ctxsave'}) {
 		$skey = -2 * $max_seqno * $ctx - 2 * $seqno;
-		$style = 'color: black; background-color: orange;';
+		$style = box_style($ctx, 'ctxsave');
 		my $ctxsave = $db{$key}->{'end'} - $db{$key}->{'notify'};
 		$content = "<small>$name<br>${ctxsave}us</small>";
 		$content .= ' <small><i>???</i></small> ' if exists $db{$key}->{'incomplete'};
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 3/9] trace.pl: Improve readability of graphical timeline representation
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

We add stripes for different stages of request execution so it is easier
to follow one context in the multi-colour mode.

Vertical stripe pattern indicates pipeline "blockages" - requests waiting
for dependencies before they are runnable.

Diagonal stripes indicate runnable requests waiting for GPU time.

Horizontal strips are requests executing on the GPU.

Also use this new multi-coloured mode from media-bench.pl.

v2:
 John Harrison:
 * Mention media-bench.pl in the commit.
 * Fix HTML for single colour mode.

v3:
 * Rebase.
 * Apply stripes to legacy colouring as well.

v4:
 John Harrison:
 * Use per context colours for ctxsave and incomplete boxes.
 * Clearer timeline legend.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
---
 scripts/media-bench.pl |   2 +-
 scripts/trace.pl       | 112 ++++++++++++++++++++++++++++++++---------
 2 files changed, 90 insertions(+), 24 deletions(-)

diff --git a/scripts/media-bench.pl b/scripts/media-bench.pl
index c5628c7f2836..375844d9cdf6 100755
--- a/scripts/media-bench.pl
+++ b/scripts/media-bench.pl
@@ -207,7 +207,7 @@ sub trace_workload
 	show_cmd($cmd);
 	system($cmd);
 
-	$cmd = "perf script | $tracepl --html -x ctxsave -s ";
+	$cmd = "perf script | $tracepl --html -x ctxsave -s -c ";
 	$cmd .= join ' ', map("-i $_", @skip_engine);
 	$cmd .= " > ${file}.html";
 	show_cmd($cmd);
diff --git a/scripts/trace.pl b/scripts/trace.pl
index 726c90d44547..56a4d4fd8bb2 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -737,9 +737,14 @@ foreach my $key (keys %reqwait) {
 say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
-my $queued_colour = $colour_contexts ? 'multi-colour light' : 'blue';
-my $runnable_colour = $colour_contexts ? 'multi-colour dark' : 'grey';
-my $execute_colour = $colour_contexts ? 'multi-colour' : 'pink';
+my $timeline_text = $colour_contexts ?
+		    'Per context coloured shading like:' : 'Box shading like:';
+
+my $queued_style = box_style($min_ctx, 'queue');
+my $ready_style = box_style($min_ctx, 'ready');
+my $execute_style = box_style($min_ctx, 'execute');
+my $ctxsave_style = box_style($min_ctx, 'ctxsave');
+my $incomplete_style = box_style($min_ctx, 'incomplete');
 
 print <<ENDHTML if $html;
 <!DOCTYPE HTML>
@@ -758,9 +763,28 @@ print <<ENDHTML if $html;
 </head>
 <body>
 <p>
-$execute_colour = requests executing on the GPU<br>
-$runnable_colour = runnable requests waiting for a slot on GPU<br>
-$queued_colour = requests waiting on fences and dependencies before they are runnable<br>
+<b>Timeline request view:</b>
+<table>
+<tr><td colspan='4'>$timeline_text</td></tr>
+<tr>
+<td align='center'><div style='$queued_style'>QUEUED</div></td>
+<td align='center'><div style='$ready_style'>READY</div></td>
+<td align='center'><div style='$execute_style'>EXECUTE</div></td>
+<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
+</tr><tr>
+<td></td>
+<td></td>
+<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
+<td></td>
+</tr/></table>
+</p>
+<p>
+<small>
+QUEUED = requests executing on the GPU<br>
+READY = runnable requests waiting for a slot on GPU<br>
+EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
+CTXSAVE = GPU saving the context image<br>
+</small>
 </p>
 <p>
 Boxes are in format 'ctx-id/seqno'.
@@ -880,17 +904,31 @@ sub sortQueue {
 
 sub ctx_colour
 {
-	my ($ctx, $stage) = (@_);
+	my ($ctx, $stage, $lfac) = (@_);
 	my ($s, $l);
 	my $val;
 
 	unless ($colour_contexts) {
 		if ($stage eq 'queue') {
-			return 'lightblue;';
+			$val = 210;
+			$s = 65;
+			$l = 52;
 		} elsif ($stage eq 'ready') {
-			return 'lightgrey;';
+			$val = 0;
+			$s = 0;
+			$l = 47;
 		} elsif ($stage eq 'execute') {
-			return 'pink;';
+			$val = 346;
+			$s = 68;
+			$l = 65;
+		} elsif ($stage eq 'ctxsave') {
+			$val = 26;
+			$s = 90;
+			$l = 52;
+		} elsif ($stage eq 'incomplete') {
+			$val = 0;
+			$s = 85;
+			$l = 50;
 		}
 	} else {
 		if ($stage eq 'queue') {
@@ -902,12 +940,45 @@ sub ctx_colour
 		} elsif ($stage eq 'execute') {
 			$s = 80;
 			$l = 65;
+		} elsif ($stage eq 'ctxsave') {
+			$s = 75;
+			$l = 70;
+		} elsif ($stage eq 'incomplete') {
+			$s = 80;
+			$l = 25;
 		}
+
+		$val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx);
 	}
 
-	$val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx);
+	$l = int($l * $lfac);
 
-	return "hsl($val, $s%, $l%);";
+	return "hsl($val, $s%, $l%)";
+}
+
+sub box_style
+{
+	my ($ctx, $stage) = @_;
+	my $deg;
+
+	if ($stage eq 'queue') {
+		$deg = 90;
+	} elsif ($stage eq 'ready') {
+		$deg = 45;
+	} elsif ($stage eq 'execute') {
+		$deg = 0;
+	} elsif ($stage eq 'ctxsave') {
+		$deg = 105;
+	} elsif ($stage eq 'incomplete') {
+		$deg = 0;
+	}
+
+	return 'color: black; background: repeating-linear-gradient(' .
+		$deg . 'deg, ' .
+		ctx_colour($ctx, $stage, 1.0) . ', ' .
+		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
+		ctx_colour($ctx, $stage, 0.90) . ' 10px, ' .
+		ctx_colour($ctx, $stage, 0.90) . ' 20px);';
 }
 
 my $i = 0;
@@ -925,8 +996,7 @@ foreach my $key (sort sortQueue keys %db) {
 	# submit to execute
 	unless (exists $skip_box{'queue'}) {
 		$skey = 2 * $max_seqno * $ctx + 2 * $seqno;
-		$style = 'color: black; background-color: ' .
-			 ctx_colour($ctx, 'queue');
+		$style = box_style($ctx, 'queue');
 		$content = "$name<br>$db{$key}->{'submit-delay'}us <small>($db{$key}->{'execute-delay'}us)</small>";
 		$startend = 'start: \'' . ts($queue) . '\', end: \'' . ts($submit) . '\'';
 		print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n";
@@ -936,8 +1006,7 @@ foreach my $key (sort sortQueue keys %db) {
 	# execute to start
 	unless (exists $skip_box{'ready'}) {
 		$skey = 2 * $max_seqno * $ctx + 2 * $seqno + 1;
-		$style = 'color: black; background-color: ' .
-			 ctx_colour($ctx, 'ready');
+		$style = box_style($ctx, 'ready');
 		$content = "<small>$name<br>$db{$key}->{'execute-delay'}us</small>";
 		$startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($start) . '\'';
 		print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n";
@@ -947,12 +1016,9 @@ foreach my $key (sort sortQueue keys %db) {
 	# start to user interrupt
 	unless (exists $skip_box{'execute'}) {
 		$skey = -2 * $max_seqno * $ctx - 2 * $seqno - 1;
-		if (exists $db{$key}->{'incomplete'}) {
-			$style = 'color: white; background-color: red;';
-		} else {
-			$style = 'color: black; background-color: ' .
-				  ctx_colour($ctx, 'execute');
-		}
+		$style = box_style($ctx,
+				   exists $db{$key}->{'incomplete'} ?
+				   'incomplete' : 'execute');
 		$content = "$name <small>$db{$key}->{'port'}</small>";
 		$content .= ' <small><i>???</i></small> ' if exists $db{$key}->{'incomplete'};
 		$content .= ' <small><i>++</i></small> ' if exists $db{$key}->{'no-end'};
@@ -966,7 +1032,7 @@ foreach my $key (sort sortQueue keys %db) {
 	# user interrupt to context complete
 	unless (exists $skip_box{'ctxsave'}) {
 		$skey = -2 * $max_seqno * $ctx - 2 * $seqno;
-		$style = 'color: black; background-color: orange;';
+		$style = box_style($ctx, 'ctxsave');
 		my $ctxsave = $db{$key}->{'end'} - $db{$key}->{'notify'};
 		$content = "<small>$name<br>${ctxsave}us</small>";
 		$content .= ' <small><i>???</i></small> ' if exists $db{$key}->{'incomplete'};
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 4/9] trace.pl: Improve context colouring for large context id's
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

John reports that on a long runnning systems the huge disparity between
kernel context and user context id's causes all interesting colours to be
clustered too close together.

Fix this by assigning colours to seen contexts instead of basing purely
on context id's.

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 | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 56a4d4fd8bb2..7cafb3f52ba4 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -336,7 +336,7 @@ sub sanitize_ctx
 {
 	my ($ctx, $ring) = @_;
 
-	if (exists $ctxdb{$ctx}) {
+	if (exists $ctxdb{$ctx} and $ctxdb{$ctx} > 1) {
 		return $ctx . '.' . $ctxdb{$ctx};
 	} else {
 		return $ctx;
@@ -425,6 +425,8 @@ while (<>) {
 			$ctxdb{$orig_ctx}++;
 			$ctx = sanitize_ctx($orig_ctx, $ring);
 			$key = db_key($ring, $ctx, $seqno);
+		} else {
+			$ctxdb{$orig_ctx} = 1;
 		}
 
 		$queue{$key} = $time;
@@ -592,7 +594,7 @@ foreach my $key (@sorted_keys) {
 
 my $last_ts = 0;
 my $first_ts;
-my ($min_ctx, $max_ctx);
+my $min_ctx;
 
 foreach my $key (@sorted_keys) {
 	my $ring = $db{$key}->{'ring'};
@@ -604,8 +606,6 @@ foreach my $key (@sorted_keys) {
 	$last_ts = $end if $end > $last_ts;
 	$min_ctx = $db{$key}->{'ctx'} if not defined $min_ctx or
 					 $db{$key}->{'ctx'} < $min_ctx;
-	$max_ctx = $db{$key}->{'ctx'} if not defined $max_ctx or
-					 $db{$key}->{'ctx'} > $max_ctx;
 
 	$db{$key}->{'context-complete-delay'} = $end - $notify;
 	$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
@@ -740,6 +740,21 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 my $timeline_text = $colour_contexts ?
 		    'Per context coloured shading like:' : 'Box shading like:';
 
+my %ctx_colours;
+
+sub generate_ctx_colours
+{
+	my $num_ctx = keys %ctxdb;
+	my $i = 0;
+
+	foreach my $ctx (sort keys %ctxdb) {
+		$ctx_colours{$ctx} = int(360 / $num_ctx * $i++);
+	}
+}
+
+
+generate_ctx_colours() if $html and $colour_contexts;
+
 my $queued_style = box_style($min_ctx, 'queue');
 my $ready_style = box_style($min_ctx, 'ready');
 my $execute_style = box_style($min_ctx, 'execute');
@@ -948,7 +963,7 @@ sub ctx_colour
 			$l = 25;
 		}
 
-		$val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx);
+		$val = $ctx_colours{$ctx};
 	}
 
 	$l = int($l * $lfac);
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 4/9] trace.pl: Improve context colouring for large context id's
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

John reports that on a long runnning systems the huge disparity between
kernel context and user context id's causes all interesting colours to be
clustered too close together.

Fix this by assigning colours to seen contexts instead of basing purely
on context id's.

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 | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 56a4d4fd8bb2..7cafb3f52ba4 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -336,7 +336,7 @@ sub sanitize_ctx
 {
 	my ($ctx, $ring) = @_;
 
-	if (exists $ctxdb{$ctx}) {
+	if (exists $ctxdb{$ctx} and $ctxdb{$ctx} > 1) {
 		return $ctx . '.' . $ctxdb{$ctx};
 	} else {
 		return $ctx;
@@ -425,6 +425,8 @@ while (<>) {
 			$ctxdb{$orig_ctx}++;
 			$ctx = sanitize_ctx($orig_ctx, $ring);
 			$key = db_key($ring, $ctx, $seqno);
+		} else {
+			$ctxdb{$orig_ctx} = 1;
 		}
 
 		$queue{$key} = $time;
@@ -592,7 +594,7 @@ foreach my $key (@sorted_keys) {
 
 my $last_ts = 0;
 my $first_ts;
-my ($min_ctx, $max_ctx);
+my $min_ctx;
 
 foreach my $key (@sorted_keys) {
 	my $ring = $db{$key}->{'ring'};
@@ -604,8 +606,6 @@ foreach my $key (@sorted_keys) {
 	$last_ts = $end if $end > $last_ts;
 	$min_ctx = $db{$key}->{'ctx'} if not defined $min_ctx or
 					 $db{$key}->{'ctx'} < $min_ctx;
-	$max_ctx = $db{$key}->{'ctx'} if not defined $max_ctx or
-					 $db{$key}->{'ctx'} > $max_ctx;
 
 	$db{$key}->{'context-complete-delay'} = $end - $notify;
 	$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
@@ -740,6 +740,21 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 my $timeline_text = $colour_contexts ?
 		    'Per context coloured shading like:' : 'Box shading like:';
 
+my %ctx_colours;
+
+sub generate_ctx_colours
+{
+	my $num_ctx = keys %ctxdb;
+	my $i = 0;
+
+	foreach my $ctx (sort keys %ctxdb) {
+		$ctx_colours{$ctx} = int(360 / $num_ctx * $i++);
+	}
+}
+
+
+generate_ctx_colours() if $html and $colour_contexts;
+
 my $queued_style = box_style($min_ctx, 'queue');
 my $ready_style = box_style($min_ctx, 'ready');
 my $execute_style = box_style($min_ctx, 'execute');
@@ -948,7 +963,7 @@ sub ctx_colour
 			$l = 25;
 		}
 
-		$val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx);
+		$val = $ctx_colours{$ctx};
 	}
 
 	$l = int($l * $lfac);
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 5/9] trace.pl: Improved key/colours
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: John Harrison <John.C.Harrison@Intel.com>

Improve the timeline legend to show actual context colours.

v2: (Tvrtko Ursulin)
 * Commit msg.
 * Tweak layout for more compactness and more readability.

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 7cafb3f52ba4..bd3039511f5d 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -738,9 +738,35 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
 my $timeline_text = $colour_contexts ?
-		    'Per context coloured shading like:' : 'Box shading like:';
+		    'per context coloured shading like' : 'box shading like';
 
 my %ctx_colours;
+my $ctx_table;
+
+sub generate_ctx_table
+{
+	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
+	my @ctxts;
+
+	if( $colour_contexts ) {
+		@ctxts = sort keys %ctxdb;
+	} else {
+		@ctxts = ($min_ctx);
+	}
+
+	$ctx_table .= '<table>';
+
+	foreach my $ctx (@ctxts) {
+		$ctx_table .= "<tr>\n";
+		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
+		foreach my $state (@states) {
+			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
+		}
+		$ctx_table .= "</tr>\n";
+	}
+
+	$ctx_table .= '</table>';
+}
 
 sub generate_ctx_colours
 {
@@ -754,12 +780,7 @@ sub generate_ctx_colours
 
 
 generate_ctx_colours() if $html and $colour_contexts;
-
-my $queued_style = box_style($min_ctx, 'queue');
-my $ready_style = box_style($min_ctx, 'ready');
-my $execute_style = box_style($min_ctx, 'execute');
-my $ctxsave_style = box_style($min_ctx, 'ctxsave');
-my $incomplete_style = box_style($min_ctx, 'incomplete');
+generate_ctx_table() if $html;
 
 print <<ENDHTML if $html;
 <!DOCTYPE HTML>
@@ -778,35 +799,27 @@ print <<ENDHTML if $html;
 </head>
 <body>
 <p>
-<b>Timeline request view:</b>
+<b>Timeline request view is $timeline_text:</b>
 <table>
-<tr><td colspan='4'>$timeline_text</td></tr>
 <tr>
-<td align='center'><div style='$queued_style'>QUEUED</div></td>
-<td align='center'><div style='$ready_style'>READY</div></td>
-<td align='center'><div style='$execute_style'>EXECUTE</div></td>
-<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
-</tr><tr>
-<td></td>
-<td></td>
-<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
-<td></td>
-</tr/></table>
-</p>
-<p>
-<small>
-QUEUED = requests executing on the GPU<br>
+<td>
+$ctx_table
+</td>
+<td>
+QUEUE = requests executing on the GPU<br>
 READY = runnable requests waiting for a slot on GPU<br>
 EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
 CTXSAVE = GPU saving the context image<br>
-</small>
-</p>
+INCOMPLETE = request of unknown completion time
 <p>
 Boxes are in format 'ctx-id/seqno'.
 </p>
 <p>
 Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
 </p>
+</td>
+</tr>
+</table>
 <p>
 <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
 <br>
@@ -975,20 +988,24 @@ sub box_style
 {
 	my ($ctx, $stage) = @_;
 	my $deg;
+	my $text_col = 'white';
 
 	if ($stage eq 'queue') {
 		$deg = 90;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ready') {
 		$deg = 45;
 	} elsif ($stage eq 'execute') {
 		$deg = 0;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ctxsave') {
 		$deg = 105;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'incomplete') {
 		$deg = 0;
 	}
 
-	return 'color: black; background: repeating-linear-gradient(' .
+	return "color: $text_col; background: repeating-linear-gradient(" .
 		$deg . 'deg, ' .
 		ctx_colour($ctx, $stage, 1.0) . ', ' .
 		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 5/9] trace.pl: Improved key/colours
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: John Harrison <John.C.Harrison@Intel.com>

Improve the timeline legend to show actual context colours.

v2: (Tvrtko Ursulin)
 * Commit msg.
 * Tweak layout for more compactness and more readability.

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 7cafb3f52ba4..bd3039511f5d 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -738,9 +738,35 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
 my $timeline_text = $colour_contexts ?
-		    'Per context coloured shading like:' : 'Box shading like:';
+		    'per context coloured shading like' : 'box shading like';
 
 my %ctx_colours;
+my $ctx_table;
+
+sub generate_ctx_table
+{
+	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
+	my @ctxts;
+
+	if( $colour_contexts ) {
+		@ctxts = sort keys %ctxdb;
+	} else {
+		@ctxts = ($min_ctx);
+	}
+
+	$ctx_table .= '<table>';
+
+	foreach my $ctx (@ctxts) {
+		$ctx_table .= "<tr>\n";
+		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
+		foreach my $state (@states) {
+			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
+		}
+		$ctx_table .= "</tr>\n";
+	}
+
+	$ctx_table .= '</table>';
+}
 
 sub generate_ctx_colours
 {
@@ -754,12 +780,7 @@ sub generate_ctx_colours
 
 
 generate_ctx_colours() if $html and $colour_contexts;
-
-my $queued_style = box_style($min_ctx, 'queue');
-my $ready_style = box_style($min_ctx, 'ready');
-my $execute_style = box_style($min_ctx, 'execute');
-my $ctxsave_style = box_style($min_ctx, 'ctxsave');
-my $incomplete_style = box_style($min_ctx, 'incomplete');
+generate_ctx_table() if $html;
 
 print <<ENDHTML if $html;
 <!DOCTYPE HTML>
@@ -778,35 +799,27 @@ print <<ENDHTML if $html;
 </head>
 <body>
 <p>
-<b>Timeline request view:</b>
+<b>Timeline request view is $timeline_text:</b>
 <table>
-<tr><td colspan='4'>$timeline_text</td></tr>
 <tr>
-<td align='center'><div style='$queued_style'>QUEUED</div></td>
-<td align='center'><div style='$ready_style'>READY</div></td>
-<td align='center'><div style='$execute_style'>EXECUTE</div></td>
-<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
-</tr><tr>
-<td></td>
-<td></td>
-<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
-<td></td>
-</tr/></table>
-</p>
-<p>
-<small>
-QUEUED = requests executing on the GPU<br>
+<td>
+$ctx_table
+</td>
+<td>
+QUEUE = requests executing on the GPU<br>
 READY = runnable requests waiting for a slot on GPU<br>
 EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
 CTXSAVE = GPU saving the context image<br>
-</small>
-</p>
+INCOMPLETE = request of unknown completion time
 <p>
 Boxes are in format 'ctx-id/seqno'.
 </p>
 <p>
 Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
 </p>
+</td>
+</tr>
+</table>
 <p>
 <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
 <br>
@@ -975,20 +988,24 @@ sub box_style
 {
 	my ($ctx, $stage) = @_;
 	my $deg;
+	my $text_col = 'white';
 
 	if ($stage eq 'queue') {
 		$deg = 90;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ready') {
 		$deg = 45;
 	} elsif ($stage eq 'execute') {
 		$deg = 0;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ctxsave') {
 		$deg = 105;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'incomplete') {
 		$deg = 0;
 	}
 
-	return 'color: black; background: repeating-linear-gradient(' .
+	return "color: $text_col; background: repeating-linear-gradient(" .
 		$deg . 'deg, ' .
 		ctx_colour($ctx, $stage, 1.0) . ', ' .
 		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 6/9] trace.pl: Context save only applies to last request of a bunch
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Skip accounting the context save time for anything but the last request of
the coalesced bunch, and also skip drawing those boxes on the timeline.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 scripts/trace.pl | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index bd3039511f5d..9bdafa2d7e99 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -607,7 +607,11 @@ foreach my $key (@sorted_keys) {
 	$min_ctx = $db{$key}->{'ctx'} if not defined $min_ctx or
 					 $db{$key}->{'ctx'} < $min_ctx;
 
-	$db{$key}->{'context-complete-delay'} = $end - $notify;
+	unless (exists $db{$key}->{'no-end'}) {
+		$db{$key}->{'context-complete-delay'} = $end - $notify;
+	} else {
+		$db{$key}->{'context-complete-delay'} = 0;
+	}
 	$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
 	$db{$key}->{'submit-delay'} = $db{$key}->{'submit'} - $db{$key}->{'queue'};
 	$db{$key}->{'duration'} = $notify - $start;
@@ -624,7 +628,7 @@ foreach my $key (@sorted_keys) {
 
 	$submit_avg{$ring} += $db{$key}->{'submit-delay'};
 	$execute_avg{$ring} += $db{$key}->{'execute-delay'};
-	$ctxsave_avg{$ring} += $end - $notify;
+	$ctxsave_avg{$ring} += $db{$key}->{'context-complete-delay'};
 }
 
 foreach my $ring (sort keys %batch_avg) {
@@ -1062,7 +1066,7 @@ foreach my $key (sort sortQueue keys %db) {
 	}
 
 	# user interrupt to context complete
-	unless (exists $skip_box{'ctxsave'}) {
+	unless (exists $skip_box{'ctxsave'} or exists $db{$key}->{'no-end'}) {
 		$skey = -2 * $max_seqno * $ctx - 2 * $seqno;
 		$style = box_style($ctx, 'ctxsave');
 		my $ctxsave = $db{$key}->{'end'} - $db{$key}->{'notify'};
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 6/9] trace.pl: Context save only applies to last request of a bunch
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Skip accounting the context save time for anything but the last request of
the coalesced bunch, and also skip drawing those boxes on the timeline.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 scripts/trace.pl | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index bd3039511f5d..9bdafa2d7e99 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -607,7 +607,11 @@ foreach my $key (@sorted_keys) {
 	$min_ctx = $db{$key}->{'ctx'} if not defined $min_ctx or
 					 $db{$key}->{'ctx'} < $min_ctx;
 
-	$db{$key}->{'context-complete-delay'} = $end - $notify;
+	unless (exists $db{$key}->{'no-end'}) {
+		$db{$key}->{'context-complete-delay'} = $end - $notify;
+	} else {
+		$db{$key}->{'context-complete-delay'} = 0;
+	}
 	$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
 	$db{$key}->{'submit-delay'} = $db{$key}->{'submit'} - $db{$key}->{'queue'};
 	$db{$key}->{'duration'} = $notify - $start;
@@ -624,7 +628,7 @@ foreach my $key (@sorted_keys) {
 
 	$submit_avg{$ring} += $db{$key}->{'submit-delay'};
 	$execute_avg{$ring} += $db{$key}->{'execute-delay'};
-	$ctxsave_avg{$ring} += $end - $notify;
+	$ctxsave_avg{$ring} += $db{$key}->{'context-complete-delay'};
 }
 
 foreach my $ring (sort keys %batch_avg) {
@@ -1062,7 +1066,7 @@ foreach my $key (sort sortQueue keys %db) {
 	}
 
 	# user interrupt to context complete
-	unless (exists $skip_box{'ctxsave'}) {
+	unless (exists $skip_box{'ctxsave'} or exists $db{$key}->{'no-end'}) {
 		$skey = -2 * $max_seqno * $ctx - 2 * $seqno;
 		$style = box_style($ctx, 'ctxsave');
 		my $ctxsave = $db{$key}->{'end'} - $db{$key}->{'notify'};
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 7/9] trace.pl: Fix incomplete request handling
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Incomplete requests (no notify, no context complete) have to be corrected
by looking at the engine timeline, and not the sorted-by-start-time view
as was previously used.

Per-engine timelines are generated on demand and cached for later use.

v2: Find end of current context on the engine timeline instead of just
    using the next request for adjusting the incomplete start time.

v3: Improve scaling with large datasets by only walking each engine
    timeline once and some caching. (John Harrison)

v4:
 * Fix logic fail from v3.
 * Refactor the code a bit to separate the stages better.
 * Do not account batches with unknown duration in avg stats.
 * Handle two user interrupts with the same seqno.
 * Handle user interrupt arriving after request_out.

v5:
 * Update for class:instance.

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 9bdafa2d7e99..33045f3264f2 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -462,16 +462,11 @@ while (<>) {
 		die if exists $db{$key}->{'end'};
 
 		$db{$key}->{'end'} = $time;
-		if (exists $notify{$gkey}) {
-			$db{$key}->{'notify'} = $notify{$gkey};
-		} else {
-			# No notify so far. Maybe it will arrive later which
-			# will be handled in the sanitation loop below.
-			$db{$key}->{'notify'} = $db{$key}->{'end'};
-			$db{$key}->{'no-notify'} = 1;
-		}
+		$db{$key}->{'notify'} = $notify{$gkey} if exists $notify{$gkey};
 	} elsif ($tp_name eq 'i915:intel_engine_notify:') {
-		$notify{global_key($ring, $seqno)} = $time;
+		my $gkey = global_key($ring, $seqno);
+
+		$notify{$gkey} = $time unless exists $notify{$gkey};
 	} elsif ($tp_name eq 'i915:intel_gpu_freq_change:') {
 		push @freqs, [$prev_freq_ts, $time, $prev_freq] if $prev_freq;
 		$prev_freq_ts = $time;
@@ -484,66 +479,116 @@ while (<>) {
 my $max_seqno = 0;
 foreach my $key (keys %db) {
 	my $gkey = global_key($db{$key}->{'ring'}, $db{$key}->{'global'});
-	my $notify = $notify{$gkey};
 
 	die unless exists $db{$key}->{'start'};
 
 	$max_seqno = $db{$key}->{'seqno'} if $db{$key}->{'seqno'} > $max_seqno;
 
-	unless (exists $db{$key}->{'end'}) {
-		# Context complete not received.
-		$db{$key}->{'no-end'} = 1;
+	# Notify arrived after context complete?
+	$db{$key}->{'notify'} = $notify{$gkey} if not exists $db{$key}->{'notify'}
+						  and exists $notify{$gkey};
 
-		if (defined($notify)) {
-			# No context complete due req merging - use notify.
-			$db{$key}->{'notify'} = $notify;
-			$db{$key}->{'end'} = $notify;
-		} else {
-			# No notify and no context complete - give up for now.
-			$db{$key}->{'incomplete'} = 1;
-		}
-	} else {
-		# Notify arrived after context complete.
-		if (exists $db{$key}->{'no-notify'} and defined($notify)) {
-			delete $db{$key}->{'no-notify'};
-			$db{$key}->{'notify'} = $notify;
-		}
+	# No notify but we have end?
+	$db{$key}->{'notify'} = $db{$key}->{'end'} if exists $db{$key}->{'end'} and
+						      not exists $db{$key}->{'notify'};
+
+	# If user interrupt arrived out of order push it back to be no later
+	# than request out.
+	if (exists $db{$key}->{'end'} and exists $db{$key}->{'notify'} and
+	    $db{$key}->{'notify'} > $db{$key}->{'end'}) {
+		$db{$key}->{'notify'} = $db{$key}->{'end'};
 	}
 }
 
-# Fix up incompletes
 my $key_count = scalar(keys %db);
-foreach my $key (keys %db) {
-	next unless exists $db{$key}->{'incomplete'};
 
-	# End the incomplete batch at the time next one starts
-	my $ring = $db{$key}->{'ring'};
-	my $ctx = $db{$key}->{'ctx'};
-	my $seqno = $db{$key}->{'seqno'};
-	my $next_key;
-	my $i = 1;
-	my $end;
-
-	do {
-		$next_key = db_key($ring, $ctx, $seqno + $i);
-		$i++;
-	} until ((exists $db{$next_key} and not exists $db{$next_key}->{'incomplete'})
-		 or $i > $key_count);  # ugly stop hack
+my %engine_timelines;
 
-	if (exists $db{$next_key}) {
-		$end = $db{$next_key}->{'end'};
-	} else {
-		# No info at all, fake it:
-		$end = $db{$key}->{'start'} + 999;
-	}
+sub sortEngine {
+	my $as = $db{$a}->{'global'};
+	my $bs = $db{$b}->{'global'};
+	my $val;
+
+	$val = $as <=> $bs;
 
-	$db{$key}->{'notify'} = $end;
-	$db{$key}->{'end'} = $end;
+	die if $val == 0;
+
+	return $val;
 }
 
-# GPU time accounting
-my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count);
-my (%submit_avg, %execute_avg, %ctxsave_avg);
+sub get_engine_timeline {
+	my ($ring) = @_;
+	my @timeline;
+
+	return $engine_timelines{$ring} if exists $engine_timelines{$ring};
+
+	@timeline = grep { $db{$_}->{'ring'} eq $ring } keys %db;
+	# FIXME seqno restart
+	@timeline = sort sortEngine @timeline;
+
+	$engine_timelines{$ring} = \@timeline;
+
+	return \@timeline;
+}
+
+# Fix up coalesced requests by ending them either when the following same
+# context request with known end ends, or when a different context starts.
+foreach my $gid (sort keys %rings) {
+	my $ring = $ringmap{$rings{$gid}};
+	my $timeline = get_engine_timeline($ring);
+	my $last_complete = -1;
+	my $last_ctx = -1;
+	my $complete;
+
+	foreach my $pos (0..$#{$timeline}) {
+		my $key = @{$timeline}[$pos];
+		my ($ctx, $end);
+
+		next if exists $db{$key}->{'end'};
+
+		$db{$key}->{'no-end'} = 1;
+		$ctx = $db{$key}->{'ctx'};
+
+		if ($pos > $last_complete or $ctx != $last_ctx) {
+			my $next = $pos;
+
+			undef $complete;
+
+			while ($next < $#{$timeline}) {
+				my $next_key = ${$timeline}[++$next];
+				if ($ctx == $db{$next_key}->{'ctx'} and
+				    exists $db{$next_key}->{'end'}) {
+					$last_ctx = $db{$next_key}->{'ctx'};
+					$last_complete = $next;
+					$complete = $next_key;
+					last;
+				}
+			}
+		}
+
+		if (defined $complete) {
+			if ($ctx == $db{$complete}->{'ctx'}) {
+				$end = $db{$complete}->{'end'};
+			} else {
+				$end = $db{$complete}->{'start'};
+			}
+		} else {
+			# No next submission. Use notify if available or give up.
+			if (exists $db{$key}->{'notify'}) {
+				$end = $db{$key}->{'notify'};
+			} else {
+				$end = $db{$key}->{'start'};
+				$db{$key}->{'incomplete'} = 1;
+			}
+		}
+
+		unless (exists $db{$key}->{'notify'}) {
+			$db{$key}->{'notify'} = $end;
+			$db{$key}->{'no-notify'} = 1;
+		}
+		$db{$key}->{'end'} = $end;
+	}
+}
 
 sub sortStart {
 	my $as = $db{$a}->{'start'};
@@ -592,6 +637,10 @@ foreach my $key (@sorted_keys) {
 
 @sorted_keys = sort sortStart keys %db if $re_sort;
 
+# GPU time accounting
+my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count);
+my (%submit_avg, %execute_avg, %ctxsave_avg);
+
 my $last_ts = 0;
 my $first_ts;
 my $min_ctx;
@@ -614,7 +663,11 @@ foreach my $key (@sorted_keys) {
 	}
 	$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
 	$db{$key}->{'submit-delay'} = $db{$key}->{'submit'} - $db{$key}->{'queue'};
-	$db{$key}->{'duration'} = $notify - $start;
+	unless (exists $db{$key}->{'no-notify'}) {
+		$db{$key}->{'duration'} = $notify - $start;
+	} else {
+		$db{$key}->{'duration'} = 0;
+	}
 
 	$running{$ring} += $end - $start if $correct_durations or
 					    not exists $db{$key}->{'no-end'};
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 7/9] trace.pl: Fix incomplete request handling
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Incomplete requests (no notify, no context complete) have to be corrected
by looking at the engine timeline, and not the sorted-by-start-time view
as was previously used.

Per-engine timelines are generated on demand and cached for later use.

v2: Find end of current context on the engine timeline instead of just
    using the next request for adjusting the incomplete start time.

v3: Improve scaling with large datasets by only walking each engine
    timeline once and some caching. (John Harrison)

v4:
 * Fix logic fail from v3.
 * Refactor the code a bit to separate the stages better.
 * Do not account batches with unknown duration in avg stats.
 * Handle two user interrupts with the same seqno.
 * Handle user interrupt arriving after request_out.

v5:
 * Update for class:instance.

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 9bdafa2d7e99..33045f3264f2 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -462,16 +462,11 @@ while (<>) {
 		die if exists $db{$key}->{'end'};
 
 		$db{$key}->{'end'} = $time;
-		if (exists $notify{$gkey}) {
-			$db{$key}->{'notify'} = $notify{$gkey};
-		} else {
-			# No notify so far. Maybe it will arrive later which
-			# will be handled in the sanitation loop below.
-			$db{$key}->{'notify'} = $db{$key}->{'end'};
-			$db{$key}->{'no-notify'} = 1;
-		}
+		$db{$key}->{'notify'} = $notify{$gkey} if exists $notify{$gkey};
 	} elsif ($tp_name eq 'i915:intel_engine_notify:') {
-		$notify{global_key($ring, $seqno)} = $time;
+		my $gkey = global_key($ring, $seqno);
+
+		$notify{$gkey} = $time unless exists $notify{$gkey};
 	} elsif ($tp_name eq 'i915:intel_gpu_freq_change:') {
 		push @freqs, [$prev_freq_ts, $time, $prev_freq] if $prev_freq;
 		$prev_freq_ts = $time;
@@ -484,66 +479,116 @@ while (<>) {
 my $max_seqno = 0;
 foreach my $key (keys %db) {
 	my $gkey = global_key($db{$key}->{'ring'}, $db{$key}->{'global'});
-	my $notify = $notify{$gkey};
 
 	die unless exists $db{$key}->{'start'};
 
 	$max_seqno = $db{$key}->{'seqno'} if $db{$key}->{'seqno'} > $max_seqno;
 
-	unless (exists $db{$key}->{'end'}) {
-		# Context complete not received.
-		$db{$key}->{'no-end'} = 1;
+	# Notify arrived after context complete?
+	$db{$key}->{'notify'} = $notify{$gkey} if not exists $db{$key}->{'notify'}
+						  and exists $notify{$gkey};
 
-		if (defined($notify)) {
-			# No context complete due req merging - use notify.
-			$db{$key}->{'notify'} = $notify;
-			$db{$key}->{'end'} = $notify;
-		} else {
-			# No notify and no context complete - give up for now.
-			$db{$key}->{'incomplete'} = 1;
-		}
-	} else {
-		# Notify arrived after context complete.
-		if (exists $db{$key}->{'no-notify'} and defined($notify)) {
-			delete $db{$key}->{'no-notify'};
-			$db{$key}->{'notify'} = $notify;
-		}
+	# No notify but we have end?
+	$db{$key}->{'notify'} = $db{$key}->{'end'} if exists $db{$key}->{'end'} and
+						      not exists $db{$key}->{'notify'};
+
+	# If user interrupt arrived out of order push it back to be no later
+	# than request out.
+	if (exists $db{$key}->{'end'} and exists $db{$key}->{'notify'} and
+	    $db{$key}->{'notify'} > $db{$key}->{'end'}) {
+		$db{$key}->{'notify'} = $db{$key}->{'end'};
 	}
 }
 
-# Fix up incompletes
 my $key_count = scalar(keys %db);
-foreach my $key (keys %db) {
-	next unless exists $db{$key}->{'incomplete'};
 
-	# End the incomplete batch at the time next one starts
-	my $ring = $db{$key}->{'ring'};
-	my $ctx = $db{$key}->{'ctx'};
-	my $seqno = $db{$key}->{'seqno'};
-	my $next_key;
-	my $i = 1;
-	my $end;
-
-	do {
-		$next_key = db_key($ring, $ctx, $seqno + $i);
-		$i++;
-	} until ((exists $db{$next_key} and not exists $db{$next_key}->{'incomplete'})
-		 or $i > $key_count);  # ugly stop hack
+my %engine_timelines;
 
-	if (exists $db{$next_key}) {
-		$end = $db{$next_key}->{'end'};
-	} else {
-		# No info at all, fake it:
-		$end = $db{$key}->{'start'} + 999;
-	}
+sub sortEngine {
+	my $as = $db{$a}->{'global'};
+	my $bs = $db{$b}->{'global'};
+	my $val;
+
+	$val = $as <=> $bs;
 
-	$db{$key}->{'notify'} = $end;
-	$db{$key}->{'end'} = $end;
+	die if $val == 0;
+
+	return $val;
 }
 
-# GPU time accounting
-my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count);
-my (%submit_avg, %execute_avg, %ctxsave_avg);
+sub get_engine_timeline {
+	my ($ring) = @_;
+	my @timeline;
+
+	return $engine_timelines{$ring} if exists $engine_timelines{$ring};
+
+	@timeline = grep { $db{$_}->{'ring'} eq $ring } keys %db;
+	# FIXME seqno restart
+	@timeline = sort sortEngine @timeline;
+
+	$engine_timelines{$ring} = \@timeline;
+
+	return \@timeline;
+}
+
+# Fix up coalesced requests by ending them either when the following same
+# context request with known end ends, or when a different context starts.
+foreach my $gid (sort keys %rings) {
+	my $ring = $ringmap{$rings{$gid}};
+	my $timeline = get_engine_timeline($ring);
+	my $last_complete = -1;
+	my $last_ctx = -1;
+	my $complete;
+
+	foreach my $pos (0..$#{$timeline}) {
+		my $key = @{$timeline}[$pos];
+		my ($ctx, $end);
+
+		next if exists $db{$key}->{'end'};
+
+		$db{$key}->{'no-end'} = 1;
+		$ctx = $db{$key}->{'ctx'};
+
+		if ($pos > $last_complete or $ctx != $last_ctx) {
+			my $next = $pos;
+
+			undef $complete;
+
+			while ($next < $#{$timeline}) {
+				my $next_key = ${$timeline}[++$next];
+				if ($ctx == $db{$next_key}->{'ctx'} and
+				    exists $db{$next_key}->{'end'}) {
+					$last_ctx = $db{$next_key}->{'ctx'};
+					$last_complete = $next;
+					$complete = $next_key;
+					last;
+				}
+			}
+		}
+
+		if (defined $complete) {
+			if ($ctx == $db{$complete}->{'ctx'}) {
+				$end = $db{$complete}->{'end'};
+			} else {
+				$end = $db{$complete}->{'start'};
+			}
+		} else {
+			# No next submission. Use notify if available or give up.
+			if (exists $db{$key}->{'notify'}) {
+				$end = $db{$key}->{'notify'};
+			} else {
+				$end = $db{$key}->{'start'};
+				$db{$key}->{'incomplete'} = 1;
+			}
+		}
+
+		unless (exists $db{$key}->{'notify'}) {
+			$db{$key}->{'notify'} = $end;
+			$db{$key}->{'no-notify'} = 1;
+		}
+		$db{$key}->{'end'} = $end;
+	}
+}
 
 sub sortStart {
 	my $as = $db{$a}->{'start'};
@@ -592,6 +637,10 @@ foreach my $key (@sorted_keys) {
 
 @sorted_keys = sort sortStart keys %db if $re_sort;
 
+# GPU time accounting
+my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count);
+my (%submit_avg, %execute_avg, %ctxsave_avg);
+
 my $last_ts = 0;
 my $first_ts;
 my $min_ctx;
@@ -614,7 +663,11 @@ foreach my $key (@sorted_keys) {
 	}
 	$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
 	$db{$key}->{'submit-delay'} = $db{$key}->{'submit'} - $db{$key}->{'queue'};
-	$db{$key}->{'duration'} = $notify - $start;
+	unless (exists $db{$key}->{'no-notify'}) {
+		$db{$key}->{'duration'} = $notify - $start;
+	} else {
+		$db{$key}->{'duration'} = 0;
+	}
 
 	$running{$ring} += $end - $start if $correct_durations or
 					    not exists $db{$key}->{'no-end'};
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 8/9] trace.pl: Basic preemption support
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Just forget about earlier request_in events.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 scripts/trace.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 33045f3264f2..43c68001d768 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -438,7 +438,9 @@ while (<>) {
 	} elsif ($tp_name eq 'i915:i915_request_in:') {
 		my %req;
 
-		die if exists $db{$key};
+		# preemption
+		delete $db{$key} if exists $db{$key};
+
 		die unless exists $queue{$key};
 		die unless exists $submit{$key};
 
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 8/9] trace.pl: Basic preemption support
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Just forget about earlier request_in events.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 scripts/trace.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 33045f3264f2..43c68001d768 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -438,7 +438,9 @@ while (<>) {
 	} elsif ($tp_name eq 'i915:i915_request_in:') {
 		my %req;
 
-		die if exists $db{$key};
+		# preemption
+		delete $db{$key} if exists $db{$key};
+
 		die unless exists $queue{$key};
 		die unless exists $submit{$key};
 
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t 9/9] trace.pl: Fix request split mode
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Request split mode had several bugs, both in the original version and also
after the recent refactorings.

One big one was that it wasn't considering different submit ports as a
reason to split execution, and also that it was too time based instead of
looking at relevant timelines.

In this refactoring we address the former by using the engine timelines
introduced in the previous patch. Secondary port submissions are moved
to follow the preceding submission as a first step in the correction
process.

In the second step, we add context timelines and use then in a similar
fashion to separate start and end time of coalesced requests. For each
coalesced request we know its boundaries by looking at the engine
timeline (via global seqnos), and we know the previous request it should
only start after, by looking at the context timeline.

v2:
 * Remove some dead code.
 * Fix !port0 shifting logic.

v3:
 * Refactor for less list walking as with incomplete handling.

v4:
 * Database of context timelines should not contain duplicates!
   (Converted from array into a hash.)

v5:
 * Avoid over-accounting runnable time for a coalesced group by recording
   the time first request entered the GPU and ending the execute delay at
   that point for the whole group.

v6:
 * Update for engine class:instance.

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 43c68001d768..ef5a04b2a11a 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -27,7 +27,7 @@ use warnings;
 use 5.010;
 
 my $gid = 0;
-my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait);
+my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait, %ctxtimelines);
 my @freqs;
 
 my $max_items = 3000;
@@ -448,6 +448,7 @@ while (<>) {
 		$req{'ring'} = $ring;
 		$req{'seqno'} = $seqno;
 		$req{'ctx'} = $ctx;
+		$ctxtimelines{$ctx . '/' . $ring} = 1;
 		$req{'name'} = $ctx . '/' . $seqno;
 		$req{'global'} = $tp{'global'};
 		$req{'port'} = $tp{'port'};
@@ -603,41 +604,113 @@ sub sortStart {
 	return $val;
 }
 
-my @sorted_keys = sort sortStart keys %db;
-my $re_sort = 0;
+my $re_sort = 1;
+my @sorted_keys;
 
-die "Database changed size?!" unless scalar(@sorted_keys) == $key_count;
+sub maybe_sort_keys
+{
+	if ($re_sort) {
+		@sorted_keys = sort sortStart keys %db;
+		$re_sort = 0;
+		die "Database changed size?!" unless scalar(@sorted_keys) ==
+						     $key_count;
+	}
+}
 
-foreach my $key (@sorted_keys) {
-	my $ring = $db{$key}->{'ring'};
-	my $end = $db{$key}->{'end'};
+maybe_sort_keys();
+
+my %ctx_timelines;
+
+sub sortContext {
+	my $as = $db{$a}->{'seqno'};
+	my $bs = $db{$b}->{'seqno'};
+	my $val;
+
+	$val = $as <=> $bs;
+
+	die if $val == 0;
+
+	return $val;
+}
+
+sub get_ctx_timeline {
+	my ($ctx, $ring, $key) = @_;
+	my @timeline;
+
+	return $ctx_timelines{$key} if exists $ctx_timelines{$key};
+
+	@timeline = grep { $db{$_}->{'ring'} eq $ring and
+			   $db{$_}->{'ctx'} == $ctx } @sorted_keys;
+	# FIXME seqno restart
+	@timeline = sort sortContext @timeline;
+
+	$ctx_timelines{$key} = \@timeline;
+
+	return \@timeline;
+}
+
+# Split out merged batches if requested.
+if ($correct_durations) {
+	# Shift !port0 requests start time to after the previous context on the
+	# same timeline has finished.
+	foreach my $gid (sort keys %rings) {
+		my $ring = $ringmap{$rings{$gid}};
+		my $timeline = get_engine_timeline($ring);
+		my $complete;
+
+		foreach my $pos (0..$#{$timeline}) {
+			my $key = @{$timeline}[$pos];
+			my $prev = $complete;
+			my $pkey;
+
+			$complete = $key unless exists $db{$key}->{'no-end'};
+			$pkey = $complete;
+
+			next if $db{$key}->{'port'} == 0;
+
+			$pkey = $prev if $complete eq $key;
+
+			die unless defined $pkey;
+
+			$db{$key}->{'start'} = $db{$pkey}->{'end'};
+			$db{$key}->{'start'} = $db{$pkey}->{'notify'} if $db{$key}->{'start'} > $db{$key}->{'end'};
+
+			die if $db{$key}->{'start'} > $db{$key}->{'end'};
 
-	# correct duration of merged batches
-	if ($correct_durations and exists $db{$key}->{'no-end'}) {
-		my $ctx = $db{$key}->{'ctx'};
-		my $seqno = $db{$key}->{'seqno'};
-		my $start = $db{$key}->{'start'};
-		my $next_key;
-		my $i = 1;
-
-		do {
-			$next_key = db_key($ring, $ctx, $seqno + $i);
-			$i++;
-		} until (exists $db{$next_key} or $i > $key_count);  # ugly stop hack
-
-		# 20us tolerance
-		if (exists $db{$next_key} and $db{$next_key}->{'start'} < $start + 20) {
-			my $notify = $db{$key}->{'notify'};
 			$re_sort = 1;
-			$db{$next_key}->{'start'} = $notify;
-			$db{$next_key}->{'start'} = $db{$next_key}->{'end'} if $db{$next_key}->{'start'} > $db{$next_key}->{'end'};
-			die if $db{$next_key}->{'start'} > $db{$next_key}->{'end'};
 		}
-		die if $start > $end;
+	}
+
+	maybe_sort_keys();
+
+	# Batch with no-end (no request_out) means it was submitted as part of
+	# coalesced context. This means it's start time should be set to the end
+	# time of a following request on this context timeline.
+	foreach my $tkey (sort keys %ctxtimelines) {
+		my ($ctx, $ring) = split '/', $tkey;
+		my $timeline = get_ctx_timeline($ctx, $ring, $tkey);
+		my $last_complete = -1;
+		my $complete;
+
+		foreach my $pos (0..$#{$timeline}) {
+			my $key = @{$timeline}[$pos];
+			my $next_key;
+
+			next unless exists $db{$key}->{'no-end'};
+			last if $pos == $#{$timeline};
+
+			# Shift following request to start after the current one
+			$next_key = ${$timeline}[$pos + 1];
+			if (exists $db{$key}->{'notify'}) {
+				$db{$next_key}->{'engine-start'} = $db{$next_key}->{'start'};
+				$db{$next_key}->{'start'} = $db{$key}->{'notify'};
+				$re_sort = 1;
+			}
+		}
 	}
 }
 
-@sorted_keys = sort sortStart keys %db if $re_sort;
+maybe_sort_keys();
 
 # GPU time accounting
 my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count);
@@ -651,6 +724,7 @@ foreach my $key (@sorted_keys) {
 	my $ring = $db{$key}->{'ring'};
 	my $end = $db{$key}->{'end'};
 	my $start = $db{$key}->{'start'};
+	my $engine_start = $db{$key}->{'engine_start'};
 	my $notify = $db{$key}->{'notify'};
 
 	$first_ts = $db{$key}->{'queue'} if not defined $first_ts or $db{$key}->{'queue'} < $first_ts;
@@ -663,7 +737,9 @@ foreach my $key (@sorted_keys) {
 	} else {
 		$db{$key}->{'context-complete-delay'} = 0;
 	}
-	$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
+
+	$engine_start = $db{$key}->{'start'} unless defined $engine_start;
+	$db{$key}->{'execute-delay'} = $engine_start - $db{$key}->{'submit'};
 	$db{$key}->{'submit-delay'} = $db{$key}->{'submit'} - $db{$key}->{'queue'};
 	unless (exists $db{$key}->{'no-notify'}) {
 		$db{$key}->{'duration'} = $notify - $start;
@@ -1076,6 +1152,7 @@ my $i = 0;
 foreach my $key (sort sortQueue keys %db) {
 	my ($name, $ctx, $seqno) = ($db{$key}->{'name'}, $db{$key}->{'ctx'}, $db{$key}->{'seqno'});
 	my ($queue, $start, $notify, $end) = ($db{$key}->{'queue'}, $db{$key}->{'start'}, $db{$key}->{'notify'}, $db{$key}->{'end'});
+	my $engine_start = $db{$key}->{'engine-start'};
 	my $submit = $queue + $db{$key}->{'submit-delay'};
 	my ($content, $style);
 	my $group = $engine_start_id + $rings{$db{$key}->{'ring'}};
@@ -1095,11 +1172,12 @@ foreach my $key (sort sortQueue keys %db) {
 	}
 
 	# execute to start
+	$engine_start = $db{$key}->{'start'} unless defined $engine_start;
 	unless (exists $skip_box{'ready'}) {
 		$skey = 2 * $max_seqno * $ctx + 2 * $seqno + 1;
 		$style = box_style($ctx, 'ready');
 		$content = "<small>$name<br>$db{$key}->{'execute-delay'}us</small>";
-		$startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($start) . '\'';
+		$startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($engine_start) . '\'';
 		print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n";
 		$i++;
 	}
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t 9/9] trace.pl: Fix request split mode
@ 2018-07-12 10:59   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 10:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Request split mode had several bugs, both in the original version and also
after the recent refactorings.

One big one was that it wasn't considering different submit ports as a
reason to split execution, and also that it was too time based instead of
looking at relevant timelines.

In this refactoring we address the former by using the engine timelines
introduced in the previous patch. Secondary port submissions are moved
to follow the preceding submission as a first step in the correction
process.

In the second step, we add context timelines and use then in a similar
fashion to separate start and end time of coalesced requests. For each
coalesced request we know its boundaries by looking at the engine
timeline (via global seqnos), and we know the previous request it should
only start after, by looking at the context timeline.

v2:
 * Remove some dead code.
 * Fix !port0 shifting logic.

v3:
 * Refactor for less list walking as with incomplete handling.

v4:
 * Database of context timelines should not contain duplicates!
   (Converted from array into a hash.)

v5:
 * Avoid over-accounting runnable time for a coalesced group by recording
   the time first request entered the GPU and ending the execute delay at
   that point for the whole group.

v6:
 * Update for engine class:instance.

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 43c68001d768..ef5a04b2a11a 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -27,7 +27,7 @@ use warnings;
 use 5.010;
 
 my $gid = 0;
-my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait);
+my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait, %ctxtimelines);
 my @freqs;
 
 my $max_items = 3000;
@@ -448,6 +448,7 @@ while (<>) {
 		$req{'ring'} = $ring;
 		$req{'seqno'} = $seqno;
 		$req{'ctx'} = $ctx;
+		$ctxtimelines{$ctx . '/' . $ring} = 1;
 		$req{'name'} = $ctx . '/' . $seqno;
 		$req{'global'} = $tp{'global'};
 		$req{'port'} = $tp{'port'};
@@ -603,41 +604,113 @@ sub sortStart {
 	return $val;
 }
 
-my @sorted_keys = sort sortStart keys %db;
-my $re_sort = 0;
+my $re_sort = 1;
+my @sorted_keys;
 
-die "Database changed size?!" unless scalar(@sorted_keys) == $key_count;
+sub maybe_sort_keys
+{
+	if ($re_sort) {
+		@sorted_keys = sort sortStart keys %db;
+		$re_sort = 0;
+		die "Database changed size?!" unless scalar(@sorted_keys) ==
+						     $key_count;
+	}
+}
 
-foreach my $key (@sorted_keys) {
-	my $ring = $db{$key}->{'ring'};
-	my $end = $db{$key}->{'end'};
+maybe_sort_keys();
+
+my %ctx_timelines;
+
+sub sortContext {
+	my $as = $db{$a}->{'seqno'};
+	my $bs = $db{$b}->{'seqno'};
+	my $val;
+
+	$val = $as <=> $bs;
+
+	die if $val == 0;
+
+	return $val;
+}
+
+sub get_ctx_timeline {
+	my ($ctx, $ring, $key) = @_;
+	my @timeline;
+
+	return $ctx_timelines{$key} if exists $ctx_timelines{$key};
+
+	@timeline = grep { $db{$_}->{'ring'} eq $ring and
+			   $db{$_}->{'ctx'} == $ctx } @sorted_keys;
+	# FIXME seqno restart
+	@timeline = sort sortContext @timeline;
+
+	$ctx_timelines{$key} = \@timeline;
+
+	return \@timeline;
+}
+
+# Split out merged batches if requested.
+if ($correct_durations) {
+	# Shift !port0 requests start time to after the previous context on the
+	# same timeline has finished.
+	foreach my $gid (sort keys %rings) {
+		my $ring = $ringmap{$rings{$gid}};
+		my $timeline = get_engine_timeline($ring);
+		my $complete;
+
+		foreach my $pos (0..$#{$timeline}) {
+			my $key = @{$timeline}[$pos];
+			my $prev = $complete;
+			my $pkey;
+
+			$complete = $key unless exists $db{$key}->{'no-end'};
+			$pkey = $complete;
+
+			next if $db{$key}->{'port'} == 0;
+
+			$pkey = $prev if $complete eq $key;
+
+			die unless defined $pkey;
+
+			$db{$key}->{'start'} = $db{$pkey}->{'end'};
+			$db{$key}->{'start'} = $db{$pkey}->{'notify'} if $db{$key}->{'start'} > $db{$key}->{'end'};
+
+			die if $db{$key}->{'start'} > $db{$key}->{'end'};
 
-	# correct duration of merged batches
-	if ($correct_durations and exists $db{$key}->{'no-end'}) {
-		my $ctx = $db{$key}->{'ctx'};
-		my $seqno = $db{$key}->{'seqno'};
-		my $start = $db{$key}->{'start'};
-		my $next_key;
-		my $i = 1;
-
-		do {
-			$next_key = db_key($ring, $ctx, $seqno + $i);
-			$i++;
-		} until (exists $db{$next_key} or $i > $key_count);  # ugly stop hack
-
-		# 20us tolerance
-		if (exists $db{$next_key} and $db{$next_key}->{'start'} < $start + 20) {
-			my $notify = $db{$key}->{'notify'};
 			$re_sort = 1;
-			$db{$next_key}->{'start'} = $notify;
-			$db{$next_key}->{'start'} = $db{$next_key}->{'end'} if $db{$next_key}->{'start'} > $db{$next_key}->{'end'};
-			die if $db{$next_key}->{'start'} > $db{$next_key}->{'end'};
 		}
-		die if $start > $end;
+	}
+
+	maybe_sort_keys();
+
+	# Batch with no-end (no request_out) means it was submitted as part of
+	# coalesced context. This means it's start time should be set to the end
+	# time of a following request on this context timeline.
+	foreach my $tkey (sort keys %ctxtimelines) {
+		my ($ctx, $ring) = split '/', $tkey;
+		my $timeline = get_ctx_timeline($ctx, $ring, $tkey);
+		my $last_complete = -1;
+		my $complete;
+
+		foreach my $pos (0..$#{$timeline}) {
+			my $key = @{$timeline}[$pos];
+			my $next_key;
+
+			next unless exists $db{$key}->{'no-end'};
+			last if $pos == $#{$timeline};
+
+			# Shift following request to start after the current one
+			$next_key = ${$timeline}[$pos + 1];
+			if (exists $db{$key}->{'notify'}) {
+				$db{$next_key}->{'engine-start'} = $db{$next_key}->{'start'};
+				$db{$next_key}->{'start'} = $db{$key}->{'notify'};
+				$re_sort = 1;
+			}
+		}
 	}
 }
 
-@sorted_keys = sort sortStart keys %db if $re_sort;
+maybe_sort_keys();
 
 # GPU time accounting
 my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count);
@@ -651,6 +724,7 @@ foreach my $key (@sorted_keys) {
 	my $ring = $db{$key}->{'ring'};
 	my $end = $db{$key}->{'end'};
 	my $start = $db{$key}->{'start'};
+	my $engine_start = $db{$key}->{'engine_start'};
 	my $notify = $db{$key}->{'notify'};
 
 	$first_ts = $db{$key}->{'queue'} if not defined $first_ts or $db{$key}->{'queue'} < $first_ts;
@@ -663,7 +737,9 @@ foreach my $key (@sorted_keys) {
 	} else {
 		$db{$key}->{'context-complete-delay'} = 0;
 	}
-	$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
+
+	$engine_start = $db{$key}->{'start'} unless defined $engine_start;
+	$db{$key}->{'execute-delay'} = $engine_start - $db{$key}->{'submit'};
 	$db{$key}->{'submit-delay'} = $db{$key}->{'submit'} - $db{$key}->{'queue'};
 	unless (exists $db{$key}->{'no-notify'}) {
 		$db{$key}->{'duration'} = $notify - $start;
@@ -1076,6 +1152,7 @@ my $i = 0;
 foreach my $key (sort sortQueue keys %db) {
 	my ($name, $ctx, $seqno) = ($db{$key}->{'name'}, $db{$key}->{'ctx'}, $db{$key}->{'seqno'});
 	my ($queue, $start, $notify, $end) = ($db{$key}->{'queue'}, $db{$key}->{'start'}, $db{$key}->{'notify'}, $db{$key}->{'end'});
+	my $engine_start = $db{$key}->{'engine-start'};
 	my $submit = $queue + $db{$key}->{'submit-delay'};
 	my ($content, $style);
 	my $group = $engine_start_id + $rings{$db{$key}->{'ring'}};
@@ -1095,11 +1172,12 @@ foreach my $key (sort sortQueue keys %db) {
 	}
 
 	# execute to start
+	$engine_start = $db{$key}->{'start'} unless defined $engine_start;
 	unless (exists $skip_box{'ready'}) {
 		$skey = 2 * $max_seqno * $ctx + 2 * $seqno + 1;
 		$style = box_style($ctx, 'ready');
 		$content = "<small>$name<br>$db{$key}->{'execute-delay'}us</small>";
-		$startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($start) . '\'';
+		$startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($engine_start) . '\'';
 		print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n";
 		$i++;
 	}
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 5/9] trace.pl: Improved key/colours
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 11:03     ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 11:03 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


On 12/07/2018 11:59, Tvrtko Ursulin wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
> 
> Improve the timeline legend to show actual context colours.
> 
> v2: (Tvrtko Ursulin)
>   * Commit msg.
>   * Tweak layout for more compactness and more readability.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

I've picked up this patch of yours and made some tweaks. Hopefully you 
will find them agreeable, even if as a compromise to what we consider 
more readable. :)

But more importantly please add your s-o-b for it.

R-b we can both add if happy.

Regards,

Tvrtko

> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   scripts/trace.pl | 69 ++++++++++++++++++++++++++++++------------------
>   1 file changed, 43 insertions(+), 26 deletions(-)
> 
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 7cafb3f52ba4..bd3039511f5d 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -738,9 +738,35 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
>   	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
>   
>   my $timeline_text = $colour_contexts ?
> -		    'Per context coloured shading like:' : 'Box shading like:';
> +		    'per context coloured shading like' : 'box shading like';
>   
>   my %ctx_colours;
> +my $ctx_table;
> +
> +sub generate_ctx_table
> +{
> +	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
> +	my @ctxts;
> +
> +	if( $colour_contexts ) {
> +		@ctxts = sort keys %ctxdb;
> +	} else {
> +		@ctxts = ($min_ctx);
> +	}
> +
> +	$ctx_table .= '<table>';
> +
> +	foreach my $ctx (@ctxts) {
> +		$ctx_table .= "<tr>\n";
> +		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
> +		foreach my $state (@states) {
> +			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
> +		}
> +		$ctx_table .= "</tr>\n";
> +	}
> +
> +	$ctx_table .= '</table>';
> +}
>   
>   sub generate_ctx_colours
>   {
> @@ -754,12 +780,7 @@ sub generate_ctx_colours
>   
>   
>   generate_ctx_colours() if $html and $colour_contexts;
> -
> -my $queued_style = box_style($min_ctx, 'queue');
> -my $ready_style = box_style($min_ctx, 'ready');
> -my $execute_style = box_style($min_ctx, 'execute');
> -my $ctxsave_style = box_style($min_ctx, 'ctxsave');
> -my $incomplete_style = box_style($min_ctx, 'incomplete');
> +generate_ctx_table() if $html;
>   
>   print <<ENDHTML if $html;
>   <!DOCTYPE HTML>
> @@ -778,35 +799,27 @@ print <<ENDHTML if $html;
>   </head>
>   <body>
>   <p>
> -<b>Timeline request view:</b>
> +<b>Timeline request view is $timeline_text:</b>
>   <table>
> -<tr><td colspan='4'>$timeline_text</td></tr>
>   <tr>
> -<td align='center'><div style='$queued_style'>QUEUED</div></td>
> -<td align='center'><div style='$ready_style'>READY</div></td>
> -<td align='center'><div style='$execute_style'>EXECUTE</div></td>
> -<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
> -</tr><tr>
> -<td></td>
> -<td></td>
> -<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
> -<td></td>
> -</tr/></table>
> -</p>
> -<p>
> -<small>
> -QUEUED = requests executing on the GPU<br>
> +<td>
> +$ctx_table
> +</td>
> +<td>
> +QUEUE = requests executing on the GPU<br>
>   READY = runnable requests waiting for a slot on GPU<br>
>   EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
>   CTXSAVE = GPU saving the context image<br>
> -</small>
> -</p>
> +INCOMPLETE = request of unknown completion time
>   <p>
>   Boxes are in format 'ctx-id/seqno'.
>   </p>
>   <p>
>   Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
>   </p>
> +</td>
> +</tr>
> +</table>
>   <p>
>   <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
>   <br>
> @@ -975,20 +988,24 @@ sub box_style
>   {
>   	my ($ctx, $stage) = @_;
>   	my $deg;
> +	my $text_col = 'white';
>   
>   	if ($stage eq 'queue') {
>   		$deg = 90;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ready') {
>   		$deg = 45;
>   	} elsif ($stage eq 'execute') {
>   		$deg = 0;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ctxsave') {
>   		$deg = 105;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'incomplete') {
>   		$deg = 0;
>   	}
>   
> -	return 'color: black; background: repeating-linear-gradient(' .
> +	return "color: $text_col; background: repeating-linear-gradient(" .
>   		$deg . 'deg, ' .
>   		ctx_colour($ctx, $stage, 1.0) . ', ' .
>   		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 5/9] trace.pl: Improved key/colours
@ 2018-07-12 11:03     ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 11:03 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin


On 12/07/2018 11:59, Tvrtko Ursulin wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
> 
> Improve the timeline legend to show actual context colours.
> 
> v2: (Tvrtko Ursulin)
>   * Commit msg.
>   * Tweak layout for more compactness and more readability.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

I've picked up this patch of yours and made some tweaks. Hopefully you 
will find them agreeable, even if as a compromise to what we consider 
more readable. :)

But more importantly please add your s-o-b for it.

R-b we can both add if happy.

Regards,

Tvrtko

> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   scripts/trace.pl | 69 ++++++++++++++++++++++++++++++------------------
>   1 file changed, 43 insertions(+), 26 deletions(-)
> 
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 7cafb3f52ba4..bd3039511f5d 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -738,9 +738,35 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
>   	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
>   
>   my $timeline_text = $colour_contexts ?
> -		    'Per context coloured shading like:' : 'Box shading like:';
> +		    'per context coloured shading like' : 'box shading like';
>   
>   my %ctx_colours;
> +my $ctx_table;
> +
> +sub generate_ctx_table
> +{
> +	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
> +	my @ctxts;
> +
> +	if( $colour_contexts ) {
> +		@ctxts = sort keys %ctxdb;
> +	} else {
> +		@ctxts = ($min_ctx);
> +	}
> +
> +	$ctx_table .= '<table>';
> +
> +	foreach my $ctx (@ctxts) {
> +		$ctx_table .= "<tr>\n";
> +		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
> +		foreach my $state (@states) {
> +			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
> +		}
> +		$ctx_table .= "</tr>\n";
> +	}
> +
> +	$ctx_table .= '</table>';
> +}
>   
>   sub generate_ctx_colours
>   {
> @@ -754,12 +780,7 @@ sub generate_ctx_colours
>   
>   
>   generate_ctx_colours() if $html and $colour_contexts;
> -
> -my $queued_style = box_style($min_ctx, 'queue');
> -my $ready_style = box_style($min_ctx, 'ready');
> -my $execute_style = box_style($min_ctx, 'execute');
> -my $ctxsave_style = box_style($min_ctx, 'ctxsave');
> -my $incomplete_style = box_style($min_ctx, 'incomplete');
> +generate_ctx_table() if $html;
>   
>   print <<ENDHTML if $html;
>   <!DOCTYPE HTML>
> @@ -778,35 +799,27 @@ print <<ENDHTML if $html;
>   </head>
>   <body>
>   <p>
> -<b>Timeline request view:</b>
> +<b>Timeline request view is $timeline_text:</b>
>   <table>
> -<tr><td colspan='4'>$timeline_text</td></tr>
>   <tr>
> -<td align='center'><div style='$queued_style'>QUEUED</div></td>
> -<td align='center'><div style='$ready_style'>READY</div></td>
> -<td align='center'><div style='$execute_style'>EXECUTE</div></td>
> -<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
> -</tr><tr>
> -<td></td>
> -<td></td>
> -<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
> -<td></td>
> -</tr/></table>
> -</p>
> -<p>
> -<small>
> -QUEUED = requests executing on the GPU<br>
> +<td>
> +$ctx_table
> +</td>
> +<td>
> +QUEUE = requests executing on the GPU<br>
>   READY = runnable requests waiting for a slot on GPU<br>
>   EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
>   CTXSAVE = GPU saving the context image<br>
> -</small>
> -</p>
> +INCOMPLETE = request of unknown completion time
>   <p>
>   Boxes are in format 'ctx-id/seqno'.
>   </p>
>   <p>
>   Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
>   </p>
> +</td>
> +</tr>
> +</table>
>   <p>
>   <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
>   <br>
> @@ -975,20 +988,24 @@ sub box_style
>   {
>   	my ($ctx, $stage) = @_;
>   	my $deg;
> +	my $text_col = 'white';
>   
>   	if ($stage eq 'queue') {
>   		$deg = 90;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ready') {
>   		$deg = 45;
>   	} elsif ($stage eq 'execute') {
>   		$deg = 0;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ctxsave') {
>   		$deg = 105;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'incomplete') {
>   		$deg = 0;
>   	}
>   
> -	return 'color: black; background: repeating-linear-gradient(' .
> +	return "color: $text_col; background: repeating-linear-gradient(" .
>   		$deg . 'deg, ' .
>   		ctx_colour($ctx, $stage, 1.0) . ', ' .
>   		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/9] trace.pl: Improve time axis labels
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-12 12:42     ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 12:42 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


On 12/07/2018 11:59, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> 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
> relative millisecond offsets on the minor axis.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> ---
>   scripts/trace.pl | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
> 
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index fc1713e4f9a7..89491125490d 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -1000,6 +1000,37 @@ $first_ts = ts($first_ts);
>   print <<ENDHTML;
>     ]);
>   
> +  var last_major_ms;
> +
> +  function majorAxis(date, scale, step) {
> +	var s = date / 1000;
> +
> +	last_major_ms = date;
> +
> +	if (scale == 'millisecond')
> +		return s.toFixed(6) + "s";
> +	else if (scale == 'second')
> +		return s.toFixed(3) + "s";
> +	else
> +		return s.toFixed(0) + "s";
> +  }
> +
> +  function minorAxis(date, scale, step) {
> +	var ms = date;
> +
> +	ms -= last_major_ms;

This logic is unfortunately a bit dodgy. It looked like major label is 
getting called before the minor ones, so I thought I could calculate the 
relative offset for the minor for a more readable display. But after 
scrolling and zooming around timelines some more I can see cases where 
that doesn't seem to be the case.

Please have a play and if you think it is bad they only option will be 
to absolute time for minor labels as well.

Regards,

Tvrtko

> +
> +	if (ms < 0)
> +		return '';
> +
> +	if (scale == 'millisecond')
> +		return "+" + ms.toFixed(3) + "ms";
> +	else if (scale == 'second')
> +		return ms.toFixed(3) + "s";
> +	else
> +		return ms.toFixed(0) + "s";
> +  }
> +
>     // Configuration for the Timeline
>     var options = { groupOrder: 'content',
>   		  horizontalScroll: true,
> @@ -1007,6 +1038,7 @@ print <<ENDHTML;
>   		  stackSubgroups: false,
>   		  zoomKey: 'ctrlKey',
>   		  orientation: 'top',
> +		  format: { majorLabels: majorAxis, minorLabels: minorAxis },
>   		  start: '$first_ts',
>   		  end: '$end_ts'};
>   
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/9] trace.pl: Improve time axis labels
@ 2018-07-12 12:42     ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-12 12:42 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin


On 12/07/2018 11:59, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> 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
> relative millisecond offsets on the minor axis.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> ---
>   scripts/trace.pl | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
> 
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index fc1713e4f9a7..89491125490d 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -1000,6 +1000,37 @@ $first_ts = ts($first_ts);
>   print <<ENDHTML;
>     ]);
>   
> +  var last_major_ms;
> +
> +  function majorAxis(date, scale, step) {
> +	var s = date / 1000;
> +
> +	last_major_ms = date;
> +
> +	if (scale == 'millisecond')
> +		return s.toFixed(6) + "s";
> +	else if (scale == 'second')
> +		return s.toFixed(3) + "s";
> +	else
> +		return s.toFixed(0) + "s";
> +  }
> +
> +  function minorAxis(date, scale, step) {
> +	var ms = date;
> +
> +	ms -= last_major_ms;

This logic is unfortunately a bit dodgy. It looked like major label is 
getting called before the minor ones, so I thought I could calculate the 
relative offset for the minor for a more readable display. But after 
scrolling and zooming around timelines some more I can see cases where 
that doesn't seem to be the case.

Please have a play and if you think it is bad they only option will be 
to absolute time for minor labels as well.

Regards,

Tvrtko

> +
> +	if (ms < 0)
> +		return '';
> +
> +	if (scale == 'millisecond')
> +		return "+" + ms.toFixed(3) + "ms";
> +	else if (scale == 'second')
> +		return ms.toFixed(3) + "s";
> +	else
> +		return ms.toFixed(0) + "s";
> +  }
> +
>     // Configuration for the Timeline
>     var options = { groupOrder: 'content',
>   		  horizontalScroll: true,
> @@ -1007,6 +1038,7 @@ print <<ENDHTML;
>   		  stackSubgroups: false,
>   		  zoomKey: 'ctrlKey',
>   		  orientation: 'top',
> +		  format: { majorLabels: majorAxis, minorLabels: minorAxis },
>   		  start: '$first_ts',
>   		  end: '$end_ts'};
>   
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for trace.pl fixes and improvements (rev3)
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
                   ` (9 preceding siblings ...)
  (?)
@ 2018-07-12 14:26 ` Patchwork
  -1 siblings, 0 replies; 70+ messages in thread
From: Patchwork @ 2018-07-12 14:26 UTC (permalink / raw)
  To: John Harrison; +Cc: igt-dev

== Series Details ==

Series: trace.pl fixes and improvements (rev3)
URL   : https://patchwork.freedesktop.org/series/46177/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4475 -> IGTPW_1564 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46177/revisions/3/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1564 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       PASS -> INCOMPLETE (fdo#103713)

    
    ==== Warnings ====

    igt@gem_exec_suspend@basic-s4-devices:
      {fi-kbl-8809g}:     DMESG-WARN (fdo#107139) -> INCOMPLETE (fdo#107139)

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139


== Participating hosts (45 -> 40) ==

  Additional (1): fi-elk-e7500 
  Missing    (6): fi-ilk-m540 fi-bxt-dsi fi-hsw-4200u fi-byt-squawks fi-ctg-p8600 fi-kbl-7560u 


== Build changes ==

    * IGT: IGT_4551 -> IGTPW_1564

  CI_DRM_4475: 1b6f049d73237a170919604538e747b0282b0109 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1564: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1564/
  IGT_4551: 93cf6931b33e2c0f5b89c89b65817fe245ecc391 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1564/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for trace.pl fixes and improvements (rev3)
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
                   ` (10 preceding siblings ...)
  (?)
@ 2018-07-12 15:50 ` Patchwork
  -1 siblings, 0 replies; 70+ messages in thread
From: Patchwork @ 2018-07-12 15:50 UTC (permalink / raw)
  To: John Harrison; +Cc: igt-dev

== Series Details ==

Series: trace.pl fixes and improvements (rev3)
URL   : https://patchwork.freedesktop.org/series/46177/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4551_full -> IGTPW_1564_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1564_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1564_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46177/revisions/3/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1564_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_exec_schedule@deep-bsd1:
      shard-kbl:          SKIP -> PASS +2

    
== Known issues ==

  Here are the changes found in IGTPW_1564_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_userptr_blits@unsync-unmap-after-close:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_flip@2x-dpms-vs-vblank-race:
      shard-hsw:          PASS -> FAIL (fdo#103060)

    igt@kms_flip_tiling@flip-x-tiled:
      shard-glk:          PASS -> FAIL (fdo#107161)

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          NOTRUN -> FAIL (fdo#103925)

    
    ==== Possible fixes ====

    igt@gem_ctx_isolation@bcs0-s3:
      shard-glk:          FAIL (fdo#103375) -> PASS

    igt@gem_partial_pwrite_pread@reads-uncached:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    igt@kms_cursor_legacy@all-pipes-torture-move:
      shard-snb:          DMESG-WARN -> PASS

    igt@kms_cursor_legacy@pipe-c-torture-move:
      shard-apl:          DMESG-WARN (fdo#107122) -> PASS

    igt@kms_flip@2x-plain-flip-ts-check:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#102887) -> PASS

    igt@kms_flip_tiling@flip-to-x-tiled:
      shard-glk:          FAIL (fdo#107161) -> PASS

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          FAIL (fdo#103166) -> PASS

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

    igt@kms_vblank@pipe-a-ts-continuation-dpms-suspend:
      shard-kbl:          INCOMPLETE (fdo#103665) -> PASS

    igt@kms_vblank@pipe-b-ts-continuation-suspend:
      shard-apl:          FAIL (fdo#103375) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
  fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#107122 https://bugs.freedesktop.org/show_bug.cgi?id=107122
  fdo#107161 https://bugs.freedesktop.org/show_bug.cgi?id=107161
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4551 -> IGTPW_1564
    * Linux: CI_DRM_4474 -> CI_DRM_4475

  CI_DRM_4474: c298e0700edde3d016ae9b16d0ce2a098bee1022 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4475: 1b6f049d73237a170919604538e747b0282b0109 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1564: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1564/
  IGT_4551: 93cf6931b33e2c0f5b89c89b65817fe245ecc391 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1564/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/9] trace.pl: Improve time axis labels
  2018-07-12 12:42     ` Tvrtko Ursulin
@ 2018-07-12 22:35       ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-12 22:35 UTC (permalink / raw)
  To: Tvrtko Ursulin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx

On 7/12/2018 5:42 AM, Tvrtko Ursulin wrote:
>
> On 12/07/2018 11:59, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> 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
>> relative millisecond offsets on the minor axis.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: John Harrison <John.C.Harrison@Intel.com>
>> ---
>>   scripts/trace.pl | 32 ++++++++++++++++++++++++++++++++
>>   1 file changed, 32 insertions(+)
>>
>> diff --git a/scripts/trace.pl b/scripts/trace.pl
>> index fc1713e4f9a7..89491125490d 100755
>> --- a/scripts/trace.pl
>> +++ b/scripts/trace.pl
>> @@ -1000,6 +1000,37 @@ $first_ts = ts($first_ts);
>>   print <<ENDHTML;
>>     ]);
>>   +  var last_major_ms;
>> +
>> +  function majorAxis(date, scale, step) {
>> +    var s = date / 1000;
>> +
>> +    last_major_ms = date;
>> +
>> +    if (scale == 'millisecond')
>> +        return s.toFixed(6) + "s";
>> +    else if (scale == 'second')
>> +        return s.toFixed(3) + "s";
>> +    else
>> +        return s.toFixed(0) + "s";
>> +  }
>> +
>> +  function minorAxis(date, scale, step) {
>> +    var ms = date;
>> +
>> +    ms -= last_major_ms;
>
> This logic is unfortunately a bit dodgy. It looked like major label is 
> getting called before the minor ones, so I thought I could calculate 
> the relative offset for the minor for a more readable display. But 
> after scrolling and zooming around timelines some more I can see cases 
> where that doesn't seem to be the case.
>
> Please have a play and if you think it is bad they only option will be 
> to absolute time for minor labels as well.

Something is completely broken for me. I am getting massively out of 
whack timeline values. For example, a log file entry of 761846.983987 is 
being displayed as -59196268.216013s! Even ignoring that, I'm not 
convinced about the relative offset thing. It makes it much harder to 
correlate the graph with the trace file entries, e.g. if trying to work 
out exactly what happened when something went peculiar in a test. Would 
it be possible to make it dynamically switchable between raw absolute 
values and the funky change-as-you-scroll relative ones?

Also, it doesn't seem especially useful to have the values be relative 
to the left most edge of the visible portion of the timeline. That means 
that when you scroll sideways along the timeline, the time-stamp of any 
given point wanders up and down accordingly. That just seems confusing 
to me! Maybe it makes sense for some use cases but I would have thought 
that having the values be relative to the start of the trace would be 
more use. Or even have clickable anchor points so that you can set the 
origin to be whatever exciting event you are interested in? Although 
that might be way too complex to be worth the effort of implementing :).


>
> Regards,
>
> Tvrtko
>
>> +
>> +    if (ms < 0)
>> +        return '';
>> +
>> +    if (scale == 'millisecond')
>> +        return "+" + ms.toFixed(3) + "ms";
>> +    else if (scale == 'second')
>> +        return ms.toFixed(3) + "s";
>> +    else
>> +        return ms.toFixed(0) + "s";
>> +  }
>> +
>>     // Configuration for the Timeline
>>     var options = { groupOrder: 'content',
>>             horizontalScroll: true,
>> @@ -1007,6 +1038,7 @@ print <<ENDHTML;
>>             stackSubgroups: false,
>>             zoomKey: 'ctrlKey',
>>             orientation: 'top',
>> +          format: { majorLabels: majorAxis, minorLabels: minorAxis },
>>             start: '$first_ts',
>>             end: '$end_ts'};
>>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/9] trace.pl: Improve time axis labels
@ 2018-07-12 22:35       ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-12 22:35 UTC (permalink / raw)
  To: Tvrtko Ursulin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

On 7/12/2018 5:42 AM, Tvrtko Ursulin wrote:
>
> On 12/07/2018 11:59, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> 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
>> relative millisecond offsets on the minor axis.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: John Harrison <John.C.Harrison@Intel.com>
>> ---
>>   scripts/trace.pl | 32 ++++++++++++++++++++++++++++++++
>>   1 file changed, 32 insertions(+)
>>
>> diff --git a/scripts/trace.pl b/scripts/trace.pl
>> index fc1713e4f9a7..89491125490d 100755
>> --- a/scripts/trace.pl
>> +++ b/scripts/trace.pl
>> @@ -1000,6 +1000,37 @@ $first_ts = ts($first_ts);
>>   print <<ENDHTML;
>>     ]);
>>   +  var last_major_ms;
>> +
>> +  function majorAxis(date, scale, step) {
>> +    var s = date / 1000;
>> +
>> +    last_major_ms = date;
>> +
>> +    if (scale == 'millisecond')
>> +        return s.toFixed(6) + "s";
>> +    else if (scale == 'second')
>> +        return s.toFixed(3) + "s";
>> +    else
>> +        return s.toFixed(0) + "s";
>> +  }
>> +
>> +  function minorAxis(date, scale, step) {
>> +    var ms = date;
>> +
>> +    ms -= last_major_ms;
>
> This logic is unfortunately a bit dodgy. It looked like major label is 
> getting called before the minor ones, so I thought I could calculate 
> the relative offset for the minor for a more readable display. But 
> after scrolling and zooming around timelines some more I can see cases 
> where that doesn't seem to be the case.
>
> Please have a play and if you think it is bad they only option will be 
> to absolute time for minor labels as well.

Something is completely broken for me. I am getting massively out of 
whack timeline values. For example, a log file entry of 761846.983987 is 
being displayed as -59196268.216013s! Even ignoring that, I'm not 
convinced about the relative offset thing. It makes it much harder to 
correlate the graph with the trace file entries, e.g. if trying to work 
out exactly what happened when something went peculiar in a test. Would 
it be possible to make it dynamically switchable between raw absolute 
values and the funky change-as-you-scroll relative ones?

Also, it doesn't seem especially useful to have the values be relative 
to the left most edge of the visible portion of the timeline. That means 
that when you scroll sideways along the timeline, the time-stamp of any 
given point wanders up and down accordingly. That just seems confusing 
to me! Maybe it makes sense for some use cases but I would have thought 
that having the values be relative to the start of the trace would be 
more use. Or even have clickable anchor points so that you can set the 
origin to be whatever exciting event you are interested in? Although 
that might be way too complex to be worth the effort of implementing :).


>
> Regards,
>
> Tvrtko
>
>> +
>> +    if (ms < 0)
>> +        return '';
>> +
>> +    if (scale == 'millisecond')
>> +        return "+" + ms.toFixed(3) + "ms";
>> +    else if (scale == 'second')
>> +        return ms.toFixed(3) + "s";
>> +    else
>> +        return ms.toFixed(0) + "s";
>> +  }
>> +
>>     // Configuration for the Timeline
>>     var options = { groupOrder: 'content',
>>             horizontalScroll: true,
>> @@ -1007,6 +1038,7 @@ print <<ENDHTML;
>>             stackSubgroups: false,
>>             zoomKey: 'ctrlKey',
>>             orientation: 'top',
>> +          format: { majorLabels: majorAxis, minorLabels: minorAxis },
>>             start: '$first_ts',
>>             end: '$end_ts'};
>>

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t 2/9] trace.pl: Scale timeline for better precision
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-13  0:21     ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:21 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 2970 bytes --]

On 7/12/2018 3:59 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.
>
> v2: Rebase for time axis changes.
>
> 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>
> Reviewed-by: John Harrison <John.C.Harrison@Intel.com> # v1
> ---
>   scripts/trace.pl | 46 +++++++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 43 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 89491125490d..726c90d44547 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 ($y, $mo, $d, $h, $m, $s);
>   
> +	$us *= 1000 unless $no_timeline_scaling;
> +
>   	$s = int($us / 1000000);
>   	$us = $us % 1000000;
>   
> @@ -1001,11 +1017,28 @@ print <<ENDHTML;
>     ]);
>   
>     var last_major_ms;
> +ENDHTML
> +
> +if ($html) {
> +	if ($no_timeline_scaling) {
> +		say "  timeDiv = 1;";
> +	} else {
> +		say "  timeDiv = 1000;";
> +	}
> +}
>   
> +print <<ENDHTML;
>     function majorAxis(date, scale, step) {
> -	var s = date / 1000;
> +	var s = date / 1000 / timeDiv;
> +
> +	last_major_ms = date / timeDiv;
>   
> -	last_major_ms = date;
> +	if (timeDiv == 1000) {
> +		if (scale == 'second')
> +			scale = 'millisecond';
> +		else if (scale == 'minute')
> +			scale = 'second'
> +	}
>   
>   	if (scale == 'millisecond')
>   		return s.toFixed(6) + "s";
> @@ -1016,13 +1049,20 @@ print <<ENDHTML;
>     }
>   
>     function minorAxis(date, scale, step) {
> -	var ms = date;
> +	var ms = date / timeDiv;
>   
>   	ms -= last_major_ms;
>   
>   	if (ms < 0)
>   		return '';
>   
> +	if (timeDiv > 1) {
> +		if (scale == 'second')
> +			scale = 'millisecond';
> +		else if (scale == 'minute')
> +			scale = 'second';
> +	}
> +
>   	if (scale == 'millisecond')
>   		return "+" + ms.toFixed(3) + "ms";
>   	else if (scale == 'second')

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


[-- Attachment #1.2: Type: text/html, Size: 3554 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/9] trace.pl: Scale timeline for better precision
@ 2018-07-13  0:21     ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:21 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin


[-- Attachment #1.1: Type: text/plain, Size: 2970 bytes --]

On 7/12/2018 3:59 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.
>
> v2: Rebase for time axis changes.
>
> 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>
> Reviewed-by: John Harrison <John.C.Harrison@Intel.com> # v1
> ---
>   scripts/trace.pl | 46 +++++++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 43 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 89491125490d..726c90d44547 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 ($y, $mo, $d, $h, $m, $s);
>   
> +	$us *= 1000 unless $no_timeline_scaling;
> +
>   	$s = int($us / 1000000);
>   	$us = $us % 1000000;
>   
> @@ -1001,11 +1017,28 @@ print <<ENDHTML;
>     ]);
>   
>     var last_major_ms;
> +ENDHTML
> +
> +if ($html) {
> +	if ($no_timeline_scaling) {
> +		say "  timeDiv = 1;";
> +	} else {
> +		say "  timeDiv = 1000;";
> +	}
> +}
>   
> +print <<ENDHTML;
>     function majorAxis(date, scale, step) {
> -	var s = date / 1000;
> +	var s = date / 1000 / timeDiv;
> +
> +	last_major_ms = date / timeDiv;
>   
> -	last_major_ms = date;
> +	if (timeDiv == 1000) {
> +		if (scale == 'second')
> +			scale = 'millisecond';
> +		else if (scale == 'minute')
> +			scale = 'second'
> +	}
>   
>   	if (scale == 'millisecond')
>   		return s.toFixed(6) + "s";
> @@ -1016,13 +1049,20 @@ print <<ENDHTML;
>     }
>   
>     function minorAxis(date, scale, step) {
> -	var ms = date;
> +	var ms = date / timeDiv;
>   
>   	ms -= last_major_ms;
>   
>   	if (ms < 0)
>   		return '';
>   
> +	if (timeDiv > 1) {
> +		if (scale == 'second')
> +			scale = 'millisecond';
> +		else if (scale == 'minute')
> +			scale = 'second';
> +	}
> +
>   	if (scale == 'millisecond')
>   		return "+" + ms.toFixed(3) + "ms";
>   	else if (scale == 'second')

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


[-- Attachment #1.2: Type: text/html, Size: 3554 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t 4/9] trace.pl: Improve context colouring for large context id's
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-13  0:51     ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:51 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 605 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> John reports that on a long runnning systems the huge disparity between
> kernel context and user context id's causes all interesting colours to be
> clustered too close together.
>
> Fix this by assigning colours to seen contexts instead of basing purely
> on context id's.
>
> 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>
> ---
>

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



[-- Attachment #1.2: Type: text/html, Size: 1344 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t 4/9] trace.pl: Improve context colouring for large context id's
@ 2018-07-13  0:51     ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:51 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 605 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> John reports that on a long runnning systems the huge disparity between
> kernel context and user context id's causes all interesting colours to be
> clustered too close together.
>
> Fix this by assigning colours to seen contexts instead of basing purely
> on context id's.
>
> 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>
> ---
>

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



[-- Attachment #1.2: Type: text/html, Size: 1344 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t 3/9] trace.pl: Improve readability of graphical timeline representation
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-13  0:51     ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:51 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1002 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> We add stripes for different stages of request execution so it is easier
> to follow one context in the multi-colour mode.
>
> Vertical stripe pattern indicates pipeline "blockages" - requests waiting
> for dependencies before they are runnable.
>
> Diagonal stripes indicate runnable requests waiting for GPU time.
>
> Horizontal strips are requests executing on the GPU.
>
> Also use this new multi-coloured mode from media-bench.pl.
>
> v2:
>   John Harrison:
>   * Mention media-bench.pl in the commit.
>   * Fix HTML for single colour mode.
>
> v3:
>   * Rebase.
>   * Apply stripes to legacy colouring as well.
>
> v4:
>   John Harrison:
>   * Use per context colours for ctxsave and incomplete boxes.
>   * Clearer timeline legend.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>

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


[-- Attachment #1.2: Type: text/html, Size: 1616 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t 3/9] trace.pl: Improve readability of graphical timeline representation
@ 2018-07-13  0:51     ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:51 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1002 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> We add stripes for different stages of request execution so it is easier
> to follow one context in the multi-colour mode.
>
> Vertical stripe pattern indicates pipeline "blockages" - requests waiting
> for dependencies before they are runnable.
>
> Diagonal stripes indicate runnable requests waiting for GPU time.
>
> Horizontal strips are requests executing on the GPU.
>
> Also use this new multi-coloured mode from media-bench.pl.
>
> v2:
>   John Harrison:
>   * Mention media-bench.pl in the commit.
>   * Fix HTML for single colour mode.
>
> v3:
>   * Rebase.
>   * Apply stripes to legacy colouring as well.
>
> v4:
>   John Harrison:
>   * Use per context colours for ctxsave and incomplete boxes.
>   * Clearer timeline legend.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>

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


[-- Attachment #1.2: Type: text/html, Size: 1616 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t 5/9] trace.pl: Improved key/colours
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-13  0:52     ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:52 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 4979 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Improve the timeline legend to show actual context colours.
>
> v2: (Tvrtko Ursulin)
>   * Commit msg.
>   * Tweak layout for more compactness and more readability.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   scripts/trace.pl | 69 ++++++++++++++++++++++++++++++------------------
>   1 file changed, 43 insertions(+), 26 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 7cafb3f52ba4..bd3039511f5d 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -738,9 +738,35 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
>   	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
>   
>   my $timeline_text = $colour_contexts ?
> -		    'Per context coloured shading like:' : 'Box shading like:';
> +		    'per context coloured shading like' : 'box shading like';
>   
>   my %ctx_colours;
> +my $ctx_table;
> +
> +sub generate_ctx_table
> +{
> +	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
> +	my @ctxts;
> +
> +	if( $colour_contexts ) {
> +		@ctxts = sort keys %ctxdb;
> +	} else {
> +		@ctxts = ($min_ctx);
> +	}
> +
> +	$ctx_table .= '<table>';
> +
> +	foreach my $ctx (@ctxts) {
> +		$ctx_table .= "<tr>\n";
> +		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
> +		foreach my $state (@states) {
> +			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
> +		}
> +		$ctx_table .= "</tr>\n";

As mentioned in the email, I would definitely add something like:
     my $i = 0;
     ...
     if( $i++ > 5)  {
         $ctx_table .= "<tr><td>etc...</td></tr>";
         last;
     }

I've had to analyse traces with hundreds of contexts in them before now. 
Which would produce an HTML file swamped by a huge legend (albeit with a 
beautifully smoothly shaded rainbow!).

With that...

Signed-off-by: John Harrison<John.C.Harrison@Intel.com>
Reviewed-by: John Harrison<John.C.Harrison@Intel.com>



> +	}
> +
> +	$ctx_table .= '</table>';
> +}
>   
>   sub generate_ctx_colours
>   {
> @@ -754,12 +780,7 @@ sub generate_ctx_colours
>   
>   
>   generate_ctx_colours() if $html and $colour_contexts;
> -
> -my $queued_style = box_style($min_ctx, 'queue');
> -my $ready_style = box_style($min_ctx, 'ready');
> -my $execute_style = box_style($min_ctx, 'execute');
> -my $ctxsave_style = box_style($min_ctx, 'ctxsave');
> -my $incomplete_style = box_style($min_ctx, 'incomplete');
> +generate_ctx_table() if $html;
>   
>   print <<ENDHTML if $html;
>   <!DOCTYPE HTML>
> @@ -778,35 +799,27 @@ print <<ENDHTML if $html;
>   </head>
>   <body>
>   <p>
> -<b>Timeline request view:</b>
> +<b>Timeline request view is $timeline_text:</b>
>   <table>
> -<tr><td colspan='4'>$timeline_text</td></tr>
>   <tr>
> -<td align='center'><div style='$queued_style'>QUEUED</div></td>
> -<td align='center'><div style='$ready_style'>READY</div></td>
> -<td align='center'><div style='$execute_style'>EXECUTE</div></td>
> -<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
> -</tr><tr>
> -<td></td>
> -<td></td>
> -<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
> -<td></td>
> -</tr/></table>
> -</p>
> -<p>
> -<small>
> -QUEUED = requests executing on the GPU<br>
> +<td>
> +$ctx_table
> +</td>
> +<td>
> +QUEUE = requests executing on the GPU<br>
>   READY = runnable requests waiting for a slot on GPU<br>
>   EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
>   CTXSAVE = GPU saving the context image<br>
> -</small>
> -</p>
> +INCOMPLETE = request of unknown completion time
>   <p>
>   Boxes are in format 'ctx-id/seqno'.
>   </p>
>   <p>
>   Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
>   </p>
> +</td>
> +</tr>
> +</table>
>   <p>
>   <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
>   <br>
> @@ -975,20 +988,24 @@ sub box_style
>   {
>   	my ($ctx, $stage) = @_;
>   	my $deg;
> +	my $text_col = 'white';
>   
>   	if ($stage eq 'queue') {
>   		$deg = 90;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ready') {
>   		$deg = 45;
>   	} elsif ($stage eq 'execute') {
>   		$deg = 0;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ctxsave') {
>   		$deg = 105;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'incomplete') {
>   		$deg = 0;
>   	}
>   
> -	return 'color: black; background: repeating-linear-gradient(' .
> +	return "color: $text_col; background: repeating-linear-gradient(" .
>   		$deg . 'deg, ' .
>   		ctx_colour($ctx, $stage, 1.0) . ', ' .
>   		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .


[-- Attachment #1.2: Type: text/html, Size: 6259 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 5/9] trace.pl: Improved key/colours
@ 2018-07-13  0:52     ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:52 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin


[-- Attachment #1.1: Type: text/plain, Size: 4979 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Improve the timeline legend to show actual context colours.
>
> v2: (Tvrtko Ursulin)
>   * Commit msg.
>   * Tweak layout for more compactness and more readability.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   scripts/trace.pl | 69 ++++++++++++++++++++++++++++++------------------
>   1 file changed, 43 insertions(+), 26 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 7cafb3f52ba4..bd3039511f5d 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -738,9 +738,35 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
>   	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
>   
>   my $timeline_text = $colour_contexts ?
> -		    'Per context coloured shading like:' : 'Box shading like:';
> +		    'per context coloured shading like' : 'box shading like';
>   
>   my %ctx_colours;
> +my $ctx_table;
> +
> +sub generate_ctx_table
> +{
> +	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
> +	my @ctxts;
> +
> +	if( $colour_contexts ) {
> +		@ctxts = sort keys %ctxdb;
> +	} else {
> +		@ctxts = ($min_ctx);
> +	}
> +
> +	$ctx_table .= '<table>';
> +
> +	foreach my $ctx (@ctxts) {
> +		$ctx_table .= "<tr>\n";
> +		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
> +		foreach my $state (@states) {
> +			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
> +		}
> +		$ctx_table .= "</tr>\n";

As mentioned in the email, I would definitely add something like:
     my $i = 0;
     ...
     if( $i++ > 5)  {
         $ctx_table .= "<tr><td>etc...</td></tr>";
         last;
     }

I've had to analyse traces with hundreds of contexts in them before now. 
Which would produce an HTML file swamped by a huge legend (albeit with a 
beautifully smoothly shaded rainbow!).

With that...

Signed-off-by: John Harrison<John.C.Harrison@Intel.com>
Reviewed-by: John Harrison<John.C.Harrison@Intel.com>



> +	}
> +
> +	$ctx_table .= '</table>';
> +}
>   
>   sub generate_ctx_colours
>   {
> @@ -754,12 +780,7 @@ sub generate_ctx_colours
>   
>   
>   generate_ctx_colours() if $html and $colour_contexts;
> -
> -my $queued_style = box_style($min_ctx, 'queue');
> -my $ready_style = box_style($min_ctx, 'ready');
> -my $execute_style = box_style($min_ctx, 'execute');
> -my $ctxsave_style = box_style($min_ctx, 'ctxsave');
> -my $incomplete_style = box_style($min_ctx, 'incomplete');
> +generate_ctx_table() if $html;
>   
>   print <<ENDHTML if $html;
>   <!DOCTYPE HTML>
> @@ -778,35 +799,27 @@ print <<ENDHTML if $html;
>   </head>
>   <body>
>   <p>
> -<b>Timeline request view:</b>
> +<b>Timeline request view is $timeline_text:</b>
>   <table>
> -<tr><td colspan='4'>$timeline_text</td></tr>
>   <tr>
> -<td align='center'><div style='$queued_style'>QUEUED</div></td>
> -<td align='center'><div style='$ready_style'>READY</div></td>
> -<td align='center'><div style='$execute_style'>EXECUTE</div></td>
> -<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
> -</tr><tr>
> -<td></td>
> -<td></td>
> -<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
> -<td></td>
> -</tr/></table>
> -</p>
> -<p>
> -<small>
> -QUEUED = requests executing on the GPU<br>
> +<td>
> +$ctx_table
> +</td>
> +<td>
> +QUEUE = requests executing on the GPU<br>
>   READY = runnable requests waiting for a slot on GPU<br>
>   EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
>   CTXSAVE = GPU saving the context image<br>
> -</small>
> -</p>
> +INCOMPLETE = request of unknown completion time
>   <p>
>   Boxes are in format 'ctx-id/seqno'.
>   </p>
>   <p>
>   Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
>   </p>
> +</td>
> +</tr>
> +</table>
>   <p>
>   <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
>   <br>
> @@ -975,20 +988,24 @@ sub box_style
>   {
>   	my ($ctx, $stage) = @_;
>   	my $deg;
> +	my $text_col = 'white';
>   
>   	if ($stage eq 'queue') {
>   		$deg = 90;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ready') {
>   		$deg = 45;
>   	} elsif ($stage eq 'execute') {
>   		$deg = 0;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ctxsave') {
>   		$deg = 105;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'incomplete') {
>   		$deg = 0;
>   	}
>   
> -	return 'color: black; background: repeating-linear-gradient(' .
> +	return "color: $text_col; background: repeating-linear-gradient(" .
>   		$deg . 'deg, ' .
>   		ctx_colour($ctx, $stage, 1.0) . ', ' .
>   		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .


[-- Attachment #1.2: Type: text/html, Size: 6259 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 8/9] trace.pl: Basic preemption support
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
  (?)
@ 2018-07-13  0:54   ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  0:54 UTC (permalink / raw)
  To: igt-dev


[-- Attachment #1.1: Type: text/plain, Size: 778 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Just forget about earlier request_in events.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   scripts/trace.pl | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 33045f3264f2..43c68001d768 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -438,7 +438,9 @@ while (<>) {
>   	} elsif ($tp_name eq 'i915:i915_request_in:') {
>   		my %req;
>   
> -		die if exists $db{$key};
> +		# preemption
> +		delete $db{$key} if exists $db{$key};
> +
>   		die unless exists $queue{$key};
>   		die unless exists $submit{$key};
>   

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


[-- Attachment #1.2: Type: text/html, Size: 1334 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 6/9] trace.pl: Context save only applies to last request of a bunch
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
  (?)
@ 2018-07-13  6:55   ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  6:55 UTC (permalink / raw)
  To: igt-dev


[-- Attachment #1.1: Type: text/plain, Size: 373 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Skip accounting the context save time for anything but the last request of
> the coalesced bunch, and also skip drawing those boxes on the timeline.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>

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



[-- Attachment #1.2: Type: text/html, Size: 950 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t 7/9] trace.pl: Fix incomplete request handling
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-13  7:00     ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  7:00 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1110 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Incomplete requests (no notify, no context complete) have to be corrected
> by looking at the engine timeline, and not the sorted-by-start-time view
> as was previously used.
>
> Per-engine timelines are generated on demand and cached for later use.
>
> v2: Find end of current context on the engine timeline instead of just
>      using the next request for adjusting the incomplete start time.
>
> v3: Improve scaling with large datasets by only walking each engine
>      timeline once and some caching. (John Harrison)
>
> v4:
>   * Fix logic fail from v3.
>   * Refactor the code a bit to separate the stages better.
>   * Do not account batches with unknown duration in avg stats.
>   * Handle two user interrupts with the same seqno.
>   * Handle user interrupt arriving after request_out.
>
> v5:
>   * Update for class:instance.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@intel.com>
> ---
>

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



[-- Attachment #1.2: Type: text/html, Size: 1727 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 7/9] trace.pl: Fix incomplete request handling
@ 2018-07-13  7:00     ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-13  7:00 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin


[-- Attachment #1.1: Type: text/plain, Size: 1110 bytes --]

On 7/12/2018 3:59 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Incomplete requests (no notify, no context complete) have to be corrected
> by looking at the engine timeline, and not the sorted-by-start-time view
> as was previously used.
>
> Per-engine timelines are generated on demand and cached for later use.
>
> v2: Find end of current context on the engine timeline instead of just
>      using the next request for adjusting the incomplete start time.
>
> v3: Improve scaling with large datasets by only walking each engine
>      timeline once and some caching. (John Harrison)
>
> v4:
>   * Fix logic fail from v3.
>   * Refactor the code a bit to separate the stages better.
>   * Do not account batches with unknown duration in avg stats.
>   * Handle two user interrupts with the same seqno.
>   * Handle user interrupt arriving after request_out.
>
> v5:
>   * Update for class:instance.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@intel.com>
> ---
>

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



[-- Attachment #1.2: Type: text/html, Size: 1727 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
  2018-07-12 22:35       ` John Harrison
@ 2018-07-13  9:55         ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-13  9:55 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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 <tvrtko.ursulin@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Harrison <John.C.Harrison@Intel.com>
---
 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'};
 
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
@ 2018-07-13  9:55         ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-13  9:55 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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 <tvrtko.ursulin@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Harrison <John.C.Harrison@Intel.com>
---
 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'};
 
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t v3 5/9] trace.pl: Improved key/colours
  2018-07-13  0:52     ` [igt-dev] " John Harrison
@ 2018-07-13  9:56       ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-13  9:56 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: John Harrison <John.C.Harrison@Intel.com>

Improve the timeline legend to show actual context colours.

v2: (Tvrtko Ursulin)
 * Commit msg.
 * Tweak layout for more compactness and more readability.

v3:
 * Limit number of shown contexts in the legend. (John Harrison)

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index bad5414e11d6..d86eab6b0a8b 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -738,9 +738,46 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
 my $timeline_text = $colour_contexts ?
-		    'Per context coloured shading like:' : 'Box shading like:';
+		    'per context coloured shading like' : 'box shading like';
 
 my %ctx_colours;
+my $ctx_table;
+
+sub generate_ctx_table
+{
+	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
+	my $max_show = 6;
+	my (@ctxts, @disp_ctxts);
+	my $step;
+
+	if( $colour_contexts ) {
+		@ctxts = sort keys %ctxdb;
+	} else {
+		@ctxts = ($min_ctx);
+	}
+
+	# Limit number of shown context examples
+	$step = int(scalar(@ctxts) / $max_show);
+	if ($step) {
+		foreach my $i (0..$#ctxts) {
+			push @disp_ctxts, $ctxts[$i] unless $i % $step;
+			last if scalar(@disp_ctxts) == $max_show;
+		}
+	}
+
+	$ctx_table .= '<table>';
+
+	foreach my $ctx (@disp_ctxts) {
+		$ctx_table .= "<tr>\n";
+		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
+		foreach my $state (@states) {
+			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
+		}
+		$ctx_table .= "</tr>\n";
+	}
+
+	$ctx_table .= '</table>';
+}
 
 sub generate_ctx_colours
 {
@@ -754,12 +791,7 @@ sub generate_ctx_colours
 
 
 generate_ctx_colours() if $html and $colour_contexts;
-
-my $queued_style = box_style($min_ctx, 'queue');
-my $ready_style = box_style($min_ctx, 'ready');
-my $execute_style = box_style($min_ctx, 'execute');
-my $ctxsave_style = box_style($min_ctx, 'ctxsave');
-my $incomplete_style = box_style($min_ctx, 'incomplete');
+generate_ctx_table() if $html;
 
 print <<ENDHTML if $html;
 <!DOCTYPE HTML>
@@ -778,35 +810,27 @@ print <<ENDHTML if $html;
 </head>
 <body>
 <p>
-<b>Timeline request view:</b>
+<b>Timeline request view is $timeline_text:</b>
 <table>
-<tr><td colspan='4'>$timeline_text</td></tr>
 <tr>
-<td align='center'><div style='$queued_style'>QUEUED</div></td>
-<td align='center'><div style='$ready_style'>READY</div></td>
-<td align='center'><div style='$execute_style'>EXECUTE</div></td>
-<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
-</tr><tr>
-<td></td>
-<td></td>
-<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
-<td></td>
-</tr/></table>
-</p>
-<p>
-<small>
-QUEUED = requests executing on the GPU<br>
+<td>
+$ctx_table
+</td>
+<td>
+QUEUE = requests executing on the GPU<br>
 READY = runnable requests waiting for a slot on GPU<br>
 EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
 CTXSAVE = GPU saving the context image<br>
-</small>
-</p>
+INCOMPLETE = request of unknown completion time
 <p>
 Boxes are in format 'ctx-id/seqno'.
 </p>
 <p>
 Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
 </p>
+</td>
+</tr>
+</table>
 <p>
 <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
 <br>
@@ -975,20 +999,24 @@ sub box_style
 {
 	my ($ctx, $stage) = @_;
 	my $deg;
+	my $text_col = 'white';
 
 	if ($stage eq 'queue') {
 		$deg = 90;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ready') {
 		$deg = 45;
 	} elsif ($stage eq 'execute') {
 		$deg = 0;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ctxsave') {
 		$deg = 105;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'incomplete') {
 		$deg = 0;
 	}
 
-	return 'color: black; background: repeating-linear-gradient(' .
+	return "color: $text_col; background: repeating-linear-gradient(" .
 		$deg . 'deg, ' .
 		ctx_colour($ctx, $stage, 1.0) . ', ' .
 		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t v3 5/9] trace.pl: Improved key/colours
@ 2018-07-13  9:56       ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-13  9:56 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

From: John Harrison <John.C.Harrison@Intel.com>

Improve the timeline legend to show actual context colours.

v2: (Tvrtko Ursulin)
 * Commit msg.
 * Tweak layout for more compactness and more readability.

v3:
 * Limit number of shown contexts in the legend. (John Harrison)

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index bad5414e11d6..d86eab6b0a8b 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -738,9 +738,46 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
 my $timeline_text = $colour_contexts ?
-		    'Per context coloured shading like:' : 'Box shading like:';
+		    'per context coloured shading like' : 'box shading like';
 
 my %ctx_colours;
+my $ctx_table;
+
+sub generate_ctx_table
+{
+	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
+	my $max_show = 6;
+	my (@ctxts, @disp_ctxts);
+	my $step;
+
+	if( $colour_contexts ) {
+		@ctxts = sort keys %ctxdb;
+	} else {
+		@ctxts = ($min_ctx);
+	}
+
+	# Limit number of shown context examples
+	$step = int(scalar(@ctxts) / $max_show);
+	if ($step) {
+		foreach my $i (0..$#ctxts) {
+			push @disp_ctxts, $ctxts[$i] unless $i % $step;
+			last if scalar(@disp_ctxts) == $max_show;
+		}
+	}
+
+	$ctx_table .= '<table>';
+
+	foreach my $ctx (@disp_ctxts) {
+		$ctx_table .= "<tr>\n";
+		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
+		foreach my $state (@states) {
+			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
+		}
+		$ctx_table .= "</tr>\n";
+	}
+
+	$ctx_table .= '</table>';
+}
 
 sub generate_ctx_colours
 {
@@ -754,12 +791,7 @@ sub generate_ctx_colours
 
 
 generate_ctx_colours() if $html and $colour_contexts;
-
-my $queued_style = box_style($min_ctx, 'queue');
-my $ready_style = box_style($min_ctx, 'ready');
-my $execute_style = box_style($min_ctx, 'execute');
-my $ctxsave_style = box_style($min_ctx, 'ctxsave');
-my $incomplete_style = box_style($min_ctx, 'incomplete');
+generate_ctx_table() if $html;
 
 print <<ENDHTML if $html;
 <!DOCTYPE HTML>
@@ -778,35 +810,27 @@ print <<ENDHTML if $html;
 </head>
 <body>
 <p>
-<b>Timeline request view:</b>
+<b>Timeline request view is $timeline_text:</b>
 <table>
-<tr><td colspan='4'>$timeline_text</td></tr>
 <tr>
-<td align='center'><div style='$queued_style'>QUEUED</div></td>
-<td align='center'><div style='$ready_style'>READY</div></td>
-<td align='center'><div style='$execute_style'>EXECUTE</div></td>
-<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
-</tr><tr>
-<td></td>
-<td></td>
-<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
-<td></td>
-</tr/></table>
-</p>
-<p>
-<small>
-QUEUED = requests executing on the GPU<br>
+<td>
+$ctx_table
+</td>
+<td>
+QUEUE = requests executing on the GPU<br>
 READY = runnable requests waiting for a slot on GPU<br>
 EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
 CTXSAVE = GPU saving the context image<br>
-</small>
-</p>
+INCOMPLETE = request of unknown completion time
 <p>
 Boxes are in format 'ctx-id/seqno'.
 </p>
 <p>
 Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
 </p>
+</td>
+</tr>
+</table>
 <p>
 <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
 <br>
@@ -975,20 +999,24 @@ sub box_style
 {
 	my ($ctx, $stage) = @_;
 	my $deg;
+	my $text_col = 'white';
 
 	if ($stage eq 'queue') {
 		$deg = 90;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ready') {
 		$deg = 45;
 	} elsif ($stage eq 'execute') {
 		$deg = 0;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ctxsave') {
 		$deg = 105;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'incomplete') {
 		$deg = 0;
 	}
 
-	return 'color: black; background: repeating-linear-gradient(' .
+	return "color: $text_col; background: repeating-linear-gradient(" .
 		$deg . 'deg, ' .
 		ctx_colour($ctx, $stage, 1.0) . ', ' .
 		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH i-g-t v3 2/9] trace.pl: Scale timeline for better precision
  2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-13 10:02     ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-13 10:02 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

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.

v2: Rebase for time axis changes.
v3: Another tweak for time axis changes.

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>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com> # v2
---
 scripts/trace.pl | 54 ++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 50 insertions(+), 4 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 41f10749a153..4b5f4ef77aef 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 ($y, $mo, $d, $h, $m, $s);
 
+	$us *= 1000 unless $no_timeline_scaling;
+
 	$s = int($us / 1000000);
 	$us = $us % 1000000;
 
@@ -999,11 +1015,28 @@ $first_ts = ts($first_ts);
 
 print <<ENDHTML;
   ]);
+ENDHTML
 
+if ($html) {
+	if ($no_timeline_scaling) {
+		say "  timeDiv = 1;";
+	} else {
+		say "  timeDiv = 1000;";
+	}
+}
+
+print <<ENDHTML;
   function majorAxis(date, scale, step) {
-	var s = date / 1000;
+	var s = date / 1000 / timeDiv;
 	var precision;
 
+	if (timeDiv == 1000) {
+		if (scale == 'second')
+			scale = 'millisecond';
+		else if (scale == 'minute')
+			scale = 'second'
+	}
+
 	if (scale == 'millisecond')
 		precision = 6;
 	else if (scale == 'second')
@@ -1015,14 +1048,27 @@ print <<ENDHTML;
   }
 
   function minorAxis(date, scale, step) {
-	var ms = date;
+	var ms = date / timeDiv;
+	var orig_scale = scale;
 	var precision;
 	var unit;
 
+	if (timeDiv == 1000) {
+		if (scale == 'second')
+			scale = 'millisecond';
+		else if (scale == 'minute')
+			scale = 'second'
+	}
+
 	if (scale == 'millisecond') {
-		ms %= 1000;
 		precision = 0;
-		unit = 'ms';
+		if (orig_scale == 'millisecond' && step <= 200) {
+			ms = date % 1000;
+			unit = 'us';
+		} else {
+			ms %= 1000;
+			unit = 'ms';
+		}
 	} else if (scale == 'second') {
 		ms /= 1000;
 		precision = 1;
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] [PATCH i-g-t v3 2/9] trace.pl: Scale timeline for better precision
@ 2018-07-13 10:02     ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-13 10:02 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

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.

v2: Rebase for time axis changes.
v3: Another tweak for time axis changes.

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>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com> # v2
---
 scripts/trace.pl | 54 ++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 50 insertions(+), 4 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 41f10749a153..4b5f4ef77aef 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 ($y, $mo, $d, $h, $m, $s);
 
+	$us *= 1000 unless $no_timeline_scaling;
+
 	$s = int($us / 1000000);
 	$us = $us % 1000000;
 
@@ -999,11 +1015,28 @@ $first_ts = ts($first_ts);
 
 print <<ENDHTML;
   ]);
+ENDHTML
 
+if ($html) {
+	if ($no_timeline_scaling) {
+		say "  timeDiv = 1;";
+	} else {
+		say "  timeDiv = 1000;";
+	}
+}
+
+print <<ENDHTML;
   function majorAxis(date, scale, step) {
-	var s = date / 1000;
+	var s = date / 1000 / timeDiv;
 	var precision;
 
+	if (timeDiv == 1000) {
+		if (scale == 'second')
+			scale = 'millisecond';
+		else if (scale == 'minute')
+			scale = 'second'
+	}
+
 	if (scale == 'millisecond')
 		precision = 6;
 	else if (scale == 'second')
@@ -1015,14 +1048,27 @@ print <<ENDHTML;
   }
 
   function minorAxis(date, scale, step) {
-	var ms = date;
+	var ms = date / timeDiv;
+	var orig_scale = scale;
 	var precision;
 	var unit;
 
+	if (timeDiv == 1000) {
+		if (scale == 'second')
+			scale = 'millisecond';
+		else if (scale == 'minute')
+			scale = 'second'
+	}
+
 	if (scale == 'millisecond') {
-		ms %= 1000;
 		precision = 0;
-		unit = 'ms';
+		if (orig_scale == 'millisecond' && step <= 200) {
+			ms = date % 1000;
+			unit = 'us';
+		} else {
+			ms %= 1000;
+			unit = 'ms';
+		}
 	} else if (scale == 'second') {
 		ms /= 1000;
 		precision = 1;
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for trace.pl fixes and improvements (rev6)
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
                   ` (11 preceding siblings ...)
  (?)
@ 2018-07-13 11:09 ` Patchwork
  -1 siblings, 0 replies; 70+ messages in thread
From: Patchwork @ 2018-07-13 11:09 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev

== Series Details ==

Series: trace.pl fixes and improvements (rev6)
URL   : https://patchwork.freedesktop.org/series/46177/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4479 -> IGTPW_1577 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46177/revisions/6/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1577 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_flip@basic-flip-vs-modeset:
      fi-skl-6700hq:      PASS -> DMESG-WARN (fdo#105998)

    
    ==== Possible fixes ====

    igt@drv_module_reload@basic-reload:
      fi-ilk-650:         DMESG-WARN (fdo#106387) -> PASS +2

    igt@kms_chamelium@hdmi-hpd-fast:
      fi-kbl-7500u:       FAIL (fdo#103841, fdo#102672) -> SKIP

    
    ==== Warnings ====

    igt@gem_exec_suspend@basic-s4-devices:
      {fi-kbl-8809g}:     INCOMPLETE (fdo#107139) -> DMESG-WARN (fdo#107139)

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#102672 https://bugs.freedesktop.org/show_bug.cgi?id=102672
  fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
  fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
  fdo#106387 https://bugs.freedesktop.org/show_bug.cgi?id=106387
  fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139


== Participating hosts (46 -> 41) ==

  Additional (1): fi-byt-j1900 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-ivb-3520m 


== Build changes ==

    * IGT: IGT_4553 -> IGTPW_1577

  CI_DRM_4479: c9c54a1c37adefd414d51ed919aab3f94794ee35 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1577: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1577/
  IGT_4553: 9d25d62bb6ff62694e5226b02d79075eab304402 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1577/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [igt-dev] ✗ Fi.CI.IGT: failure for trace.pl fixes and improvements (rev6)
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
                   ` (12 preceding siblings ...)
  (?)
@ 2018-07-13 13:59 ` Patchwork
  -1 siblings, 0 replies; 70+ messages in thread
From: Patchwork @ 2018-07-13 13:59 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev

== Series Details ==

Series: trace.pl fixes and improvements (rev6)
URL   : https://patchwork.freedesktop.org/series/46177/
State : failure

== Summary ==

= CI Bug Log - changes from IGT_4553_full -> IGTPW_1577_full =

== Summary - FAILURE ==

  Serious unknown changes coming with IGTPW_1577_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1577_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46177/revisions/6/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1577_full:

  === IGT changes ===

    ==== Possible regressions ====

    igt@kms_draw_crc@fill-fb:
      shard-glk:          PASS -> FAIL

    
    ==== Warnings ====

    igt@gem_exec_schedule@deep-blt:
      shard-kbl:          SKIP -> PASS +1

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          PASS -> SKIP +2
      shard-snb:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_1577_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@forcewake:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking-fencing:
      shard-glk:          PASS -> FAIL (fdo#105703)

    igt@kms_busy@basic-flip-e:
      shard-snb:          SKIP -> INCOMPLETE (fdo#105411)

    igt@kms_cursor_legacy@2x-nonblocking-modeset-vs-cursor-atomic:
      shard-glk:          PASS -> FAIL (fdo#105454, fdo#106509)

    igt@kms_flip@2x-plain-flip-fb-recreate:
      shard-hsw:          PASS -> FAIL (fdo#100368)

    igt@kms_flip_tiling@flip-y-tiled:
      shard-glk:          NOTRUN -> FAIL (fdo#107161)

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-pri-shrfb-draw-mmap-cpu:
      shard-hsw:          PASS -> FAIL (fdo#103167, fdo#105682)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)
      shard-glk:          PASS -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@kms_flip@plain-flip-ts-check-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@testdisplay:
      shard-glk:          INCOMPLETE (fdo#103359, k.org#198133) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105454 https://bugs.freedesktop.org/show_bug.cgi?id=105454
  fdo#105682 https://bugs.freedesktop.org/show_bug.cgi?id=105682
  fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
  fdo#106509 https://bugs.freedesktop.org/show_bug.cgi?id=106509
  fdo#107161 https://bugs.freedesktop.org/show_bug.cgi?id=107161
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4553 -> IGTPW_1577
    * Linux: CI_DRM_4476 -> CI_DRM_4479

  CI_DRM_4476: b818fac0878147c6df45338cb515b9b7bd878b7f @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4479: c9c54a1c37adefd414d51ed919aab3f94794ee35 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1577: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1577/
  IGT_4553: 9d25d62bb6ff62694e5226b02d79075eab304402 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1577/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t v3 5/9] trace.pl: Improved key/colours
  2018-07-13  9:56       ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-14  0:01         ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-14  0:01 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx

On 7/13/2018 2:56 AM, Tvrtko Ursulin wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Improve the timeline legend to show actual context colours.
>
> v2: (Tvrtko Ursulin)
>   * Commit msg.
>   * Tweak layout for more compactness and more readability.
>
> v3:
>   * Limit number of shown contexts in the legend. (John Harrison)
>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>   scripts/trace.pl | 80 ++++++++++++++++++++++++++++++++----------------
>   1 file changed, 54 insertions(+), 26 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index bad5414e11d6..d86eab6b0a8b 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -738,9 +738,46 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
>   	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
>   
>   my $timeline_text = $colour_contexts ?
> -		    'Per context coloured shading like:' : 'Box shading like:';
> +		    'per context coloured shading like' : 'box shading like';
>   
>   my %ctx_colours;
> +my $ctx_table;
> +
> +sub generate_ctx_table
> +{
> +	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
> +	my $max_show = 6;
> +	my (@ctxts, @disp_ctxts);
> +	my $step;
> +
> +	if( $colour_contexts ) {
> +		@ctxts = sort keys %ctxdb;
> +	} else {
> +		@ctxts = ($min_ctx);
> +	}
> +
> +	# Limit number of shown context examples
> +	$step = int(scalar(@ctxts) / $max_show);
> +	if ($step) {
> +		foreach my $i (0..$#ctxts) {
> +			push @disp_ctxts, $ctxts[$i] unless $i % $step;
> +			last if scalar(@disp_ctxts) == $max_show;
> +		}
> +	}
else { @disp_ctxts = @ctxts;} ???

Currently, if step is zero then there is no legend. Otherwise...

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

> +
> +	$ctx_table .= '<table>';
> +
> +	foreach my $ctx (@disp_ctxts) {
> +		$ctx_table .= "<tr>\n";
> +		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
> +		foreach my $state (@states) {
> +			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
> +		}
> +		$ctx_table .= "</tr>\n";
> +	}
> +
> +	$ctx_table .= '</table>';
> +}
>   
>   sub generate_ctx_colours
>   {
> @@ -754,12 +791,7 @@ sub generate_ctx_colours
>   
>   
>   generate_ctx_colours() if $html and $colour_contexts;
> -
> -my $queued_style = box_style($min_ctx, 'queue');
> -my $ready_style = box_style($min_ctx, 'ready');
> -my $execute_style = box_style($min_ctx, 'execute');
> -my $ctxsave_style = box_style($min_ctx, 'ctxsave');
> -my $incomplete_style = box_style($min_ctx, 'incomplete');
> +generate_ctx_table() if $html;
>   
>   print <<ENDHTML if $html;
>   <!DOCTYPE HTML>
> @@ -778,35 +810,27 @@ print <<ENDHTML if $html;
>   </head>
>   <body>
>   <p>
> -<b>Timeline request view:</b>
> +<b>Timeline request view is $timeline_text:</b>
>   <table>
> -<tr><td colspan='4'>$timeline_text</td></tr>
>   <tr>
> -<td align='center'><div style='$queued_style'>QUEUED</div></td>
> -<td align='center'><div style='$ready_style'>READY</div></td>
> -<td align='center'><div style='$execute_style'>EXECUTE</div></td>
> -<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
> -</tr><tr>
> -<td></td>
> -<td></td>
> -<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
> -<td></td>
> -</tr/></table>
> -</p>
> -<p>
> -<small>
> -QUEUED = requests executing on the GPU<br>
> +<td>
> +$ctx_table
> +</td>
> +<td>
> +QUEUE = requests executing on the GPU<br>
>   READY = runnable requests waiting for a slot on GPU<br>
>   EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
>   CTXSAVE = GPU saving the context image<br>
> -</small>
> -</p>
> +INCOMPLETE = request of unknown completion time
>   <p>
>   Boxes are in format 'ctx-id/seqno'.
>   </p>
>   <p>
>   Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
>   </p>
> +</td>
> +</tr>
> +</table>
>   <p>
>   <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
>   <br>
> @@ -975,20 +999,24 @@ sub box_style
>   {
>   	my ($ctx, $stage) = @_;
>   	my $deg;
> +	my $text_col = 'white';
>   
>   	if ($stage eq 'queue') {
>   		$deg = 90;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ready') {
>   		$deg = 45;
>   	} elsif ($stage eq 'execute') {
>   		$deg = 0;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ctxsave') {
>   		$deg = 105;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'incomplete') {
>   		$deg = 0;
>   	}
>   
> -	return 'color: black; background: repeating-linear-gradient(' .
> +	return "color: $text_col; background: repeating-linear-gradient(" .
>   		$deg . 'deg, ' .
>   		ctx_colour($ctx, $stage, 1.0) . ', ' .
>   		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 5/9] trace.pl: Improved key/colours
@ 2018-07-14  0:01         ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-14  0:01 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

On 7/13/2018 2:56 AM, Tvrtko Ursulin wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Improve the timeline legend to show actual context colours.
>
> v2: (Tvrtko Ursulin)
>   * Commit msg.
>   * Tweak layout for more compactness and more readability.
>
> v3:
>   * Limit number of shown contexts in the legend. (John Harrison)
>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>   scripts/trace.pl | 80 ++++++++++++++++++++++++++++++++----------------
>   1 file changed, 54 insertions(+), 26 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index bad5414e11d6..d86eab6b0a8b 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -738,9 +738,46 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
>   	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
>   
>   my $timeline_text = $colour_contexts ?
> -		    'Per context coloured shading like:' : 'Box shading like:';
> +		    'per context coloured shading like' : 'box shading like';
>   
>   my %ctx_colours;
> +my $ctx_table;
> +
> +sub generate_ctx_table
> +{
> +	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
> +	my $max_show = 6;
> +	my (@ctxts, @disp_ctxts);
> +	my $step;
> +
> +	if( $colour_contexts ) {
> +		@ctxts = sort keys %ctxdb;
> +	} else {
> +		@ctxts = ($min_ctx);
> +	}
> +
> +	# Limit number of shown context examples
> +	$step = int(scalar(@ctxts) / $max_show);
> +	if ($step) {
> +		foreach my $i (0..$#ctxts) {
> +			push @disp_ctxts, $ctxts[$i] unless $i % $step;
> +			last if scalar(@disp_ctxts) == $max_show;
> +		}
> +	}
else { @disp_ctxts = @ctxts;} ???

Currently, if step is zero then there is no legend. Otherwise...

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

> +
> +	$ctx_table .= '<table>';
> +
> +	foreach my $ctx (@disp_ctxts) {
> +		$ctx_table .= "<tr>\n";
> +		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
> +		foreach my $state (@states) {
> +			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
> +		}
> +		$ctx_table .= "</tr>\n";
> +	}
> +
> +	$ctx_table .= '</table>';
> +}
>   
>   sub generate_ctx_colours
>   {
> @@ -754,12 +791,7 @@ sub generate_ctx_colours
>   
>   
>   generate_ctx_colours() if $html and $colour_contexts;
> -
> -my $queued_style = box_style($min_ctx, 'queue');
> -my $ready_style = box_style($min_ctx, 'ready');
> -my $execute_style = box_style($min_ctx, 'execute');
> -my $ctxsave_style = box_style($min_ctx, 'ctxsave');
> -my $incomplete_style = box_style($min_ctx, 'incomplete');
> +generate_ctx_table() if $html;
>   
>   print <<ENDHTML if $html;
>   <!DOCTYPE HTML>
> @@ -778,35 +810,27 @@ print <<ENDHTML if $html;
>   </head>
>   <body>
>   <p>
> -<b>Timeline request view:</b>
> +<b>Timeline request view is $timeline_text:</b>
>   <table>
> -<tr><td colspan='4'>$timeline_text</td></tr>
>   <tr>
> -<td align='center'><div style='$queued_style'>QUEUED</div></td>
> -<td align='center'><div style='$ready_style'>READY</div></td>
> -<td align='center'><div style='$execute_style'>EXECUTE</div></td>
> -<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
> -</tr><tr>
> -<td></td>
> -<td></td>
> -<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
> -<td></td>
> -</tr/></table>
> -</p>
> -<p>
> -<small>
> -QUEUED = requests executing on the GPU<br>
> +<td>
> +$ctx_table
> +</td>
> +<td>
> +QUEUE = requests executing on the GPU<br>
>   READY = runnable requests waiting for a slot on GPU<br>
>   EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
>   CTXSAVE = GPU saving the context image<br>
> -</small>
> -</p>
> +INCOMPLETE = request of unknown completion time
>   <p>
>   Boxes are in format 'ctx-id/seqno'.
>   </p>
>   <p>
>   Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
>   </p>
> +</td>
> +</tr>
> +</table>
>   <p>
>   <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
>   <br>
> @@ -975,20 +999,24 @@ sub box_style
>   {
>   	my ($ctx, $stage) = @_;
>   	my $deg;
> +	my $text_col = 'white';
>   
>   	if ($stage eq 'queue') {
>   		$deg = 90;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ready') {
>   		$deg = 45;
>   	} elsif ($stage eq 'execute') {
>   		$deg = 0;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ctxsave') {
>   		$deg = 105;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'incomplete') {
>   		$deg = 0;
>   	}
>   
> -	return 'color: black; background: repeating-linear-gradient(' .
> +	return "color: $text_col; background: repeating-linear-gradient(" .
>   		$deg . 'deg, ' .
>   		ctx_colour($ctx, $stage, 1.0) . ', ' .
>   		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH i-g-t v4 5/9] trace.pl: Improved key/colours
  2018-07-14  0:01         ` [igt-dev] " John Harrison
@ 2018-07-16  8:49           ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-16  8:49 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: John Harrison <John.C.Harrison@Intel.com>

Improve the timeline legend to show actual context colours.

v2: (Tvrtko Ursulin)
 * Commit msg.
 * Tweak layout for more compactness and more readability.

v3:
 * Limit number of shown contexts in the legend. (John Harrison)

v4:
 * Unbreak legend display with small context counts. (John Harrison)

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index bad5414e11d6..43b5fadc3a21 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -738,9 +738,48 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
 my $timeline_text = $colour_contexts ?
-		    'Per context coloured shading like:' : 'Box shading like:';
+		    'per context coloured shading like' : 'box shading like';
 
 my %ctx_colours;
+my $ctx_table;
+
+sub generate_ctx_table
+{
+	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
+	my $max_show = 6;
+	my (@ctxts, @disp_ctxts);
+	my $step;
+
+	if( $colour_contexts ) {
+		@ctxts = sort keys %ctxdb;
+	} else {
+		@ctxts = ($min_ctx);
+	}
+
+	# Limit number of shown context examples
+	$step = int(scalar(@ctxts) / $max_show);
+	if ($step) {
+		foreach my $i (0..$#ctxts) {
+			push @disp_ctxts, $ctxts[$i] unless $i % $step;
+			last if scalar(@disp_ctxts) == $max_show;
+		}
+	} else {
+		@disp_ctxts = @ctxts;
+	}
+
+	$ctx_table .= '<table>';
+
+	foreach my $ctx (@disp_ctxts) {
+		$ctx_table .= "<tr>\n";
+		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
+		foreach my $state (@states) {
+			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
+		}
+		$ctx_table .= "</tr>\n";
+	}
+
+	$ctx_table .= '</table>';
+}
 
 sub generate_ctx_colours
 {
@@ -754,12 +793,7 @@ sub generate_ctx_colours
 
 
 generate_ctx_colours() if $html and $colour_contexts;
-
-my $queued_style = box_style($min_ctx, 'queue');
-my $ready_style = box_style($min_ctx, 'ready');
-my $execute_style = box_style($min_ctx, 'execute');
-my $ctxsave_style = box_style($min_ctx, 'ctxsave');
-my $incomplete_style = box_style($min_ctx, 'incomplete');
+generate_ctx_table() if $html;
 
 print <<ENDHTML if $html;
 <!DOCTYPE HTML>
@@ -778,35 +812,27 @@ print <<ENDHTML if $html;
 </head>
 <body>
 <p>
-<b>Timeline request view:</b>
+<b>Timeline request view is $timeline_text:</b>
 <table>
-<tr><td colspan='4'>$timeline_text</td></tr>
 <tr>
-<td align='center'><div style='$queued_style'>QUEUED</div></td>
-<td align='center'><div style='$ready_style'>READY</div></td>
-<td align='center'><div style='$execute_style'>EXECUTE</div></td>
-<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
-</tr><tr>
-<td></td>
-<td></td>
-<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
-<td></td>
-</tr/></table>
-</p>
-<p>
-<small>
-QUEUED = requests executing on the GPU<br>
+<td>
+$ctx_table
+</td>
+<td>
+QUEUE = requests executing on the GPU<br>
 READY = runnable requests waiting for a slot on GPU<br>
 EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
 CTXSAVE = GPU saving the context image<br>
-</small>
-</p>
+INCOMPLETE = request of unknown completion time
 <p>
 Boxes are in format 'ctx-id/seqno'.
 </p>
 <p>
 Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
 </p>
+</td>
+</tr>
+</table>
 <p>
 <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
 <br>
@@ -975,20 +1001,24 @@ sub box_style
 {
 	my ($ctx, $stage) = @_;
 	my $deg;
+	my $text_col = 'white';
 
 	if ($stage eq 'queue') {
 		$deg = 90;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ready') {
 		$deg = 45;
 	} elsif ($stage eq 'execute') {
 		$deg = 0;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ctxsave') {
 		$deg = 105;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'incomplete') {
 		$deg = 0;
 	}
 
-	return 'color: black; background: repeating-linear-gradient(' .
+	return "color: $text_col; background: repeating-linear-gradient(" .
 		$deg . 'deg, ' .
 		ctx_colour($ctx, $stage, 1.0) . ', ' .
 		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [Intel-gfx] [PATCH i-g-t v4 5/9] trace.pl: Improved key/colours
@ 2018-07-16  8:49           ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-16  8:49 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

From: John Harrison <John.C.Harrison@Intel.com>

Improve the timeline legend to show actual context colours.

v2: (Tvrtko Ursulin)
 * Commit msg.
 * Tweak layout for more compactness and more readability.

v3:
 * Limit number of shown contexts in the legend. (John Harrison)

v4:
 * Unbreak legend display with small context counts. (John Harrison)

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

diff --git a/scripts/trace.pl b/scripts/trace.pl
index bad5414e11d6..43b5fadc3a21 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -738,9 +738,48 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
 my $timeline_text = $colour_contexts ?
-		    'Per context coloured shading like:' : 'Box shading like:';
+		    'per context coloured shading like' : 'box shading like';
 
 my %ctx_colours;
+my $ctx_table;
+
+sub generate_ctx_table
+{
+	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
+	my $max_show = 6;
+	my (@ctxts, @disp_ctxts);
+	my $step;
+
+	if( $colour_contexts ) {
+		@ctxts = sort keys %ctxdb;
+	} else {
+		@ctxts = ($min_ctx);
+	}
+
+	# Limit number of shown context examples
+	$step = int(scalar(@ctxts) / $max_show);
+	if ($step) {
+		foreach my $i (0..$#ctxts) {
+			push @disp_ctxts, $ctxts[$i] unless $i % $step;
+			last if scalar(@disp_ctxts) == $max_show;
+		}
+	} else {
+		@disp_ctxts = @ctxts;
+	}
+
+	$ctx_table .= '<table>';
+
+	foreach my $ctx (@disp_ctxts) {
+		$ctx_table .= "<tr>\n";
+		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
+		foreach my $state (@states) {
+			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
+		}
+		$ctx_table .= "</tr>\n";
+	}
+
+	$ctx_table .= '</table>';
+}
 
 sub generate_ctx_colours
 {
@@ -754,12 +793,7 @@ sub generate_ctx_colours
 
 
 generate_ctx_colours() if $html and $colour_contexts;
-
-my $queued_style = box_style($min_ctx, 'queue');
-my $ready_style = box_style($min_ctx, 'ready');
-my $execute_style = box_style($min_ctx, 'execute');
-my $ctxsave_style = box_style($min_ctx, 'ctxsave');
-my $incomplete_style = box_style($min_ctx, 'incomplete');
+generate_ctx_table() if $html;
 
 print <<ENDHTML if $html;
 <!DOCTYPE HTML>
@@ -778,35 +812,27 @@ print <<ENDHTML if $html;
 </head>
 <body>
 <p>
-<b>Timeline request view:</b>
+<b>Timeline request view is $timeline_text:</b>
 <table>
-<tr><td colspan='4'>$timeline_text</td></tr>
 <tr>
-<td align='center'><div style='$queued_style'>QUEUED</div></td>
-<td align='center'><div style='$ready_style'>READY</div></td>
-<td align='center'><div style='$execute_style'>EXECUTE</div></td>
-<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
-</tr><tr>
-<td></td>
-<td></td>
-<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
-<td></td>
-</tr/></table>
-</p>
-<p>
-<small>
-QUEUED = requests executing on the GPU<br>
+<td>
+$ctx_table
+</td>
+<td>
+QUEUE = requests executing on the GPU<br>
 READY = runnable requests waiting for a slot on GPU<br>
 EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
 CTXSAVE = GPU saving the context image<br>
-</small>
-</p>
+INCOMPLETE = request of unknown completion time
 <p>
 Boxes are in format 'ctx-id/seqno'.
 </p>
 <p>
 Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
 </p>
+</td>
+</tr>
+</table>
 <p>
 <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
 <br>
@@ -975,20 +1001,24 @@ sub box_style
 {
 	my ($ctx, $stage) = @_;
 	my $deg;
+	my $text_col = 'white';
 
 	if ($stage eq 'queue') {
 		$deg = 90;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ready') {
 		$deg = 45;
 	} elsif ($stage eq 'execute') {
 		$deg = 0;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'ctxsave') {
 		$deg = 105;
+		$text_col = 'black' if $colour_contexts;
 	} elsif ($stage eq 'incomplete') {
 		$deg = 0;
 	}
 
-	return 'color: black; background: repeating-linear-gradient(' .
+	return "color: $text_col; background: repeating-linear-gradient(" .
 		$deg . 'deg, ' .
 		ctx_colour($ctx, $stage, 1.0) . ', ' .
 		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for trace.pl fixes and improvements (rev7)
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
                   ` (13 preceding siblings ...)
  (?)
@ 2018-07-16 10:03 ` Patchwork
  -1 siblings, 0 replies; 70+ messages in thread
From: Patchwork @ 2018-07-16 10:03 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev

== Series Details ==

Series: trace.pl fixes and improvements (rev7)
URL   : https://patchwork.freedesktop.org/series/46177/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4488 -> IGTPW_1592 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46177/revisions/7/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1592 that come from known issues:

  === IGT changes ===

    ==== Possible fixes ====

    igt@debugfs_test@read_all_entries:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@kms_chamelium@hdmi-hpd-fast:
      fi-kbl-7500u:       FAIL (fdo#103841, fdo#102672) -> SKIP

    
  fdo#102672 https://bugs.freedesktop.org/show_bug.cgi?id=102672
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841


== Participating hosts (46 -> 40) ==

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-byt-squawks fi-bsw-cyan fi-skl-6700hq 


== Build changes ==

    * IGT: IGT_4557 -> IGTPW_1592

  CI_DRM_4488: a3a527faf129e7901fdff5309a7e6df8abd72d13 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1592: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1592/
  IGT_4557: 140a67c13aad2595ee6c72e41d14d35a793158b5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1592/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [igt-dev] ✗ Fi.CI.IGT: failure for trace.pl fixes and improvements (rev7)
  2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
                   ` (14 preceding siblings ...)
  (?)
@ 2018-07-16 16:41 ` Patchwork
  -1 siblings, 0 replies; 70+ messages in thread
From: Patchwork @ 2018-07-16 16:41 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev

== Series Details ==

Series: trace.pl fixes and improvements (rev7)
URL   : https://patchwork.freedesktop.org/series/46177/
State : failure

== Summary ==

= CI Bug Log - changes from IGT_4557_full -> IGTPW_1592_full =

== Summary - FAILURE ==

  Serious unknown changes coming with IGTPW_1592_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1592_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46177/revisions/7/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1592_full:

  === IGT changes ===

    ==== Possible regressions ====

    igt@gem_reg_read@timestamp-monotonic:
      shard-snb:          PASS -> DMESG-WARN

    igt@kms_vblank@pipe-a-wait-busy-hang:
      shard-snb:          PASS -> FAIL

    
    ==== Warnings ====

    igt@gem_busy@busy-render:
      shard-snb:          PASS -> SKIP +11

    igt@gem_exec_schedule@deep-bsd2:
      shard-kbl:          PASS -> SKIP +3

    igt@gem_mocs_settings@mocs-rc6-vebox:
      shard-kbl:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_1592_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@shrink:
      shard-snb:          PASS -> FAIL (fdo#106886)

    igt@kms_cursor_legacy@cursora-vs-flipa-toggle:
      shard-glk:          PASS -> DMESG-WARN (fdo#105763)

    igt@kms_fbcon_fbt@fbc:
      shard-glk:          PASS -> FAIL (fdo#103833, fdo#105681)

    igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-pwrite:
      shard-snb:          NOTRUN -> DMESG-FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-indfb-draw-mmap-cpu:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_rotation_crc@sprite-rotation-180:
      shard-snb:          PASS -> FAIL (fdo#103925)

    igt@kms_universal_plane@cursor-fb-leak-pipe-c:
      shard-apl:          PASS -> FAIL (fdo#107241)

    
    ==== Possible fixes ====

    {igt@gem_userptr_blits@readonly-mmap-unsync}:
      shard-snb:          INCOMPLETE (fdo#105411) -> SKIP

    igt@kms_flip@2x-plain-flip-ts-check-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
      shard-glk:          FAIL (fdo#103375) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
  fdo#103833 https://bugs.freedesktop.org/show_bug.cgi?id=103833
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105681 https://bugs.freedesktop.org/show_bug.cgi?id=105681
  fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
  fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
  fdo#107241 https://bugs.freedesktop.org/show_bug.cgi?id=107241


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4557 -> IGTPW_1592
    * Linux: CI_DRM_4487 -> CI_DRM_4488

  CI_DRM_4487: 627ed020cac6a73f0a014537dac7191efbb57084 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4488: a3a527faf129e7901fdff5309a7e6df8abd72d13 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1592: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1592/
  IGT_4557: 140a67c13aad2595ee6c72e41d14d35a793158b5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1592/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
  2018-07-13  9:55         ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-16 17:53           ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-16 17:53 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 2697 bytes --]

On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> 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 <tvrtko.ursulin@intel.com>
> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> ---
>   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'};
>   

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?

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.

Either way, I can't spot anything in this patch that could cause a 
random offset. So...

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




[-- Attachment #1.2: Type: text/html, Size: 3478 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
@ 2018-07-16 17:53           ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-16 17:53 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 2697 bytes --]

On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> 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 <tvrtko.ursulin@intel.com>
> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> ---
>   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'};
>   

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?

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.

Either way, I can't spot anything in this patch that could cause a 
random offset. So...

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




[-- Attachment #1.2: Type: text/html, Size: 3478 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t v3 2/9] trace.pl: Scale timeline for better precision
  2018-07-13 10:02     ` [igt-dev] " Tvrtko Ursulin
@ 2018-07-16 18:15       ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-16 18:15 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 3206 bytes --]

On 7/13/2018 3:02 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.
>
> v2: Rebase for time axis changes.
> v3: Another tweak for time axis changes.
>
> 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>
> Reviewed-by: John Harrison <John.C.Harrison@Intel.com> # v2
> ---
>   scripts/trace.pl | 54 ++++++++++++++++++++++++++++++++++++++++++++----
>   1 file changed, 50 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 41f10749a153..4b5f4ef77aef 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 ($y, $mo, $d, $h, $m, $s);
>   
> +	$us *= 1000 unless $no_timeline_scaling;
> +
>   	$s = int($us / 1000000);
>   	$us = $us % 1000000;
>   
> @@ -999,11 +1015,28 @@ $first_ts = ts($first_ts);
>   
>   print <<ENDHTML;
>     ]);
> +ENDHTML
>   
> +if ($html) {
> +	if ($no_timeline_scaling) {
> +		say "  timeDiv = 1;";
> +	} else {
> +		say "  timeDiv = 1000;";
> +	}
> +}
> +
> +print <<ENDHTML;
>     function majorAxis(date, scale, step) {
> -	var s = date / 1000;
> +	var s = date / 1000 / timeDiv;
>   	var precision;
>   
> +	if (timeDiv == 1000) {
> +		if (scale == 'second')
> +			scale = 'millisecond';
> +		else if (scale == 'minute')
> +			scale = 'second'
> +	}
> +
>   	if (scale == 'millisecond')
>   		precision = 6;
>   	else if (scale == 'second')
> @@ -1015,14 +1048,27 @@ print <<ENDHTML;
>     }
>   
>     function minorAxis(date, scale, step) {
> -	var ms = date;
> +	var ms = date / timeDiv;
> +	var orig_scale = scale;
>   	var precision;
>   	var unit;
>   
> +	if (timeDiv == 1000) {
> +		if (scale == 'second')
> +			scale = 'millisecond';
> +		else if (scale == 'minute')
> +			scale = 'second'
> +	}
> +
>   	if (scale == 'millisecond') {
> -		ms %= 1000;
>   		precision = 0;
> -		unit = 'ms';
> +		if (orig_scale == 'millisecond' && step <= 200) {
> +			ms = date % 1000;
> +			unit = 'us';
> +		} else {
> +			ms %= 1000;
> +			unit = 'ms';
> +		}
>   	} else if (scale == 'second') {
>   		ms /= 1000;
>   		precision = 1;

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



[-- Attachment #1.2: Type: text/html, Size: 4162 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 2/9] trace.pl: Scale timeline for better precision
@ 2018-07-16 18:15       ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-16 18:15 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin


[-- Attachment #1.1: Type: text/plain, Size: 3206 bytes --]

On 7/13/2018 3:02 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.
>
> v2: Rebase for time axis changes.
> v3: Another tweak for time axis changes.
>
> 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>
> Reviewed-by: John Harrison <John.C.Harrison@Intel.com> # v2
> ---
>   scripts/trace.pl | 54 ++++++++++++++++++++++++++++++++++++++++++++----
>   1 file changed, 50 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 41f10749a153..4b5f4ef77aef 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 ($y, $mo, $d, $h, $m, $s);
>   
> +	$us *= 1000 unless $no_timeline_scaling;
> +
>   	$s = int($us / 1000000);
>   	$us = $us % 1000000;
>   
> @@ -999,11 +1015,28 @@ $first_ts = ts($first_ts);
>   
>   print <<ENDHTML;
>     ]);
> +ENDHTML
>   
> +if ($html) {
> +	if ($no_timeline_scaling) {
> +		say "  timeDiv = 1;";
> +	} else {
> +		say "  timeDiv = 1000;";
> +	}
> +}
> +
> +print <<ENDHTML;
>     function majorAxis(date, scale, step) {
> -	var s = date / 1000;
> +	var s = date / 1000 / timeDiv;
>   	var precision;
>   
> +	if (timeDiv == 1000) {
> +		if (scale == 'second')
> +			scale = 'millisecond';
> +		else if (scale == 'minute')
> +			scale = 'second'
> +	}
> +
>   	if (scale == 'millisecond')
>   		precision = 6;
>   	else if (scale == 'second')
> @@ -1015,14 +1048,27 @@ print <<ENDHTML;
>     }
>   
>     function minorAxis(date, scale, step) {
> -	var ms = date;
> +	var ms = date / timeDiv;
> +	var orig_scale = scale;
>   	var precision;
>   	var unit;
>   
> +	if (timeDiv == 1000) {
> +		if (scale == 'second')
> +			scale = 'millisecond';
> +		else if (scale == 'minute')
> +			scale = 'second'
> +	}
> +
>   	if (scale == 'millisecond') {
> -		ms %= 1000;
>   		precision = 0;
> -		unit = 'ms';
> +		if (orig_scale == 'millisecond' && step <= 200) {
> +			ms = date % 1000;
> +			unit = 'us';
> +		} else {
> +			ms %= 1000;
> +			unit = 'ms';
> +		}
>   	} else if (scale == 'second') {
>   		ms /= 1000;
>   		precision = 1;

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



[-- Attachment #1.2: Type: text/html, Size: 4162 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH i-g-t v4 5/9] trace.pl: Improved key/colours
  2018-07-16  8:49           ` [Intel-gfx] " Tvrtko Ursulin
@ 2018-07-16 19:11             ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-16 19:11 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 5135 bytes --]

On 7/16/2018 1:49 AM, Tvrtko Ursulin wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Improve the timeline legend to show actual context colours.
>
> v2: (Tvrtko Ursulin)
>   * Commit msg.
>   * Tweak layout for more compactness and more readability.
>
> v3:
>   * Limit number of shown contexts in the legend. (John Harrison)
>
> v4:
>   * Unbreak legend display with small context counts. (John Harrison)
>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>   scripts/trace.pl | 82 +++++++++++++++++++++++++++++++++---------------
>   1 file changed, 56 insertions(+), 26 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index bad5414e11d6..43b5fadc3a21 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -738,9 +738,48 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
>   	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
>   
>   my $timeline_text = $colour_contexts ?
> -		    'Per context coloured shading like:' : 'Box shading like:';
> +		    'per context coloured shading like' : 'box shading like';
>   
>   my %ctx_colours;
> +my $ctx_table;
> +
> +sub generate_ctx_table
> +{
> +	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
> +	my $max_show = 6;
> +	my (@ctxts, @disp_ctxts);
> +	my $step;
> +
> +	if( $colour_contexts ) {
> +		@ctxts = sort keys %ctxdb;
> +	} else {
> +		@ctxts = ($min_ctx);
> +	}
> +
> +	# Limit number of shown context examples
> +	$step = int(scalar(@ctxts) / $max_show);
> +	if ($step) {
> +		foreach my $i (0..$#ctxts) {
> +			push @disp_ctxts, $ctxts[$i] unless $i % $step;
> +			last if scalar(@disp_ctxts) == $max_show;
> +		}
> +	} else {
> +		@disp_ctxts = @ctxts;
> +	}
> +
> +	$ctx_table .= '<table>';
> +
> +	foreach my $ctx (@disp_ctxts) {
> +		$ctx_table .= "<tr>\n";
> +		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
> +		foreach my $state (@states) {
> +			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
> +		}
> +		$ctx_table .= "</tr>\n";
> +	}
> +
> +	$ctx_table .= '</table>';
> +}
>   
>   sub generate_ctx_colours
>   {
> @@ -754,12 +793,7 @@ sub generate_ctx_colours
>   
>   
>   generate_ctx_colours() if $html and $colour_contexts;
> -
> -my $queued_style = box_style($min_ctx, 'queue');
> -my $ready_style = box_style($min_ctx, 'ready');
> -my $execute_style = box_style($min_ctx, 'execute');
> -my $ctxsave_style = box_style($min_ctx, 'ctxsave');
> -my $incomplete_style = box_style($min_ctx, 'incomplete');
> +generate_ctx_table() if $html;
>   
>   print <<ENDHTML if $html;
>   <!DOCTYPE HTML>
> @@ -778,35 +812,27 @@ print <<ENDHTML if $html;
>   </head>
>   <body>
>   <p>
> -<b>Timeline request view:</b>
> +<b>Timeline request view is $timeline_text:</b>
>   <table>
> -<tr><td colspan='4'>$timeline_text</td></tr>
>   <tr>
> -<td align='center'><div style='$queued_style'>QUEUED</div></td>
> -<td align='center'><div style='$ready_style'>READY</div></td>
> -<td align='center'><div style='$execute_style'>EXECUTE</div></td>
> -<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
> -</tr><tr>
> -<td></td>
> -<td></td>
> -<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
> -<td></td>
> -</tr/></table>
> -</p>
> -<p>
> -<small>
> -QUEUED = requests executing on the GPU<br>
> +<td>
> +$ctx_table
> +</td>
> +<td>
> +QUEUE = requests executing on the GPU<br>
>   READY = runnable requests waiting for a slot on GPU<br>
>   EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
>   CTXSAVE = GPU saving the context image<br>
> -</small>
> -</p>
> +INCOMPLETE = request of unknown completion time
>   <p>
>   Boxes are in format 'ctx-id/seqno'.
>   </p>
>   <p>
>   Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
>   </p>
> +</td>
> +</tr>
> +</table>
>   <p>
>   <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
>   <br>
> @@ -975,20 +1001,24 @@ sub box_style
>   {
>   	my ($ctx, $stage) = @_;
>   	my $deg;
> +	my $text_col = 'white';
>   
>   	if ($stage eq 'queue') {
>   		$deg = 90;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ready') {
>   		$deg = 45;
>   	} elsif ($stage eq 'execute') {
>   		$deg = 0;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ctxsave') {
>   		$deg = 105;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'incomplete') {
>   		$deg = 0;
>   	}
>   
> -	return 'color: black; background: repeating-linear-gradient(' .
> +	return "color: $text_col; background: repeating-linear-gradient(" .
>   		$deg . 'deg, ' .
>   		ctx_colour($ctx, $stage, 1.0) . ', ' .
>   		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .

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


[-- Attachment #1.2: Type: text/html, Size: 6160 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v4 5/9] trace.pl: Improved key/colours
@ 2018-07-16 19:11             ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-16 19:11 UTC (permalink / raw)
  To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin


[-- Attachment #1.1: Type: text/plain, Size: 5135 bytes --]

On 7/16/2018 1:49 AM, Tvrtko Ursulin wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Improve the timeline legend to show actual context colours.
>
> v2: (Tvrtko Ursulin)
>   * Commit msg.
>   * Tweak layout for more compactness and more readability.
>
> v3:
>   * Limit number of shown contexts in the legend. (John Harrison)
>
> v4:
>   * Unbreak legend display with small context counts. (John Harrison)
>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>   scripts/trace.pl | 82 +++++++++++++++++++++++++++++++++---------------
>   1 file changed, 56 insertions(+), 26 deletions(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index bad5414e11d6..43b5fadc3a21 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -738,9 +738,48 @@ say sprintf('GPU: %.2f%% idle, %.2f%% busy',
>   	     $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
>   
>   my $timeline_text = $colour_contexts ?
> -		    'Per context coloured shading like:' : 'Box shading like:';
> +		    'per context coloured shading like' : 'box shading like';
>   
>   my %ctx_colours;
> +my $ctx_table;
> +
> +sub generate_ctx_table
> +{
> +	my @states = ('queue', 'ready', 'execute', 'ctxsave', 'incomplete');
> +	my $max_show = 6;
> +	my (@ctxts, @disp_ctxts);
> +	my $step;
> +
> +	if( $colour_contexts ) {
> +		@ctxts = sort keys %ctxdb;
> +	} else {
> +		@ctxts = ($min_ctx);
> +	}
> +
> +	# Limit number of shown context examples
> +	$step = int(scalar(@ctxts) / $max_show);
> +	if ($step) {
> +		foreach my $i (0..$#ctxts) {
> +			push @disp_ctxts, $ctxts[$i] unless $i % $step;
> +			last if scalar(@disp_ctxts) == $max_show;
> +		}
> +	} else {
> +		@disp_ctxts = @ctxts;
> +	}
> +
> +	$ctx_table .= '<table>';
> +
> +	foreach my $ctx (@disp_ctxts) {
> +		$ctx_table .= "<tr>\n";
> +		$ctx_table .= "  <td>Context $ctx</td>\n" if $colour_contexts;
> +		foreach my $state (@states) {
> +			$ctx_table .= "  <td align='center' valign='middle'><div style='" . box_style($ctx, $state) . " padding-top: 6px; padding-bottom: 6px; padding-left: 6x; padding-right: 6px;'>" . uc($state) . "</div></td>\n";
> +		}
> +		$ctx_table .= "</tr>\n";
> +	}
> +
> +	$ctx_table .= '</table>';
> +}
>   
>   sub generate_ctx_colours
>   {
> @@ -754,12 +793,7 @@ sub generate_ctx_colours
>   
>   
>   generate_ctx_colours() if $html and $colour_contexts;
> -
> -my $queued_style = box_style($min_ctx, 'queue');
> -my $ready_style = box_style($min_ctx, 'ready');
> -my $execute_style = box_style($min_ctx, 'execute');
> -my $ctxsave_style = box_style($min_ctx, 'ctxsave');
> -my $incomplete_style = box_style($min_ctx, 'incomplete');
> +generate_ctx_table() if $html;
>   
>   print <<ENDHTML if $html;
>   <!DOCTYPE HTML>
> @@ -778,35 +812,27 @@ print <<ENDHTML if $html;
>   </head>
>   <body>
>   <p>
> -<b>Timeline request view:</b>
> +<b>Timeline request view is $timeline_text:</b>
>   <table>
> -<tr><td colspan='4'>$timeline_text</td></tr>
>   <tr>
> -<td align='center'><div style='$queued_style'>QUEUED</div></td>
> -<td align='center'><div style='$ready_style'>READY</div></td>
> -<td align='center'><div style='$execute_style'>EXECUTE</div></td>
> -<td align='center'><div style='$ctxsave_style'>CTXSAVE</div></td>
> -</tr><tr>
> -<td></td>
> -<td></td>
> -<td align='center'><div style='$incomplete_style'>(INCOMPLETE)</div></td>
> -<td></td>
> -</tr/></table>
> -</p>
> -<p>
> -<small>
> -QUEUED = requests executing on the GPU<br>
> +<td>
> +$ctx_table
> +</td>
> +<td>
> +QUEUE = requests executing on the GPU<br>
>   READY = runnable requests waiting for a slot on GPU<br>
>   EXECUTE = requests waiting on fences and dependencies before they are runnable<br>
>   CTXSAVE = GPU saving the context image<br>
> -</small>
> -</p>
> +INCOMPLETE = request of unknown completion time
>   <p>
>   Boxes are in format 'ctx-id/seqno'.
>   </p>
>   <p>
>   Use Ctrl+scroll-action to zoom-in/out and scroll-action or dragging to move around the timeline.
>   </p>
> +</td>
> +</tr>
> +</table>
>   <p>
>   <b>GPU idle: $flat_busy{'gpu-idle'}%</b>
>   <br>
> @@ -975,20 +1001,24 @@ sub box_style
>   {
>   	my ($ctx, $stage) = @_;
>   	my $deg;
> +	my $text_col = 'white';
>   
>   	if ($stage eq 'queue') {
>   		$deg = 90;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ready') {
>   		$deg = 45;
>   	} elsif ($stage eq 'execute') {
>   		$deg = 0;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'ctxsave') {
>   		$deg = 105;
> +		$text_col = 'black' if $colour_contexts;
>   	} elsif ($stage eq 'incomplete') {
>   		$deg = 0;
>   	}
>   
> -	return 'color: black; background: repeating-linear-gradient(' .
> +	return "color: $text_col; background: repeating-linear-gradient(" .
>   		$deg . 'deg, ' .
>   		ctx_colour($ctx, $stage, 1.0) . ', ' .
>   		ctx_colour($ctx, $stage, 1.0) . ' 10px, ' .

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


[-- Attachment #1.2: Type: text/html, Size: 6160 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
  2018-07-16 17:53           ` [Intel-gfx] " John Harrison
@ 2018-07-17  8:56             ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-17  8:56 UTC (permalink / raw)
  To: John Harrison, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


On 16/07/2018 18:53, John Harrison wrote:
> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>
>> 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<tvrtko.ursulin@intel.com>
>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>> Cc: John Harrison<John.C.Harrison@Intel.com>
>> ---
>>   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'};
>>   
> 
> 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?
> 
> 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.
> 
> Either way, I can't spot anything in this patch that could cause a 
> random offset. So...

Yeah, I can see that now that I tried in Firefox. I was using Chromium 
so far and there timestamps are exactly matching the ones from the 
tracepoint log. Which is what we want for easy correlation between the 
log and HTML..

Firefox corrupts that somehow by applying the large negative offset to 
everyhting. Perhaps around two year worth of negative seconds if my 
rough calculation can be trusted. Or Vis under Firefox, I wouldn't know 
really who is to blame.

I have no idea what to do here. :(

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
@ 2018-07-17  8:56             ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-17  8:56 UTC (permalink / raw)
  To: John Harrison, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


On 16/07/2018 18:53, John Harrison wrote:
> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>
>> 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<tvrtko.ursulin@intel.com>
>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>> Cc: John Harrison<John.C.Harrison@Intel.com>
>> ---
>>   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'};
>>   
> 
> 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?
> 
> 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.
> 
> Either way, I can't spot anything in this patch that could cause a 
> random offset. So...

Yeah, I can see that now that I tried in Firefox. I was using Chromium 
so far and there timestamps are exactly matching the ones from the 
tracepoint log. Which is what we want for easy correlation between the 
log and HTML..

Firefox corrupts that somehow by applying the large negative offset to 
everyhting. Perhaps around two year worth of negative seconds if my 
rough calculation can be trusted. Or Vis under Firefox, I wouldn't know 
really who is to blame.

I have no idea what to do here. :(

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
  2018-07-17  8:56             ` [Intel-gfx] " Tvrtko Ursulin
@ 2018-07-17 15:11               ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-17 15:11 UTC (permalink / raw)
  To: Tvrtko Ursulin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx

On 7/17/2018 1:56 AM, Tvrtko Ursulin wrote:
>
> On 16/07/2018 18:53, John Harrison wrote:
>> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>>
>>> 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<tvrtko.ursulin@intel.com>
>>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>>> Cc: John Harrison<John.C.Harrison@Intel.com>
>>> ---
>>>   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'};
>>
>> 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?
>>
>> 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.
>>
>> Either way, I can't spot anything in this patch that could cause a 
>> random offset. So...
>
> Yeah, I can see that now that I tried in Firefox. I was using Chromium 
> so far and there timestamps are exactly matching the ones from the 
> tracepoint log. Which is what we want for easy correlation between the 
> log and HTML..
>
> Firefox corrupts that somehow by applying the large negative offset to 
> everyhting. Perhaps around two year worth of negative seconds if my 
> rough calculation can be trusted. Or Vis under Firefox, I wouldn't 
> know really who is to blame.
>
> I have no idea what to do here. :(
>
> Regards,
>
> Tvrtko

I think ship it for now. It is better than it was. Certainly reporting 
in date format is vaguely meaningless at best and totally meaningless 
with the x1000 scale factor.

Note that chromium on Ubuntu 16.04 does the same as Chrome on Windows 
for me - 28.8 seconds offset. It's not as bad as the 1.9 years of 
Firefox but it is still out :(. I'm guessing it is a bug in the date -> 
absolute seconds conversion going on within either Javascript itself or 
Vis in particular. The timestamps are still encoded as dates in the HTML 
file (and referenced from 0 not from 1900 or 1970 or whatever). So any 
difference in calculating leap years between the Perl script and the 
browser would potentially cause quite a significant delta.

Is it at all possible to put absolute seconds style values in the HTML 
file instead of dates? That would seem like the obvious answer. I don't 
know if Vis would cope with that, though?

John.

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
@ 2018-07-17 15:11               ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-17 15:11 UTC (permalink / raw)
  To: Tvrtko Ursulin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

On 7/17/2018 1:56 AM, Tvrtko Ursulin wrote:
>
> On 16/07/2018 18:53, John Harrison wrote:
>> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>>
>>> 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<tvrtko.ursulin@intel.com>
>>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>>> Cc: John Harrison<John.C.Harrison@Intel.com>
>>> ---
>>>   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'};
>>
>> 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?
>>
>> 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.
>>
>> Either way, I can't spot anything in this patch that could cause a 
>> random offset. So...
>
> Yeah, I can see that now that I tried in Firefox. I was using Chromium 
> so far and there timestamps are exactly matching the ones from the 
> tracepoint log. Which is what we want for easy correlation between the 
> log and HTML..
>
> Firefox corrupts that somehow by applying the large negative offset to 
> everyhting. Perhaps around two year worth of negative seconds if my 
> rough calculation can be trusted. Or Vis under Firefox, I wouldn't 
> know really who is to blame.
>
> I have no idea what to do here. :(
>
> Regards,
>
> Tvrtko

I think ship it for now. It is better than it was. Certainly reporting 
in date format is vaguely meaningless at best and totally meaningless 
with the x1000 scale factor.

Note that chromium on Ubuntu 16.04 does the same as Chrome on Windows 
for me - 28.8 seconds offset. It's not as bad as the 1.9 years of 
Firefox but it is still out :(. I'm guessing it is a bug in the date -> 
absolute seconds conversion going on within either Javascript itself or 
Vis in particular. The timestamps are still encoded as dates in the HTML 
file (and referenced from 0 not from 1900 or 1970 or whatever). So any 
difference in calculating leap years between the Perl script and the 
browser would potentially cause quite a significant delta.

Is it at all possible to put absolute seconds style values in the HTML 
file instead of dates? That would seem like the obvious answer. I don't 
know if Vis would cope with that, though?

John.

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
  2018-07-17 15:11               ` John Harrison
@ 2018-07-17 15:31                 ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-17 15:31 UTC (permalink / raw)
  To: Tvrtko Ursulin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx

On 7/17/2018 8:11 AM, John Harrison wrote:
> On 7/17/2018 1:56 AM, Tvrtko Ursulin wrote:
>>
>> On 16/07/2018 18:53, John Harrison wrote:
>>> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>>>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>>>
>>>> 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<tvrtko.ursulin@intel.com>
>>>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>>>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>>>> Cc: John Harrison<John.C.Harrison@Intel.com>
>>>> ---
>>>>   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'};
>>>
>>> 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?
>>>
>>> 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.
>>>
>>> Either way, I can't spot anything in this patch that could cause a 
>>> random offset. So...
>>
>> Yeah, I can see that now that I tried in Firefox. I was using 
>> Chromium so far and there timestamps are exactly matching the ones 
>> from the tracepoint log. Which is what we want for easy correlation 
>> between the log and HTML..
>>
>> Firefox corrupts that somehow by applying the large negative offset 
>> to everyhting. Perhaps around two year worth of negative seconds if 
>> my rough calculation can be trusted. Or Vis under Firefox, I wouldn't 
>> know really who is to blame.
>>
>> I have no idea what to do here. :(
>>
>> Regards,
>>
>> Tvrtko
>
> I think ship it for now. It is better than it was. Certainly reporting 
> in date format is vaguely meaningless at best and totally meaningless 
> with the x1000 scale factor.
>
> Note that chromium on Ubuntu 16.04 does the same as Chrome on Windows 
> for me - 28.8 seconds offset. It's not as bad as the 1.9 years of 
> Firefox but it is still out :(. I'm guessing it is a bug in the date 
> -> absolute seconds conversion going on within either Javascript 
> itself or Vis in particular. The timestamps are still encoded as dates 
> in the HTML file (and referenced from 0 not from 1900 or 1970 or 
> whatever). So any difference in calculating leap years between the 
> Perl script and the browser would potentially cause quite a 
> significant delta.
>
> Is it at all possible to put absolute seconds style values in the HTML 
> file instead of dates? That would seem like the obvious answer. I 
> don't know if Vis would cope with that, though?
>
> John.
>

Hmm. It looks like if I change the 'ts()' function to use 'localtime()' 
instead of 'gmtime()' and to add on 1900 to the year then it all works 
fine for me :). So yes, I think it is some incompatibility between the 
Perl and Javascript implementations of date <-> absolute seconds 
conversions. Given that the timestamp is no longer being reported as an 
actual date anymore, the relative value doesn't really matter. So I 
would go with using whatever scheme produces the least mutation along 
the way!

I wonder if you see the correct values on Chrome because your logs have 
smaller timestamps? The ones I am currently testing with are of the 
order of 856985.688681. With the above tweaks, that comes out as a date 
of '1997-02-26 11:34:48.681000'. The 'gmtime' version was '1997-02-26 
19:34:48.681000' and obviously the non-1900 version was '0097-02-26 
19:34:48.681000'. Actually, maybe the Chrome difference is because you 
are in the UK and don't have a timezone delta? Although I would assume 
you are on BST not GMT right now?

John.

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
@ 2018-07-17 15:31                 ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-17 15:31 UTC (permalink / raw)
  To: Tvrtko Ursulin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

On 7/17/2018 8:11 AM, John Harrison wrote:
> On 7/17/2018 1:56 AM, Tvrtko Ursulin wrote:
>>
>> On 16/07/2018 18:53, John Harrison wrote:
>>> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>>>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>>>
>>>> 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<tvrtko.ursulin@intel.com>
>>>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>>>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>>>> Cc: John Harrison<John.C.Harrison@Intel.com>
>>>> ---
>>>>   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'};
>>>
>>> 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?
>>>
>>> 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.
>>>
>>> Either way, I can't spot anything in this patch that could cause a 
>>> random offset. So...
>>
>> Yeah, I can see that now that I tried in Firefox. I was using 
>> Chromium so far and there timestamps are exactly matching the ones 
>> from the tracepoint log. Which is what we want for easy correlation 
>> between the log and HTML..
>>
>> Firefox corrupts that somehow by applying the large negative offset 
>> to everyhting. Perhaps around two year worth of negative seconds if 
>> my rough calculation can be trusted. Or Vis under Firefox, I wouldn't 
>> know really who is to blame.
>>
>> I have no idea what to do here. :(
>>
>> Regards,
>>
>> Tvrtko
>
> I think ship it for now. It is better than it was. Certainly reporting 
> in date format is vaguely meaningless at best and totally meaningless 
> with the x1000 scale factor.
>
> Note that chromium on Ubuntu 16.04 does the same as Chrome on Windows 
> for me - 28.8 seconds offset. It's not as bad as the 1.9 years of 
> Firefox but it is still out :(. I'm guessing it is a bug in the date 
> -> absolute seconds conversion going on within either Javascript 
> itself or Vis in particular. The timestamps are still encoded as dates 
> in the HTML file (and referenced from 0 not from 1900 or 1970 or 
> whatever). So any difference in calculating leap years between the 
> Perl script and the browser would potentially cause quite a 
> significant delta.
>
> Is it at all possible to put absolute seconds style values in the HTML 
> file instead of dates? That would seem like the obvious answer. I 
> don't know if Vis would cope with that, though?
>
> John.
>

Hmm. It looks like if I change the 'ts()' function to use 'localtime()' 
instead of 'gmtime()' and to add on 1900 to the year then it all works 
fine for me :). So yes, I think it is some incompatibility between the 
Perl and Javascript implementations of date <-> absolute seconds 
conversions. Given that the timestamp is no longer being reported as an 
actual date anymore, the relative value doesn't really matter. So I 
would go with using whatever scheme produces the least mutation along 
the way!

I wonder if you see the correct values on Chrome because your logs have 
smaller timestamps? The ones I am currently testing with are of the 
order of 856985.688681. With the above tweaks, that comes out as a date 
of '1997-02-26 11:34:48.681000'. The 'gmtime' version was '1997-02-26 
19:34:48.681000' and obviously the non-1900 version was '0097-02-26 
19:34:48.681000'. Actually, maybe the Chrome difference is because you 
are in the UK and don't have a timezone delta? Although I would assume 
you are on BST not GMT right now?

John.

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
  2018-07-17 15:31                 ` John Harrison
@ 2018-07-17 16:22                   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-17 16:22 UTC (permalink / raw)
  To: John Harrison, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx


On 17/07/18 16:31, John Harrison wrote:
> On 7/17/2018 8:11 AM, John Harrison wrote:
>> On 7/17/2018 1:56 AM, Tvrtko Ursulin wrote:
>>>
>>> On 16/07/2018 18:53, John Harrison wrote:
>>>> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>>>>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>>>>
>>>>> 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<tvrtko.ursulin@intel.com>
>>>>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>>>>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>>>>> Cc: John Harrison<John.C.Harrison@Intel.com>
>>>>> ---
>>>>>   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'};
>>>>
>>>> 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?
>>>>
>>>> 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.
>>>>
>>>> Either way, I can't spot anything in this patch that could cause a 
>>>> random offset. So...
>>>
>>> Yeah, I can see that now that I tried in Firefox. I was using 
>>> Chromium so far and there timestamps are exactly matching the ones 
>>> from the tracepoint log. Which is what we want for easy correlation 
>>> between the log and HTML..
>>>
>>> Firefox corrupts that somehow by applying the large negative offset 
>>> to everyhting. Perhaps around two year worth of negative seconds if 
>>> my rough calculation can be trusted. Or Vis under Firefox, I wouldn't 
>>> know really who is to blame.
>>>
>>> I have no idea what to do here. :(
>>>
>>> Regards,
>>>
>>> Tvrtko
>>
>> I think ship it for now. It is better than it was. Certainly reporting 
>> in date format is vaguely meaningless at best and totally meaningless 
>> with the x1000 scale factor.
>>
>> Note that chromium on Ubuntu 16.04 does the same as Chrome on Windows 
>> for me - 28.8 seconds offset. It's not as bad as the 1.9 years of 
>> Firefox but it is still out :(. I'm guessing it is a bug in the date 
>> -> absolute seconds conversion going on within either Javascript 
>> itself or Vis in particular. The timestamps are still encoded as dates 
>> in the HTML file (and referenced from 0 not from 1900 or 1970 or 
>> whatever). So any difference in calculating leap years between the 
>> Perl script and the browser would potentially cause quite a 
>> significant delta.
>>
>> Is it at all possible to put absolute seconds style values in the HTML 
>> file instead of dates? That would seem like the obvious answer. I 
>> don't know if Vis would cope with that, though?
>>
>> John.
>>
> 
> Hmm. It looks like if I change the 'ts()' function to use 'localtime()' 
> instead of 'gmtime()' and to add on 1900 to the year then it all works 
> fine for me :). So yes, I think it is some incompatibility between the 
> Perl and Javascript implementations of date <-> absolute seconds 
> conversions. Given that the timestamp is no longer being reported as an 
> actual date anymore, the relative value doesn't really matter. So I 
> would go with using whatever scheme produces the least mutation along 
> the way!
> 
> I wonder if you see the correct values on Chrome because your logs have 
> smaller timestamps? The ones I am currently testing with are of the 
> order of 856985.688681. With the above tweaks, that comes out as a date 
> of '1997-02-26 11:34:48.681000'. The 'gmtime' version was '1997-02-26 
> 19:34:48.681000' and obviously the non-1900 version was '0097-02-26 
> 19:34:48.681000'. Actually, maybe the Chrome difference is because you 
> are in the UK and don't have a timezone delta? Although I would assume 
> you are on BST not GMT right now?

Can you try leaving gmtime in ts() and adding this diff:

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 88abc2ee5ebf..2e43b68e3163 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -1338,6 +1338,10 @@ print <<ENDHTML;
                  zoomKey: 'ctrlKey',
                  orientation: 'top',
                  format: { majorLabels: majorAxis, minorLabels: minorAxis },
+  moment: function(date) {
+    return vis.moment(date).utc();
+  },
+
                  start: '$first_ts',
                  end: '$end_ts'};

Could be the gotcha we were missing!

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
@ 2018-07-17 16:22                   ` Tvrtko Ursulin
  0 siblings, 0 replies; 70+ messages in thread
From: Tvrtko Ursulin @ 2018-07-17 16:22 UTC (permalink / raw)
  To: John Harrison, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin


On 17/07/18 16:31, John Harrison wrote:
> On 7/17/2018 8:11 AM, John Harrison wrote:
>> On 7/17/2018 1:56 AM, Tvrtko Ursulin wrote:
>>>
>>> On 16/07/2018 18:53, John Harrison wrote:
>>>> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>>>>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>>>>
>>>>> 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<tvrtko.ursulin@intel.com>
>>>>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>>>>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>>>>> Cc: John Harrison<John.C.Harrison@Intel.com>
>>>>> ---
>>>>>   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'};
>>>>
>>>> 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?
>>>>
>>>> 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.
>>>>
>>>> Either way, I can't spot anything in this patch that could cause a 
>>>> random offset. So...
>>>
>>> Yeah, I can see that now that I tried in Firefox. I was using 
>>> Chromium so far and there timestamps are exactly matching the ones 
>>> from the tracepoint log. Which is what we want for easy correlation 
>>> between the log and HTML..
>>>
>>> Firefox corrupts that somehow by applying the large negative offset 
>>> to everyhting. Perhaps around two year worth of negative seconds if 
>>> my rough calculation can be trusted. Or Vis under Firefox, I wouldn't 
>>> know really who is to blame.
>>>
>>> I have no idea what to do here. :(
>>>
>>> Regards,
>>>
>>> Tvrtko
>>
>> I think ship it for now. It is better than it was. Certainly reporting 
>> in date format is vaguely meaningless at best and totally meaningless 
>> with the x1000 scale factor.
>>
>> Note that chromium on Ubuntu 16.04 does the same as Chrome on Windows 
>> for me - 28.8 seconds offset. It's not as bad as the 1.9 years of 
>> Firefox but it is still out :(. I'm guessing it is a bug in the date 
>> -> absolute seconds conversion going on within either Javascript 
>> itself or Vis in particular. The timestamps are still encoded as dates 
>> in the HTML file (and referenced from 0 not from 1900 or 1970 or 
>> whatever). So any difference in calculating leap years between the 
>> Perl script and the browser would potentially cause quite a 
>> significant delta.
>>
>> Is it at all possible to put absolute seconds style values in the HTML 
>> file instead of dates? That would seem like the obvious answer. I 
>> don't know if Vis would cope with that, though?
>>
>> John.
>>
> 
> Hmm. It looks like if I change the 'ts()' function to use 'localtime()' 
> instead of 'gmtime()' and to add on 1900 to the year then it all works 
> fine for me :). So yes, I think it is some incompatibility between the 
> Perl and Javascript implementations of date <-> absolute seconds 
> conversions. Given that the timestamp is no longer being reported as an 
> actual date anymore, the relative value doesn't really matter. So I 
> would go with using whatever scheme produces the least mutation along 
> the way!
> 
> I wonder if you see the correct values on Chrome because your logs have 
> smaller timestamps? The ones I am currently testing with are of the 
> order of 856985.688681. With the above tweaks, that comes out as a date 
> of '1997-02-26 11:34:48.681000'. The 'gmtime' version was '1997-02-26 
> 19:34:48.681000' and obviously the non-1900 version was '0097-02-26 
> 19:34:48.681000'. Actually, maybe the Chrome difference is because you 
> are in the UK and don't have a timezone delta? Although I would assume 
> you are on BST not GMT right now?

Can you try leaving gmtime in ts() and adding this diff:

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 88abc2ee5ebf..2e43b68e3163 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -1338,6 +1338,10 @@ print <<ENDHTML;
                  zoomKey: 'ctrlKey',
                  orientation: 'top',
                  format: { majorLabels: majorAxis, minorLabels: minorAxis },
+  moment: function(date) {
+    return vis.moment(date).utc();
+  },
+
                  start: '$first_ts',
                  end: '$end_ts'};

Could be the gotcha we were missing!

Regards,

Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
  2018-07-17 16:22                   ` Tvrtko Ursulin
@ 2018-07-17 17:57                     ` John Harrison
  -1 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-17 17:57 UTC (permalink / raw)
  To: Tvrtko Ursulin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx

On 7/17/2018 9:22 AM, Tvrtko Ursulin wrote:
> On 17/07/18 16:31, John Harrison wrote:
>> On 7/17/2018 8:11 AM, John Harrison wrote:
>>> On 7/17/2018 1:56 AM, Tvrtko Ursulin wrote:
>>>> On 16/07/2018 18:53, John Harrison wrote:
>>>>> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>>>>>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>>>>>
>>>>>> 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<tvrtko.ursulin@intel.com>
>>>>>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>>>>>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>>>>>> Cc: John Harrison<John.C.Harrison@Intel.com>
>>>>>> ---
>>>>>>    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'};
>>>>> 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?
>>>>>
>>>>> 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.
>>>>>
>>>>> Either way, I can't spot anything in this patch that could cause a
>>>>> random offset. So...
>>>> Yeah, I can see that now that I tried in Firefox. I was using
>>>> Chromium so far and there timestamps are exactly matching the ones
>>>> from the tracepoint log. Which is what we want for easy correlation
>>>> between the log and HTML..
>>>>
>>>> Firefox corrupts that somehow by applying the large negative offset
>>>> to everyhting. Perhaps around two year worth of negative seconds if
>>>> my rough calculation can be trusted. Or Vis under Firefox, I wouldn't
>>>> know really who is to blame.
>>>>
>>>> I have no idea what to do here. :(
>>>>
>>>> Regards,
>>>>
>>>> Tvrtko
>>> I think ship it for now. It is better than it was. Certainly reporting
>>> in date format is vaguely meaningless at best and totally meaningless
>>> with the x1000 scale factor.
>>>
>>> Note that chromium on Ubuntu 16.04 does the same as Chrome on Windows
>>> for me - 28.8 seconds offset. It's not as bad as the 1.9 years of
>>> Firefox but it is still out :(. I'm guessing it is a bug in the date
>>> -> absolute seconds conversion going on within either Javascript
>>> itself or Vis in particular. The timestamps are still encoded as dates
>>> in the HTML file (and referenced from 0 not from 1900 or 1970 or
>>> whatever). So any difference in calculating leap years between the
>>> Perl script and the browser would potentially cause quite a
>>> significant delta.
>>>
>>> Is it at all possible to put absolute seconds style values in the HTML
>>> file instead of dates? That would seem like the obvious answer. I
>>> don't know if Vis would cope with that, though?
>>>
>>> John.
>>>
>> Hmm. It looks like if I change the 'ts()' function to use 'localtime()'
>> instead of 'gmtime()' and to add on 1900 to the year then it all works
>> fine for me :). So yes, I think it is some incompatibility between the
>> Perl and Javascript implementations of date <-> absolute seconds
>> conversions. Given that the timestamp is no longer being reported as an
>> actual date anymore, the relative value doesn't really matter. So I
>> would go with using whatever scheme produces the least mutation along
>> the way!
>>
>> I wonder if you see the correct values on Chrome because your logs have
>> smaller timestamps? The ones I am currently testing with are of the
>> order of 856985.688681. With the above tweaks, that comes out as a date
>> of '1997-02-26 11:34:48.681000'. The 'gmtime' version was '1997-02-26
>> 19:34:48.681000' and obviously the non-1900 version was '0097-02-26
>> 19:34:48.681000'. Actually, maybe the Chrome difference is because you
>> are in the UK and don't have a timezone delta? Although I would assume
>> you are on BST not GMT right now?
> Can you try leaving gmtime in ts() and adding this diff:
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 88abc2ee5ebf..2e43b68e3163 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -1338,6 +1338,10 @@ print <<ENDHTML;
>                    zoomKey: 'ctrlKey',
>                    orientation: 'top',
>                    format: { majorLabels: majorAxis, minorLabels: minorAxis },
> +  moment: function(date) {
> +    return vis.moment(date).utc();
> +  },
> +
>                    start: '$first_ts',
>                    end: '$end_ts'};
>
> Could be the gotcha we were missing!
>
> Regards,
>
> Tvrtko

Doesn't seem to make a difference for me :(. The +1900 gets rid of the 
massive negative offset in Firefox but only the localtime() fixes the 
28.8s offset in both Firefox and Chrome.

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/9] trace.pl: Improve time axis labels
@ 2018-07-17 17:57                     ` John Harrison
  0 siblings, 0 replies; 70+ messages in thread
From: John Harrison @ 2018-07-17 17:57 UTC (permalink / raw)
  To: Tvrtko Ursulin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx, Tvrtko Ursulin

On 7/17/2018 9:22 AM, Tvrtko Ursulin wrote:
> On 17/07/18 16:31, John Harrison wrote:
>> On 7/17/2018 8:11 AM, John Harrison wrote:
>>> On 7/17/2018 1:56 AM, Tvrtko Ursulin wrote:
>>>> On 16/07/2018 18:53, John Harrison wrote:
>>>>> On 7/13/2018 2:55 AM, Tvrtko Ursulin wrote:
>>>>>> From: Tvrtko Ursulin<tvrtko.ursulin@intel.com>
>>>>>>
>>>>>> 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<tvrtko.ursulin@intel.com>
>>>>>> Suggested-by: Chris Wilson<chris@chris-wilson.co.uk>
>>>>>> Cc: Chris Wilson<chris@chris-wilson.co.uk>
>>>>>> Cc: John Harrison<John.C.Harrison@Intel.com>
>>>>>> ---
>>>>>>    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'};
>>>>> 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?
>>>>>
>>>>> 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.
>>>>>
>>>>> Either way, I can't spot anything in this patch that could cause a
>>>>> random offset. So...
>>>> Yeah, I can see that now that I tried in Firefox. I was using
>>>> Chromium so far and there timestamps are exactly matching the ones
>>>> from the tracepoint log. Which is what we want for easy correlation
>>>> between the log and HTML..
>>>>
>>>> Firefox corrupts that somehow by applying the large negative offset
>>>> to everyhting. Perhaps around two year worth of negative seconds if
>>>> my rough calculation can be trusted. Or Vis under Firefox, I wouldn't
>>>> know really who is to blame.
>>>>
>>>> I have no idea what to do here. :(
>>>>
>>>> Regards,
>>>>
>>>> Tvrtko
>>> I think ship it for now. It is better than it was. Certainly reporting
>>> in date format is vaguely meaningless at best and totally meaningless
>>> with the x1000 scale factor.
>>>
>>> Note that chromium on Ubuntu 16.04 does the same as Chrome on Windows
>>> for me - 28.8 seconds offset. It's not as bad as the 1.9 years of
>>> Firefox but it is still out :(. I'm guessing it is a bug in the date
>>> -> absolute seconds conversion going on within either Javascript
>>> itself or Vis in particular. The timestamps are still encoded as dates
>>> in the HTML file (and referenced from 0 not from 1900 or 1970 or
>>> whatever). So any difference in calculating leap years between the
>>> Perl script and the browser would potentially cause quite a
>>> significant delta.
>>>
>>> Is it at all possible to put absolute seconds style values in the HTML
>>> file instead of dates? That would seem like the obvious answer. I
>>> don't know if Vis would cope with that, though?
>>>
>>> John.
>>>
>> Hmm. It looks like if I change the 'ts()' function to use 'localtime()'
>> instead of 'gmtime()' and to add on 1900 to the year then it all works
>> fine for me :). So yes, I think it is some incompatibility between the
>> Perl and Javascript implementations of date <-> absolute seconds
>> conversions. Given that the timestamp is no longer being reported as an
>> actual date anymore, the relative value doesn't really matter. So I
>> would go with using whatever scheme produces the least mutation along
>> the way!
>>
>> I wonder if you see the correct values on Chrome because your logs have
>> smaller timestamps? The ones I am currently testing with are of the
>> order of 856985.688681. With the above tweaks, that comes out as a date
>> of '1997-02-26 11:34:48.681000'. The 'gmtime' version was '1997-02-26
>> 19:34:48.681000' and obviously the non-1900 version was '0097-02-26
>> 19:34:48.681000'. Actually, maybe the Chrome difference is because you
>> are in the UK and don't have a timezone delta? Although I would assume
>> you are on BST not GMT right now?
> Can you try leaving gmtime in ts() and adding this diff:
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 88abc2ee5ebf..2e43b68e3163 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -1338,6 +1338,10 @@ print <<ENDHTML;
>                    zoomKey: 'ctrlKey',
>                    orientation: 'top',
>                    format: { majorLabels: majorAxis, minorLabels: minorAxis },
> +  moment: function(date) {
> +    return vis.moment(date).utc();
> +  },
> +
>                    start: '$first_ts',
>                    end: '$end_ts'};
>
> Could be the gotcha we were missing!
>
> Regards,
>
> Tvrtko

Doesn't seem to make a difference for me :(. The +1900 gets rid of the 
massive negative offset in Firefox but only the localtime() fixes the 
28.8s offset in both Firefox and Chrome.

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 70+ messages in thread

end of thread, other threads:[~2018-07-17 17:57 UTC | newest]

Thread overview: 70+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 10:59 [PATCH i-g-t 0/9] trace.pl fixes and improvements Tvrtko Ursulin
2018-07-12 10:59 ` [igt-dev] " Tvrtko Ursulin
2018-07-12 10:59 ` [PATCH i-g-t 1/9] trace.pl: Improve time axis labels Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-12 12:42   ` Tvrtko Ursulin
2018-07-12 12:42     ` Tvrtko Ursulin
2018-07-12 22:35     ` John Harrison
2018-07-12 22:35       ` John Harrison
2018-07-13  9:55       ` [PATCH i-g-t v2 " Tvrtko Ursulin
2018-07-13  9:55         ` [igt-dev] " Tvrtko Ursulin
2018-07-16 17:53         ` John Harrison
2018-07-16 17:53           ` [Intel-gfx] " John Harrison
2018-07-17  8:56           ` [igt-dev] " Tvrtko Ursulin
2018-07-17  8:56             ` [Intel-gfx] " Tvrtko Ursulin
2018-07-17 15:11             ` John Harrison
2018-07-17 15:11               ` John Harrison
2018-07-17 15:31               ` John Harrison
2018-07-17 15:31                 ` John Harrison
2018-07-17 16:22                 ` Tvrtko Ursulin
2018-07-17 16:22                   ` Tvrtko Ursulin
2018-07-17 17:57                   ` John Harrison
2018-07-17 17:57                     ` John Harrison
2018-07-12 10:59 ` [PATCH i-g-t 2/9] trace.pl: Scale timeline for better precision Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-13  0:21   ` John Harrison
2018-07-13  0:21     ` [igt-dev] " John Harrison
2018-07-13 10:02   ` [PATCH i-g-t v3 " Tvrtko Ursulin
2018-07-13 10:02     ` [igt-dev] " Tvrtko Ursulin
2018-07-16 18:15     ` John Harrison
2018-07-16 18:15       ` [igt-dev] " John Harrison
2018-07-12 10:59 ` [PATCH i-g-t 3/9] trace.pl: Improve readability of graphical timeline representation Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-13  0:51   ` John Harrison
2018-07-13  0:51     ` [Intel-gfx] " John Harrison
2018-07-12 10:59 ` [PATCH i-g-t 4/9] trace.pl: Improve context colouring for large context id's Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-13  0:51   ` John Harrison
2018-07-13  0:51     ` [Intel-gfx] " John Harrison
2018-07-12 10:59 ` [PATCH i-g-t 5/9] trace.pl: Improved key/colours Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-12 11:03   ` Tvrtko Ursulin
2018-07-12 11:03     ` Tvrtko Ursulin
2018-07-13  0:52   ` John Harrison
2018-07-13  0:52     ` [igt-dev] " John Harrison
2018-07-13  9:56     ` [PATCH i-g-t v3 " Tvrtko Ursulin
2018-07-13  9:56       ` [igt-dev] " Tvrtko Ursulin
2018-07-14  0:01       ` John Harrison
2018-07-14  0:01         ` [igt-dev] " John Harrison
2018-07-16  8:49         ` [PATCH i-g-t v4 " Tvrtko Ursulin
2018-07-16  8:49           ` [Intel-gfx] " Tvrtko Ursulin
2018-07-16 19:11           ` John Harrison
2018-07-16 19:11             ` [igt-dev] " John Harrison
2018-07-12 10:59 ` [PATCH i-g-t 6/9] trace.pl: Context save only applies to last request of a bunch Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-13  6:55   ` John Harrison
2018-07-12 10:59 ` [PATCH i-g-t 7/9] trace.pl: Fix incomplete request handling Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-13  7:00   ` John Harrison
2018-07-13  7:00     ` [igt-dev] " John Harrison
2018-07-12 10:59 ` [PATCH i-g-t 8/9] trace.pl: Basic preemption support Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-13  0:54   ` John Harrison
2018-07-12 10:59 ` [PATCH i-g-t 9/9] trace.pl: Fix request split mode Tvrtko Ursulin
2018-07-12 10:59   ` [igt-dev] " Tvrtko Ursulin
2018-07-12 14:26 ` [igt-dev] ✓ Fi.CI.BAT: success for trace.pl fixes and improvements (rev3) Patchwork
2018-07-12 15:50 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-07-13 11:09 ` [igt-dev] ✓ Fi.CI.BAT: success for trace.pl fixes and improvements (rev6) Patchwork
2018-07-13 13:59 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-07-16 10:03 ` [igt-dev] ✓ Fi.CI.BAT: success for trace.pl fixes and improvements (rev7) Patchwork
2018-07-16 16:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.