Re: [PATCH 10/10] perf, tools, stat: Output JSON MetricExpr metric

Jiri Olsa
2017-02-09T11:41:25Z

On Wed, Feb 08, 2017 at 01:51:05PM -0800, Andi Kleen wrote:

SNIP

> >
> > could you show an example of the MetricExpr?
>
> It's in the event list branch
>
> https://git.kernel.org/cgit/linux/kernel/git/ak/linux-misc.git/log/?h=perf/intel-uncore-json-files-3
>
> All the metrics currently do is just the same as DividedBy earlier:
> generate a percentage out of a count, typically based on clock ticks.
>
> + "MetricExpr": "(UNC_M_POWER_CHANNEL_PPD / UNC_M_CLOCKTICKS) *
> 100.",
>
>
>
> >
> > it's part of the event record, what if you wanted to have 2 or more metrics defined for event?
>
> Would need multiple copies of the event.

this ...

>
> >
> > who defines those expressions?
>
> It's metrics used internally by Intel.
>
> >
> > what if you dont provide the necessary events needed for the expression?
>
> Then perf prints a warning suggesting the events.
>
> It's currently a TODO to add them automatically. Could be added,
> but the patch was already complex, so I didn't add it.
>
> It's somewhat complicated because you would need to avoid
> duplicates and have to handle groups correctly. perf stat
> doesn't have the necessarily knowledge to fully understand
> the constraints on groups.
>
> Then the extra event may not fit into the group, and it seemed
> saner to let the user decide what to do then, instead of
> generating a possible unschedulable group.
>
> So it's not that easy to do it automatically.

and this makes me think, that this is not the right approach

adding extra copy of an event when you want to add new expression?

why can't we have another list/file of those expressions
from which point we could point and configure events we need

jirka