From patchwork Mon Jul 9 13:19:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10514577 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 3EB096032A for ; Mon, 9 Jul 2018 13:20:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A00228ABC for ; Mon, 9 Jul 2018 13:20:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EC9228B01; Mon, 9 Jul 2018 13:20:25 +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.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 C46DE28ABC for ; Mon, 9 Jul 2018 13:20:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0387A6E45A; Mon, 9 Jul 2018 13:20:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A3A66E174 for ; Mon, 9 Jul 2018 13:20:16 +0000 (UTC) Received: by mail-wm0-x233.google.com with SMTP id s12-v6so21189416wmc.1 for ; Mon, 09 Jul 2018 06:20:16 -0700 (PDT) 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=o3hZhHaTH2njHPeuiCzgqFHqz4TkWApeIaXGgc54+XQ=; b=ZrXCxQHXh8usMBKWGB+K/oq/LNSkV5n24t4fmuN4cxwcnNVhJn5Knc1IrxQ+elGvFR vHwvnFHUuuZHZjIXJT5bzbl3fsR6HZ41+GM1cqA8bC+xLs/6h3AL5isqX+F2oNkcPs3k NlF4w9dLIih/+BE7GBeEutQ3pHYGi3WLZucjj7fi/Jf3ua1pyZAIMMswt/o7MVslNyQI 0iJE37t/P0KYlgUnvZNMvyxuC4jHGCCFbCKINBBUX98CWD/PvSkTxqJTZThvVWkLNKwl tNcPXAsKwggYhZZUuFiJ1GiCAr5uLKwKMpyaJyiH6WFZdIDljnBeobAHTpfeS/q1Ttez l+lg== X-Gm-Message-State: APt69E39vOLq7sigtoEebdHdL2YF+jf/ZMzA4KIv+EpKUx8gost44dWd HotlAfPerAv9DTrF9fvmKlPqiA== X-Google-Smtp-Source: AAOMgpfIWhXubGIPUlNBj9aMQEqdM6SmdFg9x89k3XSgJ0y9K6JwvaNPqPt6ZsTArLbQi0Fu1nW0ag== X-Received: by 2002:a1c:55c8:: with SMTP id j191-v6mr11807329wmb.67.1531142414887; Mon, 09 Jul 2018 06:20:14 -0700 (PDT) Received: from localhost.localdomain ([95.146.151.144]) by smtp.gmail.com with ESMTPSA id l10-v6sm21585637wrv.23.2018.07.09.06.20.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 06:20:14 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Mon, 9 Jul 2018 14:19:59 +0100 Message-Id: <20180709132004.14468-7-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709132004.14468-1-tvrtko.ursulin@linux.intel.com> References: <20180709132004.14468-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 06/11] trace.pl: Improve context colouring for large context id's 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 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 Suggested-by: John Harrison Cc: John Harrison --- scripts/trace.pl | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/trace.pl b/scripts/trace.pl index aeaf2392162e..60a8e441c1d9 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'}; @@ -739,6 +739,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'); @@ -947,7 +962,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);