All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 1/2] perf report: Use timestamp__scnprintf_nsec for time sort key
Date: Sun, 25 Aug 2019 11:31:13 -0300	[thread overview]
Message-ID: <20190825143113.GD26569@kernel.org> (raw)
In-Reply-To: <20190823210338.12360-1-andi@firstfloor.org>

Em Fri, Aug 23, 2019 at 02:03:37PM -0700, Andi Kleen escreveu:
> From: Andi Kleen <ak@linux.intel.com>
> 
> Use timestamp__scnprintf_nsec to print nanoseconds for the time
> sort key, instead of open coding.

Thanks, tested and applied.

- Arnaldo
 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  tools/perf/util/sort.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index f9a38a1dd4d1..0985e9072db0 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -668,17 +668,11 @@ sort__time_cmp(struct hist_entry *left, struct hist_entry *right)
>  static int hist_entry__time_snprintf(struct hist_entry *he, char *bf,
>  				    size_t size, unsigned int width)
>  {
> -	unsigned long secs;
> -	unsigned long long nsecs;
>  	char he_time[32];
>  
> -	nsecs = he->time;
> -	secs = nsecs / NSEC_PER_SEC;
> -	nsecs -= secs * NSEC_PER_SEC;
> -
>  	if (symbol_conf.nanosecs)
> -		snprintf(he_time, sizeof he_time, "%5lu.%09llu: ",
> -			 secs, nsecs);
> +		timestamp__scnprintf_nsec(he->time, he_time,
> +					  sizeof(he_time));
>  	else
>  		timestamp__scnprintf_usec(he->time, he_time,
>  					  sizeof(he_time));
> -- 
> 2.20.1

-- 

- Arnaldo

  parent reply	other threads:[~2019-08-25 14:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 21:03 [PATCH 1/2] perf report: Use timestamp__scnprintf_nsec for time sort key Andi Kleen
2019-08-23 21:03 ` [PATCH 2/2] perf report: Fix --ns time sort key output Andi Kleen
2019-08-27  8:26   ` [tip: perf/core] " tip-bot2 for Andi Kleen
2019-08-25 14:31 ` Arnaldo Carvalho de Melo [this message]
2019-08-27  8:26 ` [tip: perf/core] perf report: Use timestamp__scnprintf_nsec() for time sort key tip-bot2 for Andi Kleen

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=20190825143113.GD26569@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.