Re: [Intel-gfx] [PATCH i-g-t 09/11] trace.pl: Add support for colouring context execution

2018-04-18 Thread Lionel Landwerlin

One suggestion below, otherwise :

Reviewed-by: Lionel Landwerlin 

On 06/03/18 04:43, Tvrtko Ursulin wrote:

From: Tvrtko Ursulin 

Add the command line switch which uses different colours for different
context execution boxes.

Signed-off-by: Tvrtko Ursulin 
Cc: John Harrison 
---
  scripts/trace.pl | 41 +++--
  1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index e7ce273ef26a..ff61dea0768d 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -40,6 +40,7 @@ my $trace = 0;
  my $avg_delay_stats = 0;
  my $squash_context_id = 0;
  my $gpu_timeline = 0;
+my $colour_contexts = 0;
  
  my @args;
  
@@ -110,6 +111,8 @@ Usage:

--squash-ctx-id Squash context id by substracting engine
id from ctx id.
--gpu-timeline  Draw overall GPU busy timeline.
+  --colour-contexts / -c   Use different colours for different
+   context execution boxes.
  ENDHELP
  
  		exit 0;

@@ -279,6 +282,20 @@ sub arg_skip_box
return @_;
  }
  
+sub arg_colour_contexts

+{
+   return unless scalar(@_);
+
+   if ($_[0] eq '--colour-contexts' or
+   $_[0] eq '--color-contexts' or
+   $_[0] eq '-c') {
+   shift @_;
+   $colour_contexts = 1;
+   }
+
+   return @_;
+}
+
  @args = @ARGV;
  while (@args) {
my $left = scalar(@args);
@@ -294,6 +311,7 @@ while (@args) {
@args = arg_split_requests(@args);
@args = arg_ignore_ring(@args);
@args = arg_skip_box(@args);
+   @args = arg_colour_contexts(@args);
  
  	last if $left == scalar(@args);

  }
@@ -581,6 +599,7 @@ foreach my $key (@sorted_keys) {
  
  my $last_ts = 0;

  my $first_ts;
+my $min_ctx;
  
  foreach my $key (@sorted_keys) {

my $ring = $db{$key}->{'ring'};
@@ -590,6 +609,8 @@ foreach my $key (@sorted_keys) {
  
  	$first_ts = $db{$key}->{'queue'} if not defined $first_ts or $db{$key}->{'queue'} < $first_ts;

$last_ts = $end if $end > $last_ts;
+   $min_ctx = $db{$key}->{'ctx'} if not defined $min_ctx or
+$db{$key}->{'ctx'} < $min_ctx;
  
  	$db{$key}->{'context-complete-delay'} = $end - $notify;

$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
@@ -721,6 +742,8 @@ foreach my $key (keys %reqwait) {
  say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
  
+my $execute_colour = $colour_contexts ? 'multi-colour' : 'pink';

+
  print <
  
@@ -741,7 +764,7 @@ print {'name'}, $db{$key}->{'ctx'}, 
$db{$key}->{'seqno'});
@@ -898,7 +934,8 @@ foreach my $key (sort sortQueue keys %db) {
if (exists $db{$key}->{'incomplete'}) {
$style = 'color: white; background-color: red;';
} else {
-   $style = 'color: black; background-color: pink;';
+   $style = 'color: black; background-color: ' .
+ ctx_colour($ctx) . ';';
}
$content = "$name $db{$key}->{'port'}";
$content .= ' ??? ' if exists 
$db{$key}->{'incomplete'};



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


[Intel-gfx] [PATCH i-g-t 09/11] trace.pl: Add support for colouring context execution

2018-03-06 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Add the command line switch which uses different colours for different
context execution boxes.

Signed-off-by: Tvrtko Ursulin 
Cc: John Harrison 
---
 scripts/trace.pl | 41 +++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index e7ce273ef26a..ff61dea0768d 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -40,6 +40,7 @@ my $trace = 0;
 my $avg_delay_stats = 0;
 my $squash_context_id = 0;
 my $gpu_timeline = 0;
+my $colour_contexts = 0;
 
 my @args;
 
@@ -110,6 +111,8 @@ Usage:
   --squash-ctx-id  Squash context id by substracting engine
id from ctx id.
   --gpu-timeline   Draw overall GPU busy timeline.
+  --colour-contexts / -c   Use different colours for different
+   context execution boxes.
 ENDHELP
 
exit 0;
@@ -279,6 +282,20 @@ sub arg_skip_box
return @_;
 }
 
+sub arg_colour_contexts
+{
+   return unless scalar(@_);
+
+   if ($_[0] eq '--colour-contexts' or
+   $_[0] eq '--color-contexts' or
+   $_[0] eq '-c') {
+   shift @_;
+   $colour_contexts = 1;
+   }
+
+   return @_;
+}
+
 @args = @ARGV;
 while (@args) {
my $left = scalar(@args);
@@ -294,6 +311,7 @@ while (@args) {
@args = arg_split_requests(@args);
@args = arg_ignore_ring(@args);
@args = arg_skip_box(@args);
+   @args = arg_colour_contexts(@args);
 
last if $left == scalar(@args);
 }
@@ -581,6 +599,7 @@ foreach my $key (@sorted_keys) {
 
 my $last_ts = 0;
 my $first_ts;
+my $min_ctx;
 
 foreach my $key (@sorted_keys) {
my $ring = $db{$key}->{'ring'};
@@ -590,6 +609,8 @@ foreach my $key (@sorted_keys) {
 
$first_ts = $db{$key}->{'queue'} if not defined $first_ts or 
$db{$key}->{'queue'} < $first_ts;
$last_ts = $end if $end > $last_ts;
+   $min_ctx = $db{$key}->{'ctx'} if not defined $min_ctx or
+$db{$key}->{'ctx'} < $min_ctx;
 
$db{$key}->{'context-complete-delay'} = $end - $notify;
$db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
@@ -721,6 +742,8 @@ foreach my $key (keys %reqwait) {
 say sprintf('GPU: %.2f%% idle, %.2f%% busy',
 $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html;
 
+my $execute_colour = $colour_contexts ? 'multi-colour' : 'pink';
+
 print <
 
@@ -741,7 +764,7 @@ print {'name'}, $db{$key}->{'ctx'}, 
$db{$key}->{'seqno'});
@@ -898,7 +934,8 @@ foreach my $key (sort sortQueue keys %db) {
if (exists $db{$key}->{'incomplete'}) {
$style = 'color: white; background-color: red;';
} else {
-   $style = 'color: black; background-color: pink;';
+   $style = 'color: black; background-color: ' .
+ ctx_colour($ctx) . ';';
}
$content = "$name $db{$key}->{'port'}";
$content .= ' ??? ' if exists 
$db{$key}->{'incomplete'};
-- 
2.14.1

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