From patchwork Sat Jan 20 00:24:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Harrison X-Patchwork-Id: 10176173 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 720E3601C2 for ; Sat, 20 Jan 2018 00:24:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6468D1FF83 for ; Sat, 20 Jan 2018 00:24:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58E1527FB0; Sat, 20 Jan 2018 00:24:27 +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.2 required=2.0 tests=BAYES_00, 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 47005223A1 for ; Sat, 20 Jan 2018 00:24:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B9C206EB87; Sat, 20 Jan 2018 00:24:23 +0000 (UTC) X-Original-To: Intel-GFX@lists.freedesktop.org Delivered-To: Intel-GFX@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 92B806EB84 for ; Sat, 20 Jan 2018 00:24:22 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jan 2018 16:24:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,383,1511856000"; d="scan'208";a="20849819" Received: from relo-linux-5.ra.intel.com ([10.54.133.84]) by orsmga003.jf.intel.com with ESMTP; 19 Jan 2018 16:24:21 -0800 From: John.C.Harrison@Intel.com To: Intel-GFX@Lists.FreeDesktop.Org Date: Fri, 19 Jan 2018 16:24:21 -0800 Message-Id: <20180120002421.13919-5-John.C.Harrison@Intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180120002421.13919-1-John.C.Harrison@Intel.com> References: <20180120002421.13919-1-John.C.Harrison@Intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [PATCH i-g-t 4/4] scripts/trace.pl: Simplify 'end' & 'notify' generation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: John Harrison Delay the auto-generation of end/notify values until the point where everything is known. As opposed to potentially generating them multiple times with differing values. Signed-off-by: John Harrison Cc: Tvrtko Ursulin --- scripts/trace.pl | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/scripts/trace.pl b/scripts/trace.pl index c5d822aa..fbf4b92e 100755 --- a/scripts/trace.pl +++ b/scripts/trace.pl @@ -467,10 +467,11 @@ while (<>) { } # Sanitation pass to fixup up out of order notify and context complete, and to -# fine the largest seqno to be used for timeline sorting purposes. +# find the largest seqno to be used for timeline sorting purposes. my $max_seqno = 0; foreach my $key (keys %db) { my $gkey = global_key($db{$key}->{'ring'}, $db{$key}->{'global'}); + my $notify = $notify{$gkey}; die unless exists $db{$key}->{'start'}; @@ -478,23 +479,21 @@ foreach my $key (keys %db) { unless (exists $db{$key}->{'end'}) { # Context complete not received. - if (exists $notify{$gkey}) { + $db{$key}->{'no-end'} = 1; + + if (defined($notify)) { # No context complete due req merging - use notify. - $db{$key}->{'notify'} = $notify{$gkey}; - $db{$key}->{'end'} = $db{$key}->{'notify'}; - $db{$key}->{'no-end'} = 1; + $db{$key}->{'notify'} = $notify; + $db{$key}->{'end'} = $notify; } else { - # No notify and no context complete - mark it. - $db{$key}->{'no-end'} = 1; - $db{$key}->{'end'} = $db{$key}->{'start'} + 999; - $db{$key}->{'notify'} = $db{$key}->{'end'}; + # No notify and no context complete - give up for now. $db{$key}->{'incomplete'} = 1; } } else { # Notify arrived after context complete. - if (exists $db{$key}->{'no-notify'} and exists $notify{$gkey}) { + if (exists $db{$key}->{'no-notify'} and defined($notify)) { delete $db{$key}->{'no-notify'}; - $db{$key}->{'notify'} = $notify{$gkey}; + $db{$key}->{'notify'} = $notify; } } } @@ -511,6 +510,7 @@ foreach my $key (@keys) { my $seqno = $db{$key}->{'seqno'}; my $next_key; my $i = 1; + my $end; do { $next_key = db_key($ring, $ctx, $seqno + $i); @@ -519,9 +519,14 @@ foreach my $key (@keys) { or $i > $keyCount); # ugly stop hack if (exists $db{$next_key}) { - $db{$key}->{'notify'} = $db{$next_key}->{'end'}; - $db{$key}->{'end'} = $db{$key}->{'notify'}; + $end = $db{$next_key}->{'end'}; + } else { + # No info at all, fake it: + $end = $db{$key}->{'start'} + 999; } + + $db{$key}->{'notify'} = $end; + $db{$key}->{'end'} = $end; } # GPU time accounting