linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux Trace Devel <linux-trace-devel@vger.kernel.org>,
	Jiri Olsa <jolsa@redhat.com>,
	Tzvetomir Stoyanov <tstoyanov@vmware.com>
Subject: Re: [PATCH] tools/lib/traceevent: Round up in tep_print_event() time precision
Date: Mon, 23 Sep 2019 11:24:28 -0300	[thread overview]
Message-ID: <20190923142428.GC16544@kernel.org> (raw)
In-Reply-To: <20190919165119.5efa5de6@gandalf.local.home>

Em Thu, Sep 19, 2019 at 04:51:19PM -0400, Steven Rostedt escreveu:
> 
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> 
> 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.

Thanks, applied.

- Arnaldo
 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>  tools/lib/traceevent/event-parse.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index bb22238debfe..eb84fbb49e4d 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -5517,8 +5517,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;
> -- 
> 2.20.1

-- 

- Arnaldo

      reply	other threads:[~2019-09-23 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 20:51 [PATCH] tools/lib/traceevent: Round up in tep_print_event() time precision Steven Rostedt
2019-09-23 14:24 ` Arnaldo Carvalho de Melo [this message]

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=20190923142428.GC16544@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tstoyanov@vmware.com \
    /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).