From patchwork Tue Mar 6 12:43:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10261589 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 7BE9A60596 for ; Tue, 6 Mar 2018 12:43:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D3E528A57 for ; Tue, 6 Mar 2018 12:43:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6225E28E43; Tue, 6 Mar 2018 12:43:42 +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 1A40D28AF4 for ; Tue, 6 Mar 2018 12:43:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 783F46E6C8; Tue, 6 Mar 2018 12:43:40 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr0-x233.google.com (mail-wr0-x233.google.com [IPv6:2a00:1450:400c:c0c::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90F3B6E6BD for ; Tue, 6 Mar 2018 12:43:32 +0000 (UTC) Received: by mail-wr0-x233.google.com with SMTP id u49so20769255wrc.10 for ; Tue, 06 Mar 2018 04:43:32 -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=1/lqzUuzTQsWewkJkQZwDQxSZponIonSo6yyslFP+4Q=; b=PidqpHRUxVa6476eiolAerX5oI3ECHPFbaIOzejZneJlm0Am/Jh+bFgrrS7k9yxaN8 B4mP2rUeDwVhbsQ1v65IFaDhr7YwMth73n4x95gbmJcvbBV/CyrhBYOcpCY/eq5wpBWN wfP47VV9twBSIP4eWd6cdlc7xg0HpX4HPXB6MUmliF1p5lR33rn5lrK+InORuYiilLf3 d7uLECHIjj9seWX/NNwbAGniM495GCjCcptMVpEiT3j5V7JEsSg+Cd056eIb2cLWHKwI 07d12gnE962xGK+6ej3K7FPV3YWJvF5bXhPMAUF7d7kW2s0ml82HsOz+tmuuV+SF9ljH kebA== 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=1/lqzUuzTQsWewkJkQZwDQxSZponIonSo6yyslFP+4Q=; b=QoDDOhOqWdBzPDeB5OmYL9Z/SbRl9w9JW7vs14oqg25trI26/PYSP73lhn5Ml4+3d5 jPeszNWE2PvKU9QJRMrjK/0VIid44T3crBo6xI5S7CeYvsDmiCMXmYEtv+nb3/llzjzv smPhQR15n7R++aZPKWv99SIzkeb4nPt/1wTWJnK6QXBQlqExGQS5QbXuRHWY60UJ70c1 cDK5aYwoH4tCYvCW37Hs4vXSjtzSLieb7JywhRVZ2nP3gJ6AlksUtClJ23wVTG/ToBI+ tqThepl4F07X0HFpWq9qQjFp9YVjsYBv9ikKbLtpB/BqCxwe2mAggPiYWofUbpwxUobs V7DQ== X-Gm-Message-State: AElRT7E9hShInCit5EFZ7Tayk/SUFJLqe7Ts0qQaA0qV6qvPghgb1Spp M5KkDIq9vfekc9ADg3rRfFcnEA== X-Google-Smtp-Source: AG47ELuo7wEgZTnlRTMSFAXMMQBKX4MTsKKl4OBDeFTPlAKQOhIGUc9DfYRKtgVU60kUU86kYEzZLw== X-Received: by 10.223.157.205 with SMTP id q13mr1609843wre.266.1520340211283; Tue, 06 Mar 2018 04:43:31 -0800 (PST) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id v8sm3646560wmh.25.2018.03.06.04.43.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 04:43:30 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 6 Mar 2018 12:43:11 +0000 Message-Id: <20180306124315.30208-8-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 07/11] trace.pl: Move min/max timestamp lookup to last loop 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 It makes sense to fetch the min and max timestamp only after the last sort of the array. Signed-off-by: Tvrtko Ursulin Cc: John Harrison Reviewed-by: Lionel Landwerlin --- scripts/trace.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/trace.pl b/scripts/trace.pl index d49d25d6c1ca..27b39efcebbd 100755 --- a/scripts/trace.pl +++ b/scripts/trace.pl @@ -531,8 +531,6 @@ foreach my $key (keys %db) { # GPU time accounting my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count); my (%submit_avg, %execute_avg, %ctxsave_avg); -my $last_ts = 0; -my $first_ts; sub sortStart { my $as = $db{$a}->{'start'}; @@ -554,9 +552,6 @@ foreach my $key (@sorted_keys) { my $ring = $db{$key}->{'ring'}; my $end = $db{$key}->{'end'}; - $first_ts = $db{$key}->{'queue'} if not defined $first_ts or $db{$key}->{'queue'} < $first_ts; - $last_ts = $end if $end > $last_ts; - # correct duration of merged batches if ($correct_durations and exists $db{$key}->{'no-end'}) { my $ctx = $db{$key}->{'ctx'}; @@ -584,12 +579,18 @@ foreach my $key (@sorted_keys) { @sorted_keys = sort sortStart keys %db if $re_sort; +my $last_ts = 0; +my $first_ts; + foreach my $key (@sorted_keys) { my $ring = $db{$key}->{'ring'}; my $end = $db{$key}->{'end'}; my $start = $db{$key}->{'start'}; my $notify = $db{$key}->{'notify'}; + $first_ts = $db{$key}->{'queue'} if not defined $first_ts or $db{$key}->{'queue'} < $first_ts; + $last_ts = $end if $end > $last_ts; + $db{$key}->{'context-complete-delay'} = $end - $notify; $db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'}; $db{$key}->{'submit-delay'} = $db{$key}->{'submit'} - $db{$key}->{'queue'};