From patchwork Tue Mar 6 12:43:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10261583 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 4E5866037E for ; Tue, 6 Mar 2018 12:43:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E9DD28AF4 for ; Tue, 6 Mar 2018 12:43:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3365628A57; Tue, 6 Mar 2018 12:43:39 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 C636D28A57 for ; Tue, 6 Mar 2018 12:43:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72C036E6C0; Tue, 6 Mar 2018 12:43:36 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 833AF6E6A4 for ; Tue, 6 Mar 2018 12:43:34 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id f14so20761636wre.8 for ; Tue, 06 Mar 2018 04:43:34 -0800 (PST) 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=+es0216M+p32oLuCMR+1a0x8P7jyH7hGsIyvzzrzhDM=; b=teqzoNgAVZhn2vmb7aEfkcSFUt+oksNLLih3KHj1LVWD1Qive5sTeSiWKGkqYV5Tt9 PcmfJn8+RQdVBVm4wrssicTUWqI3dwP1QGD1Bn2iWkUzowIylsUplUJAl4rMGvk9aWTZ kenV3qrjrFTT+DsYhoAi+cnQusLw29lrAQRRY6YU0j9JX9V539EpXtfGlHFSt8LkM6OM r6TlxtO3sNKfGE3i5l9MioPd8XyWBJiU+OJZfE/VAWowAVm130jm5ndtO3reYj35aqhg IGzOTMnk6Ja91ubnUMVBJDbrpcOxH1Vj7lfXVcugXZEvNcI40FzGdsdflioeRmUkyXMI lL+Q== 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=+es0216M+p32oLuCMR+1a0x8P7jyH7hGsIyvzzrzhDM=; b=Uqxn2RQREkRjOnFznsIxYjUQMMy14kEkhw7xoPwNSIQu1u4FBXwfZfbdN3/g0cBHwU KlM8e/pbHMaMG/fox6/amXxDWBe2cyuoiQ0iv7rYCfjoKqpSWtbv/9aT39W85WIaoWKu 6ZS/+tDus+471HTCPrzs1Oum2fp2QaRxvbAU1k4LiMO45V8XkMfIbZYx3qaMnvjemqdd OSrY/aC20OijoUZ1zRve1zK24pscWii4y7jDSRl+aE1LqbkWL0h/RBjn5uXg9YUNCM3i HdF2n374KHW+Ukwn74G/ycADbOk8KF2iSCTgkKqSsXEmi4Azalm/4yYcQRgWb0hV4Lrx nabQ== X-Gm-Message-State: APf1xPDIwa2zDCHPpH9UifeT1U9CtfbI44eEG/43jYIh7d3tu5/2W/3i eDpOtHqqWXqIBKXPa988J0H0dQ== X-Google-Smtp-Source: AG47ELs2GRwcKcM6i1WX59/jQDZ0YRhhcJYl10c+meMtDMdfN2ImBuInQyCX/k6GfMOZlkewDx20JA== X-Received: by 10.223.133.70 with SMTP id 64mr16546580wrh.164.1520340213065; Tue, 06 Mar 2018 04:43:33 -0800 (PST) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id v8sm3646560wmh.25.2018.03.06.04.43.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 04:43:32 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 6 Mar 2018 12:43:13 +0000 Message-Id: <20180306124315.30208-10-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180306124315.30208-1-tvrtko.ursulin@linux.intel.com> References: <20180306124315.30208-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 09/11] 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. Signed-off-by: Tvrtko Ursulin Cc: John Harrison Reviewed-by: Lionel Landwerlin --- 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 <Toggle stacking

-pink = requests executing on the GPU
+$execute_colour = 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

@@ -861,6 +884,19 @@ sub sortQueue { return $val; } +my @html_colours = ( 'Pink', 'Green', 'Purple', 'Gold', 'Cyan', 'Brown', + 'DeepPink', 'LightGreen', 'Plum', 'Orange', 'Teal', 'Peru', + 'Indigo', 'Khaki', 'Coral', 'Olive' ); + +sub ctx_colour +{ + my ($ctx) = (@_); + + return 'Pink' unless $colour_contexts; + + return $html_colours[($ctx - $min_ctx) % scalar(@html_colours)]; +} + my $i = 0; foreach my $key (sort sortQueue keys %db) { my ($name, $ctx, $seqno) = ($db{$key}->{'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'};