mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Erik Stromdahl <erik.stromdahl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Erik Stromdahl <erik.stromdahl@gmail.com>
Subject: [PATCH 2/2] scripts: show_delta: add --delta-only option
Date: Sat, 22 Apr 2017 19:52:33 +0200	[thread overview]
Message-ID: <1492883553-10349-3-git-send-email-erik.stromdahl@gmail.com> (raw)
In-Reply-To: <1492883553-10349-1-git-send-email-erik.stromdahl@gmail.com>

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 <erik.stromdahl@gmail.com>
---
 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

      parent reply	other threads:[~2017-04-22 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-22 17:52 [PATCH 0/2] scripts: show_delta: additional features Erik Stromdahl
2017-04-22 17:52 ` [PATCH 1/2] scripts: show_delta: add time stamp rounding option Erik Stromdahl
2017-04-22 17:52 ` Erik Stromdahl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492883553-10349-3-git-send-email-erik.stromdahl@gmail.com \
    --to=erik.stromdahl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®