From patchwork Mon Jul 9 13:19:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10514575 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 9394D6032A for ; Mon, 9 Jul 2018 13:20:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EE7F2894E for ; Mon, 9 Jul 2018 13:20:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 733D428ABC; Mon, 9 Jul 2018 13:20:21 +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 34AA02894E for ; Mon, 9 Jul 2018 13:20:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 981986E3BA; Mon, 9 Jul 2018 13:20:17 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by gabe.freedesktop.org (Postfix) with ESMTPS id 723676E28D for ; Mon, 9 Jul 2018 13:20:15 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id j5-v6so4451574wrr.8 for ; Mon, 09 Jul 2018 06:20:15 -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=ZPKpLmj25xRuGoniEQzT86iSVu57htA3m1Pl6pEYnKU=; b=NuuabedCN0smHuv9bqbzOUZEIxvDOiy4+tBDwpP+iR2K8476Ef0eoV1HSD/uftpcZ2 UubGVBBkZwtYweP3HzYd655yxgkN2fEpeKTcd4dzt1Kqe8VO5VOh1iT3yJIQK1sTphZL LXDlV+5J24ALQ3JIttWsKI3f0IS4gdtfoq9qAF41ykGUyrm9sb0BC1Slu5XQ6NA/cn3i BJ6jWh2Zzw+pDNlqJywVfwI2ZK1OWfcgtx/kPVl5ug9Z/JALOCxIVMlDhep+zKMWvwRb yt6TQ5ZDaP4S9nBvvOaXk9+9X59UIk0+GUrqG5s+FCQwF/wjPoWEtngeWk1FIjl7+3V2 h3FA== X-Gm-Message-State: AOUpUlHNNfXAzKlL9G45aYibXnYofMkmp+x6VQEllMFNQ4k2wf1sVnbp cs8AH7QdiFz9oQ0qx3gnCRckiQ== X-Google-Smtp-Source: AAOMgpe4fKSMvgIAwE9FC6Iboed6RxyD/9M/dt2GCLqbsqY8yxPch72IIjXTv2D3G47wd+g/S4EWdw== X-Received: by 2002:a5d:4785:: with SMTP id w5-v6mr2076380wrq.188.1531142414151; 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.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 06:20:13 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Mon, 9 Jul 2018 14:19:58 +0100 Message-Id: <20180709132004.14468-6-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 05/11] trace.pl: Fix HTML timestamp generation 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 Now that we scale timestamps to get better timeline granularity, the hacky hand rolled micro-second time to HTML date conversion does no longer cut it. Use perl built-in gmtime to handle things properly. Signed-off-by: Tvrtko Ursulin Cc: John Harrison Reviewed-by: John Harrison --- scripts/trace.pl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/trace.pl b/scripts/trace.pl index e2978e5382c2..aeaf2392162e 100755 --- a/scripts/trace.pl +++ b/scripts/trace.pl @@ -346,24 +346,17 @@ sub sanitize_ctx sub ts { my ($us) = @_; - my ($d, $h, $m, $s); + my ($y, $mo, $d, $h, $m, $s); $us *= 1000 unless $no_timeline_scaling; $s = int($us / 1000000); $us = $us % 1000000; - $m = int($s / 60); - $s = $s % 60; + ($s, $m, $h, $d, $mo, $y) = gmtime($s); - $h = int($m / 60); - $m = $m % 60; - - $d = 1 + int($h / 24); - $h = $h % 24; - - return sprintf('2017-01-%02u %02u:%02u:%02u.%06u', - int($d), int($h), int($m), int($s), int($us)); + return sprintf('%04u-%02u-%02u %02u:%02u:%02u.%06u', + 1970 + $y, 1 + $mo, $d, $h, $m, $s, int($us)); } # Main input loop - parse lines and build the internal representation of the