From patchwork Wed Jul 18 09:45:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10531947 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 3702E602CA for ; Wed, 18 Jul 2018 09:45:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2349628FBC for ; Wed, 18 Jul 2018 09:45:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 172E128FCD; Wed, 18 Jul 2018 09:45: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=-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 98FCC28FBC for ; Wed, 18 Jul 2018 09:45:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AEB796E985; Wed, 18 Jul 2018 09:45:25 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB2F66E980 for ; Wed, 18 Jul 2018 09:45:21 +0000 (UTC) Received: by mail-wr1-x42d.google.com with SMTP id h9-v6so3997223wro.3 for ; Wed, 18 Jul 2018 02:45:21 -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=hNH9huA0P0N0Ewpwc4LNmyQNlOtXFDLUqfRmSlwmMm4=; b=lvBrk+PRo00RN28tY6jYNIoy6r6hA83ly/eL8hOcso5Cf8YEXBAPtkpzt3NyJFLtmm au/BEilBEELc7DJiUvsN0SrrAKjYajjUE/anmGoEfFejw05ibHi1MrKQwmHQGBYXj7Rz cHCT89qlvefHw0TFgSc5aRQmSZyNHdFQYd2jkL6m5tSrp8oYjXtOFwOmOs1wejc0aEMb w8YGEV5vkO02eRsYfk0X9SGfyDMkHFnA72hzzGbI8hDzxlcJTC5aDYPM0guMCDZfjKsB fPDoeqhEk4Dw9U8liQakA782welT0lBnK7kr1Oc8qaE5HjlEDDjiJ8lJaTNrXZCcYqpN Fdeg== X-Gm-Message-State: AOUpUlFAs0MJCxD2IZFaFrWKC55k+2J3+KrgzWpx2Feh0LoKG00rwqnO PUecOyLuyxrnuiJFfzHVkra8aQ== X-Google-Smtp-Source: AAOMgpcwyjkEe382oP0nS3kvpQT07fDTdgLZhSKB6Fm2zRd797v4oqn0qIvRhVxj0tImufyHL9VNsQ== X-Received: by 2002:adf:db41:: with SMTP id f1-v6mr4194567wrj.212.1531907120460; Wed, 18 Jul 2018 02:45:20 -0700 (PDT) Received: from localhost.localdomain ([95.146.151.144]) by smtp.gmail.com with ESMTPSA id q11-v6sm7919530wrp.58.2018.07.18.02.45.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:45:19 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Wed, 18 Jul 2018 10:45:07 +0100 Message-Id: <20180718094514.5903-2-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180718094514.5903-1-tvrtko.ursulin@linux.intel.com> References: <20180718094514.5903-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 1/8] trace.pl: Improve time axis labels 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 is possible to customize the axis display so change it to display timestamps in seconds on the major axis (with six decimal spaces) and millisecond offsets on the minor axis. v2: * Give up on broken relative timestamps. v3: * Drop all date complications and just use micro seconds throughout. (John Harrison) Signed-off-by: Tvrtko Ursulin Suggested-by: Chris Wilson Cc: Chris Wilson Cc: John Harrison Reviewed-by: John Harrison # v2 Reviewed-by: John Harrison --- scripts/trace.pl | 72 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/scripts/trace.pl b/scripts/trace.pl index fc1713e4f9a7..3ad5effafd0a 100755 --- a/scripts/trace.pl +++ b/scripts/trace.pl @@ -329,20 +329,6 @@ sub sanitize_ctx } } -sub ts -{ - my ($us) = @_; - my ($y, $mo, $d, $h, $m, $s); - - $s = int($us / 1000000); - $us = $us % 1000000; - - ($s, $m, $h, $d, $mo, $y) = gmtime($s); - - return sprintf('%04u-%02u-%02u %02u:%02u:%02u.%06u', - $y, 1 + $mo, $d, $h, $m, $s, int($us)); -} - # Main input loop - parse lines and build the internal representation of the # trace using a hash of requests and some auxilliary data structures. my $prev_freq = 0; @@ -912,7 +898,7 @@ foreach my $key (sort sortQueue keys %db) { $style = 'color: black; background-color: ' . ctx_colour($ctx, 'queue'); $content = "$name
$db{$key}->{'submit-delay'}us ($db{$key}->{'execute-delay'}us)"; - $startend = 'start: \'' . ts($queue) . '\', end: \'' . ts($submit) . '\''; + $startend = 'start: ' . $queue . ', end: ' . $submit; print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n"; $i++; } @@ -923,7 +909,7 @@ foreach my $key (sort sortQueue keys %db) { $style = 'color: black; background-color: ' . ctx_colour($ctx, 'ready'); $content = "$name
$db{$key}->{'execute-delay'}us
"; - $startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($start) . '\''; + $startend = 'start: ' . $submit . ', end: ' . $start; print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n"; $i++; } @@ -942,7 +928,7 @@ foreach my $key (sort sortQueue keys %db) { $content .= ' ++ ' if exists $db{$key}->{'no-end'}; $content .= ' + ' if exists $db{$key}->{'no-notify'}; $content .= "
$db{$key}->{'duration'}us ($db{$key}->{'context-complete-delay'}us)"; - $startend = 'start: \'' . ts($start) . '\', end: \'' . ts($notify) . '\''; + $startend = 'start: ' . $start . ', end: ' . $notify; print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n"; $i++; } @@ -956,7 +942,7 @@ foreach my $key (sort sortQueue keys %db) { $content .= ' ??? ' if exists $db{$key}->{'incomplete'}; $content .= ' ++ ' if exists $db{$key}->{'no-end'}; $content .= ' + ' if exists $db{$key}->{'no-notify'}; - $startend = 'start: \'' . ts($notify) . '\', end: \'' . ts($end) . '\''; + $startend = 'start: ' . $notify . ', end: ' . $end; print "\t{id: $i, key: $skey, $type group: $group, subgroup: $subgroup, subgroupOrder: $subgroup, content: '$content', $startend, style: \'$style\'},\n"; $i++; } @@ -974,7 +960,7 @@ foreach my $item (@freqs) { $start = $first_ts if $start < $first_ts; $end = $last_ts if $end > $last_ts; - $startend = 'start: \'' . ts($start) . '\', end: \'' . ts($end) . '\''; + $startend = 'start: ' . $start . ', end: ' . $end; print "\t{id: $i, type: 'range', group: 0, content: '$freq', $startend},\n"; $i++; } @@ -988,18 +974,55 @@ if ($gpu_timeline) { $start = $first_ts if $start < $first_ts; $end = $last_ts if $end > $last_ts; - $startend = 'start: \'' . ts($start) . '\', end: \'' . ts($end) . '\''; + $startend = 'start: ' . $start . ', end: ' . $end; print "\t{id: $i, type: 'range', group: 1, $startend},\n"; $i++; } } -my $end_ts = ts($first_ts + $width_us); -$first_ts = ts($first_ts); +my $end_ts = $first_ts + $width_us; +$first_ts = $first_ts; print <