From patchwork Wed Sep 18 02:03:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 11149563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F35403AC5 for ; Wed, 18 Sep 2019 02:05:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D450421906 for ; Wed, 18 Sep 2019 02:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726622AbfIRCFc (ORCPT ); Tue, 17 Sep 2019 22:05:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:58200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726647AbfIRCFc (ORCPT ); Tue, 17 Sep 2019 22:05:32 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF54D214AF for ; Wed, 18 Sep 2019 02:05:31 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.92) (envelope-from ) id 1iAPLX-0000sT-32 for linux-trace-devel@vger.kernel.org; Tue, 17 Sep 2019 22:05:31 -0400 Message-Id: <20190918020530.974032887@goodmis.org> User-Agent: quilt/0.65 Date: Tue, 17 Sep 2019 22:03:39 -0400 From: Steven Rostedt To: linux-trace-devel@vger.kernel.org Subject: [PATCH 5/5] tools/lib/traceevent: Round up in tep_print_event() time precision References: <20190918020334.344561631@goodmis.org> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org From: "Steven Rostedt (VMware)" 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) Reviewed-by: Tzvetomir Stoyanov (VMware) --- lib/traceevent/event-parse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index d1085aab9c43..7fbbbccab78a 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -5527,8 +5527,10 @@ static void print_event_time(struct tep_handle *tep, struct trace_seq *s, if (divstr && isdigit(*(divstr + 1))) div = atoi(divstr + 1); time = record->ts; - if (div) + if (div) { + time += div / 2; time /= div; + } pr = prec; while (pr--) p10 *= 10;