From patchwork Mon Apr 23 09:52:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10356527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70BF560225 for ; Mon, 23 Apr 2018 09:53:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 607A128A03 for ; Mon, 23 Apr 2018 09:53:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5599B28A07; Mon, 23 Apr 2018 09:53:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1D8528A03 for ; Mon, 23 Apr 2018 09:53:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 389426E1A2; Mon, 23 Apr 2018 09:53:12 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B0746E193 for ; Mon, 23 Apr 2018 09:53:08 +0000 (UTC) Received: by mail-wr0-x244.google.com with SMTP id u18-v6so12177146wrg.3 for ; Mon, 23 Apr 2018 02:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mzegSUeC7tz8Q/IXlq54o1sUfTNm6zaSJt6kc2bc3tk=; b=RxMI93GqQh38B41oZlczEso0WdBWd1rtMCLOpyT5pJemabjDXzNexrdwDuiRvT0TWL UPqWr9t6jYB1+PIr5YWr3s9kMVSsJVdGg6thCCrn26CWzINSZghOAigIjyONP1b/hrXz VhEQRgsDEWEsiCQQIqrr5iYS5b5FQJ4FoKXRQyw/volTqeYXrsOvNal66llZPlb+OPlc nNzhfqC0y7VauIcNV0ztj5ZOmG3E41pX/7CZp7Sn0RxEhQbb8GXs1UNNn6HSgYduFZZl hNJ6oC6Dgzg3vXuZKv5fZwdZVpJmYBKSenljsbTdqtMHrrnbxVsMJwdvdSacz12Q+7p/ r28A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mzegSUeC7tz8Q/IXlq54o1sUfTNm6zaSJt6kc2bc3tk=; b=YhW0XtB3aJDh5q8kVJwWP0DWxuAOLg1mdVuwAS0+5HPpJ5F5R0Sjl1FKXh8k5onHks Z9Ncwwlc26CNdVdb7rWumOfX/vII8cGkji0pesiruv0L0mOM/Z7sdVPK2nsTBexxJgYE rguLA0+KdcBw7+EfvQG2n1qsYiGlYO9etyaN9oBYSp0ZdH3oyDJ5gxu2/p36WiITBodH 2WeecmnOZWeY9yVyAPG0j0lLgsu2ZCxTECA1zT90BlRkjkINJaWTWFZBYPQAzEAQhrYb tdn4eWzWYg7GFtjAE7Os+yZR88Iwc1nJd2yHTMHdqi12CJtUGugbTwAo4Wl9O7AWuvkT K/kg== X-Gm-Message-State: ALQs6tA/KZnZs+J4W0godUmuCC/65PaCUcsQ+gQzgoDaG4sFsxxPfbtc uC8kB4GwPh/89J4PpCcOfXx49Q== X-Google-Smtp-Source: AIpwx4/NEQl1Yk4J8CKAzFeMQb6MQLs5NLUztQg38swG/UKrYWrSKOUUwruW+Z92RtqrSey0bus/Dw== X-Received: by 10.28.198.202 with SMTP id w193mr7411364wmf.68.1524477186878; Mon, 23 Apr 2018 02:53:06 -0700 (PDT) Received: from localhost.localdomain ([95.146.151.144]) by smtp.gmail.com with ESMTPSA id j76sm20918590wmf.33.2018.04.23.02.53.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Apr 2018 02:53:06 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Mon, 23 Apr 2018 10:52:35 +0100 Message-Id: <20180423095238.29238-2-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180423095238.29238-1-tvrtko.ursulin@linux.intel.com> References: <20180423095238.29238-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 1/4] trace.pl: Add support for colouring context execution X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Add the command line switch which uses different colours for different context execution boxes. v2: * Use HSL to simplify color generation. (Lionel) * Colour other boxes in the same colour but different shade so it is easier to follow the timeline. Signed-off-by: Tvrtko Ursulin Cc: John Harrison Reviewed-by: Lionel Landwerlin # v1 --- scripts/trace.pl | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/scripts/trace.pl b/scripts/trace.pl index 27b39efcebbd..c8182a8ea86d 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, $max_ctx); foreach my $key (@sorted_keys) { my $ring = $db{$key}->{'ring'}; @@ -590,6 +609,10 @@ 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; + $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'}; @@ -720,6 +743,10 @@ 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'; + print < @@ -740,9 +767,9 @@ print <Toggle stacking

-pink = requests executing on the GPU
-grey = runnable requests waiting for a slot on GPU
-blue = requests waiting on fences and dependencies before they are runnable
+$execute_colour = requests executing on the GPU
+$runnable_colour = runnable requests waiting for a slot on GPU
+$queued_colour = requests waiting on fences and dependencies before they are runnable

Boxes are in format 'ctx-id/seqno'. @@ -860,6 +887,18 @@ sub sortQueue { return $val; } +sub ctx_colour +{ + my ($ctx, $s, $l) = (@_); + my $val; + + return 'Pink;' unless $colour_contexts; + + $val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx); + + return "hsl($val, $s%, $l%);"; +} + my $i = 0; foreach my $key (sort sortQueue keys %db) { my ($name, $ctx, $seqno) = ($db{$key}->{'name'}, $db{$key}->{'ctx'}, $db{$key}->{'seqno'}); @@ -874,7 +913,8 @@ 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: lightblue;'; + $style = 'color: black; background-color: ' . + ctx_colour($ctx, 35, 85); $content = "$name
$db{$key}->{'submit-delay'}us ($db{$key}->{'execute-delay'}us)"; $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"; @@ -884,7 +924,8 @@ 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: lightgrey;'; + $style = 'color: black; background-color: ' . + ctx_colour($ctx, 35, 45); $content = "$name
$db{$key}->{'execute-delay'}us
"; $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"; @@ -897,7 +938,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, 80, 65); } $content = "$name $db{$key}->{'port'}"; $content .= ' ??? ' if exists $db{$key}->{'incomplete'};