On Fri, Jun 30, 2023 at 12:00 PM Ian Rogers<irogers@xxxxxxxxxx> wrote:
On Wed, Jun 28, 2023 at 3:30 AM John Garry<john.g.garry@xxxxxxxxxx> wrote:
Add a function to get the events table associated with a metric table for
struct pmu_sys_events.
We could also use something like:
struct pmu_sys_events *sys = container_of(metrics, struct pmu_sys_events,
metric_table);
to lookup struct pmu_sys_events, but that relies on the user always passing
a sys events metric struct pointer, so this way is safer, but slower.
If an event is specific to a particular PMU, shouldn't the metric name
the PMU with the event?
For example:
MetricName: "IPC",
MetricExpr: "instructions / cycles",
Here instructions and cycles can wildcard match on BIG.little/hybrid
systems and so we get an IPC metric for each PMU - although, I suspect
this isn't currently quite working. We can also, and currently, do:
MetricName: "IPC",
MetricExpr: "cpu_atom@instructions@ / cpu_atom@cycles@",
...
MetricName: "IPC",
MetricExpr: "cpu_core@instructions@ / cpu_core@cycles@",
The @ is used to avoid parsing confusion with / meaning divide. The
PMUs for the events are explicitly listed here. We could say the PMU
is implied but then it gets complex for uncore events, for metrics
that mix core and uncore events.
So looking at the later patches, they are making it so the PMU doesn't
need to be specified,
so I think it is the same issue as here. My
thought was that the PMU would always be required for metrics like
memory bandwidth per million instructions, ie >1 PMU.
I know this
makes the metrics longer, I've tried to avoid writing json metrics and
have used Python to write them in my own work:
https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/metric.py?h=perf-tools-next*n411__;Iw!!ACWV5N9M2RV99hQ!PE_9BEFVCr25fA9OHzfEDuT-MncA5pnPf5C3eTqYnXGKG9Q2OItrEIiEYz1T366HjAayQmYtZ6N6WxPJBCI$