From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1426326AbdDVRxu (ORCPT ); Sat, 22 Apr 2017 13:53:50 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34157 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425939AbdDVRxY (ORCPT ); Sat, 22 Apr 2017 13:53:24 -0400 From: Erik Stromdahl To: linux-kernel@vger.kernel.org Cc: Erik Stromdahl Subject: [PATCH 2/2] scripts: show_delta: add --delta-only option Date: Sat, 22 Apr 2017 19:52:33 +0200 Message-Id: <1492883553-10349-3-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492883553-10349-1-git-send-email-erik.stromdahl@gmail.com> References: <1492883553-10349-1-git-send-email-erik.stromdahl@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The --delta-only option makes show_delta print delta time stamps only (and not the combination of absolute and delta time stamps which is the default). Rationale: Easier to diff kernel logs (with graphical diff tool) when debugging timing issues. Having absolute time stamps when diffing the output from two different test runs could potentially (and likely) make the diff tool detect a lot of irrelevant differences. Signed-off-by: Erik Stromdahl --- scripts/show_delta | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/show_delta b/scripts/show_delta index b85cf0f..13b1f62 100755 --- a/scripts/show_delta +++ b/scripts/show_delta @@ -34,6 +34,7 @@ Options: delta timestamps. All delta timestamps will be rounded to the nearest 'round_us' microsecond + --delta-only Add only delta time stamps to the output. ex: $ dmesg >timefile $ show_delta -b NET4 timefile @@ -73,7 +74,7 @@ def round_delta_ts(delta, rounding_time_us): # time data is expressed in seconds.useconds, # convert_line adds a delta for each line last_time = 0.0 -def convert_line(line, base_time, rounding_time_us): +def convert_line(line, base_time, rounding_time_us, delta_only): global last_time try: @@ -93,17 +94,23 @@ def convert_line(line, base_time, rounding_time_us): if rounding_time_us: delta = round_delta_ts(delta, rounding_time_us) - return ("[%5.6f < %5.6f >]" % (time, delta)) + rest + if delta_only: + return ("[%5.6f]" % delta) + rest + else: + return ("[%5.6f < %5.6f >]" % (time, delta)) + rest def main(): base_str = "" rounding_str = "" + delta_only = False filein = "" for arg in sys.argv[1:]: if arg=="-b": base_str = sys.argv[sys.argv.index("-b")+1] elif arg=="-r": rounding_str = sys.argv[sys.argv.index("-r")+1] + elif arg=="--delta-only": + delta_only = True elif arg=="-h": usage() else: @@ -153,6 +160,6 @@ def main(): rounding_time_us = 0 for line in lines: - print (convert_line(line, base_time, rounding_time_us),) + print (convert_line(line, base_time, rounding_time_us, delta_only),) main() -- 2.7.4