linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtraceevent: Allow for decimal time stamps less than zero
@ 2021-03-24 18:14 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2021-03-24 18:14 UTC (permalink / raw)
  To: Linux Trace Devel


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);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-24 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-24 18:14 [PATCH] libtraceevent: Allow for decimal time stamps less than zero Steven Rostedt

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).