[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150811132532.GB1942@krava.brq.redhat.com>
Date: Tue, 11 Aug 2015 15:25:32 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
eranian@...gle.com, namhyung@...nel.org, peterz@...radead.org,
mingo@...nel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 2/9] perf, tools, stat: Support up-scaling of events
On Fri, Aug 07, 2015 at 06:06:18PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
>
> TopDown needs to multiply events by constants (for example
> the CPU Pipeline Width) to get the correct results.
> The kernel needs to export this factor.
>
> Today *.scale is only used to scale down metrics (divide), for example
> to scale bytes to MB.
>
> Repurpose negative scale to mean scaling up, that is multiplying.
> Implement the code for this in perf stat.
>
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> ---
> tools/perf/builtin-stat.c | 27 +++++++++++++++++++--------
> 1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index ea5298a..2590c75 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -179,6 +179,17 @@ static inline int nsec_counter(struct perf_evsel *evsel)
> return 0;
> }
>
> +static double scale_val(struct perf_evsel *counter, u64 val)
> +{
> + double uval = val;
> +
> + if (counter->scale < 0)
> + uval = val * (-counter->scale);
> + else if (counter->scale)
> + uval = val / counter->scale;
hum, do you change the scale logic? the current scale > 0 works like:
uval = val * counter->scale;
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists