linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] libtraceevent: Allow for decimal time stamps less than zero
Date: Wed, 24 Mar 2021 14:14:51 -0400	[thread overview]
Message-ID: <20210324141451.0b4af13b@gandalf.local.home> (raw)


From: Steven Rostedt (VMware) <rostedt@goodmis.org>

The time parsing of the time stamp should not care if the divisor is less
than the time to decide to print a decimal output or not. If it does, then
we can get output that looks like this:

       trace-cmd-4332  [006]       997355: lock_acquire:         0xffffffffb4a7ee00 fs_reclaim
       trace-cmd-4332  [006]       997356: lock_acquire:         0xffffffffb4a81480 mmu_notifier_invalidate_range_start
       trace-cmd-4332  [006]       997357: lock_release:         0xffffffffb4a81480 mmu_notifier_invalidate_range_start
       trace-cmd-4332  [006]       997357: lock_release:         0xffffffffb4a7ee00 fs_reclaim
       trace-cmd-4332  [006]       997358: kmalloc:              (tracing_buffers_splice_read+0x233) call_site=tracing_buffers_splice_read+0x233 
       trace-cmd-4240  [007]     1.000684: lock_acquire:         0xffffffffb4a3ae48 read tk_core.seq.seqcount
       trace-cmd-4240  [007]     1.000684: lock_release:         0xffffffffb4a3ae48 tk_core.seq.seqcount
       trace-cmd-4240  [007]     1.000684: irq_enable:           caller=ktime_get_coarse_real_ts64+0xc8 parent=0x0
       trace-cmd-4240  [007]     1.000685: ext4_da_write_begin:  dev 253,2 ino 4724578 pos 24150016 len 4096 flags 0

Which is obviously incorrect.

Should be:

       trace-cmd-4332  [006]     0.997355: lock_acquire:         0xffffffffb4a7ee00 fs_reclaim
       trace-cmd-4332  [006]     0.997356: lock_acquire:         0xffffffffb4a81480 mmu_notifier_invalidate_range_start
       trace-cmd-4332  [006]     0.997357: lock_release:         0xffffffffb4a81480 mmu_notifier_invalidate_range_start
       trace-cmd-4332  [006]     0.997357: lock_release:         0xffffffffb4a7ee00 fs_reclaim
       trace-cmd-4332  [006]     0.997358: kmalloc:              (tracing_buffers_splice_read+0x233) call_site=tracing_buffers_splice_read+0x233
       trace-cmd-4240  [007]     1.000684: lock_acquire:         0xffffffffb4a3ae48 read tk_core.seq.seqcount
       trace-cmd-4240  [007]     1.000684: lock_release:         0xffffffffb4a3ae48 tk_core.seq.seqcount
       trace-cmd-4240  [007]     1.000684: irq_enable:           caller=ktime_get_coarse_real_ts64+0xc8 parent=0x0
       trace-cmd-4240  [007]     1.000685: ext4_da_write_begin:  dev 253,2 ino 4724578 pos 24150016 len 4096 flags 0


Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
diff --git a/src/event-parse.c b/src/event-parse.c
index 2a10c2e..e2a7278 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -6110,7 +6110,7 @@ static void print_event_time(struct tep_handle *tep, struct trace_seq *s,
 	while (pr--)
 		p10 *= 10;
 
-	if (p10 > 1 && p10 < time)
+	if (p10 > 1)
 		trace_seq_printf(s, "%5llu.%0*llu", time / p10, prec, time % p10);
 	else
 		trace_seq_printf(s, "%12llu", time);

                 reply	other threads:[~2021-03-24 18:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210324141451.0b4af13b@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@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;
as well as URLs for NNTP newsgroup(s).