Re: [PATCH v2 17/19] perf, tools, stat: Support duration_time for metrics
From: Andi Kleen
Date: Mon Aug 28 2017 - 12:47:45 EST
On Mon, Aug 28, 2017 at 11:19:31AM +0200, Jiri Olsa wrote:
> On Fri, Aug 11, 2017 at 04:26:32PM -0700, Andi Kleen wrote:
> > From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> >
> > Some of the metrics formulas (like GFLOPs) need to know how long
> > the measurement period is. Support an internal event called duration_time, which
> > reports time in second. It maps to the dummy event, but is
> > special cased for statistics to report the walltime duration.
> >
> > So far it is not printed, but only used internally for metrics.
> >
> > Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> > ---
> > tools/perf/util/parse-events.l | 1 +
> > tools/perf/util/stat-shadow.c | 17 +++++++++++++----
> > 2 files changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
> > index fdb5bb52f01f..ea2426daf7e8 100644
> > --- a/tools/perf/util/parse-events.l
> > +++ b/tools/perf/util/parse-events.l
> > @@ -288,6 +288,7 @@ cpu-migrations|migrations { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COU
> > alignment-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); }
> > emulation-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); }
> > dummy { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); }
> > +duration_time { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); }
>
> could you please use '-' (current style) instead of '_'
This would require escaping in the expressions because - is a vaid
operator. It looks nicer with the _ and it's only used internally
anyways.
-Andi