diff mbox

[i-g-t,01/11] trace.pl: Fix no context colouring mode

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

Commit Message

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

Commit 87d2affc380da96ba66c258c5337c363fe8651ef ("trace.pl: Add support
for colouring context execution"), due some dodgy attempts at patch
splitting broke the legacy colouring mode.

Fix it by passing in the request stage into the helper so all stages can
be correctly coloured in both modes.

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

Comments

John Harrison July 11, 2018, 5:49 p.m. UTC | #1
On 7/9/2018 6:19 AM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Commit 87d2affc380da96ba66c258c5337c363fe8651ef ("trace.pl: Add support
> for colouring context execution"), due some dodgy attempts at patch
> splitting broke the legacy colouring mode.
>
> Fix it by passing in the request stage into the helper so all stages can
> be correctly coloured in both modes.
>
> 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>
diff mbox

Patch

diff --git a/scripts/trace.pl b/scripts/trace.pl
index ea6c667696f4..fd414f5a4b1e 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -873,10 +873,30 @@  sub sortQueue {
 
 sub ctx_colour
 {
-	my ($ctx, $s, $l) = (@_);
+	my ($ctx, $stage) = (@_);
+	my ($s, $l);
 	my $val;
 
-	return 'Pink;' unless $colour_contexts;
+	unless ($colour_contexts) {
+		if ($stage eq 'queue') {
+			return 'lightblue;';
+		} elsif ($stage eq 'ready') {
+			return 'lightgrey;';
+		} elsif ($stage eq 'execute') {
+			return 'pink;';
+		}
+	} else {
+		if ($stage eq 'queue') {
+			$s = 35;
+			$l = 85;
+		} elsif ($stage eq 'ready') {
+			$s = 35;
+			$l = 45;
+		} elsif ($stage eq 'execute') {
+			$s = 80;
+			$l = 65;
+		}
+	}
 
 	$val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx);
 
@@ -898,7 +918,7 @@  foreach my $key (sort sortQueue keys %db) {
 	unless (exists $skip_box{'queue'}) {
 		$skey = 2 * $max_seqno * $ctx + 2 * $seqno;
 		$style = 'color: black; background-color: ' .
-			 ctx_colour($ctx, 35, 85);
+			 ctx_colour($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: 1, subgroupOrder: 1, content: '$content', $startend, style: \'$style\'},\n";
@@ -909,7 +929,7 @@  foreach my $key (sort sortQueue keys %db) {
 	unless (exists $skip_box{'ready'}) {
 		$skey = 2 * $max_seqno * $ctx + 2 * $seqno + 1;
 		$style = 'color: black; background-color: ' .
-			 ctx_colour($ctx, 35, 45);
+			 ctx_colour($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: 1, subgroupOrder: 2, content: '$content', $startend, style: \'$style\'},\n";
@@ -923,7 +943,7 @@  foreach my $key (sort sortQueue keys %db) {
 			$style = 'color: white; background-color: red;';
 		} else {
 			$style = 'color: black; background-color: ' .
-				  ctx_colour($ctx, 80, 65);
+				  ctx_colour($ctx, 'execute');
 		}
 		$content = "$name <small>$db{$key}->{'port'}</small>";
 		$content .= ' <small><i>???</i></small> ' if exists $db{$key}->{'incomplete'};