提交 5c8da72d 编写于 作者: S Steven Rostedt (VMware) 提交者: Arnaldo Carvalho de Melo

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: NSteven 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.homeSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 8788d369
...@@ -5527,8 +5527,10 @@ static void print_event_time(struct tep_handle *tep, struct trace_seq *s, ...@@ -5527,8 +5527,10 @@ static void print_event_time(struct tep_handle *tep, struct trace_seq *s,
if (divstr && isdigit(*(divstr + 1))) if (divstr && isdigit(*(divstr + 1)))
div = atoi(divstr + 1); div = atoi(divstr + 1);
time = record->ts; time = record->ts;
if (div) if (div) {
time += div / 2;
time /= div; time /= div;
}
pr = prec; pr = prec;
while (pr--) while (pr--)
p10 *= 10; p10 *= 10;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册