linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@kernel.org, peterz@infradead.org, jolsa@kernel.org,
	mingo@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 6/8] perf stat: Avoid fractional digits for integer scales
Date: Mon, 16 May 2016 14:53:14 +0200	[thread overview]
Message-ID: <20160516125314.GC10877@krava> (raw)
In-Reply-To: <1463190297-17408-7-git-send-email-andi@firstfloor.org>

On Fri, May 13, 2016 at 06:44:55PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> When the scaling factor is a full integer don't display fractional
> digits. This avoids unnecessary .00 output for topdown metrics
> with scale factors.
> 
> v2: Remove redundant check.
> Signed-off-by: Andi Kleen <ak@linux.intel.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> ---
>  tools/perf/builtin-stat.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 5645a8361de6..db84bfc0a478 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -66,6 +66,7 @@
>  #include <stdlib.h>
>  #include <sys/prctl.h>
>  #include <locale.h>
> +#include <math.h>
>  
>  #define DEFAULT_SEPARATOR	" "
>  #define CNTR_NOT_SUPPORTED	"<not supported>"
> @@ -986,12 +987,12 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
>  	const char *fmt;
>  
>  	if (csv_output) {
> -		fmt = sc != 1.0 ?  "%.2f%s" : "%.0f%s";
> +		fmt = floor(sc) != sc ?  "%.2f%s" : "%.0f%s";
>  	} else {
>  		if (big_num)
> -			fmt = sc != 1.0 ? "%'18.2f%s" : "%'18.0f%s";
> +			fmt = floor(sc) != sc ? "%'18.2f%s" : "%'18.0f%s";
>  		else
> -			fmt = sc != 1.0 ? "%18.2f%s" : "%18.0f%s";
> +			fmt = floor(sc) != sc ? "%18.2f%s" : "%18.0f%s";
>  	}
>  
>  	aggr_printout(evsel, id, nr);
> -- 
> 2.5.5
> 

  reply	other threads:[~2016-05-16 12:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-14  1:44 Add top down metrics to perf stat Andi Kleen
2016-05-14  1:44 ` [PATCH 1/8] x86/topology: Add topology_max_smt_threads() Andi Kleen
2016-05-14  1:44 ` [PATCH 2/8] perf/x86: Support sysfs files depending on SMT status Andi Kleen
2016-05-14  1:44 ` [PATCH 3/8] perf/x86/intel: Add Top Down events to Intel Core Andi Kleen
2016-05-14  1:44 ` [PATCH 4/8] perf/x86/intel: Add Top Down events to Intel Atom Andi Kleen
2016-05-14  1:44 ` [PATCH 5/8] perf/x86/intel: Use new topology_max_smt_threads() in HT leak workaround Andi Kleen
2016-05-14  1:44 ` [PATCH 6/8] perf stat: Avoid fractional digits for integer scales Andi Kleen
2016-05-16 12:53   ` Jiri Olsa [this message]
2016-05-14  1:44 ` [PATCH 7/8] perf stat: Basic support for TopDown in perf stat Andi Kleen
2016-05-14  1:44 ` [PATCH 8/8] perf stat: Add computation of TopDown formulas Andi Kleen
2016-05-20 10:23   ` Jiri Olsa
2016-05-20 13:38     ` Andi Kleen
2016-05-20 13:43       ` Jiri Olsa
2016-05-20 14:15         ` Andi Kleen
2016-05-20 13:43     ` Andi Kleen
2016-05-16 12:58 ` Add top down metrics to perf stat Jiri Olsa
2016-05-19 23:51   ` Andi Kleen
2016-05-20  9:59     ` Jiri Olsa
2016-05-20 14:18       ` Andi Kleen
2016-05-20 10:24 ` Jiri Olsa
2016-05-20  0:09 Andi Kleen
2016-05-20  0:10 ` [PATCH 6/8] perf stat: Avoid fractional digits for integer scales Andi Kleen
2016-05-23 14:36   ` Arnaldo Carvalho de Melo

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=20160516125314.GC10877@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --subject='Re: [PATCH 6/8] perf stat: Avoid fractional digits for integer scales' \
    /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

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).