aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/event-parse.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2019-09-19 16:51:19 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-09-25 08:51:42 -0400
commit5c8da72dc21eff32deb00638e547e2c247ebbfb0 (patch)
treef7e93ef9eb171a6a0b5606443e1acb584735cfe1 /tools/lib/traceevent/event-parse.c
parent8788d36950dae26074dc63b46eab3debb4b210b4 (diff)
libtraceevent: Round up in tep_print_event() time precision
When testing the output of the old trace-cmd compared to the one that uses the updated tep_print_event() logic, it was different in that the time stamp precision in the old format would round up to the nearest precision, where as the new logic truncates. Bring back the old method of rounding up. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: linux trace devel <linux-trace-devel@vger.kernel.org> Link: http://lore.kernel.org/lkml/20190919165119.5efa5de6@gandalf.local.home Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r--tools/lib/traceevent/event-parse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 6f842af4550b..d948475585ce 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5527,8 +5527,10 @@ static void print_event_time(struct tep_handle *tep, struct trace_seq *s,
5527 if (divstr && isdigit(*(divstr + 1))) 5527 if (divstr && isdigit(*(divstr + 1)))
5528 div = atoi(divstr + 1); 5528 div = atoi(divstr + 1);
5529 time = record->ts; 5529 time = record->ts;
5530 if (div) 5530 if (div) {
5531 time += div / 2;
5531 time /= div; 5532 time /= div;
5533 }
5532 pr = prec; 5534 pr = prec;
5533 while (pr--) 5535 while (pr--)
5534 p10 *= 10; 5536 p10 *= 10;