Re: [PATCH v1 02/20] perf jevents: Add idle metric for Intel models

From: Andi Kleen
Date: Fri Mar 01 2024 - 12:50:09 EST


> +def Idle() -> Metric:
> + cyc = Event("msr/mperf/")
> + tsc = Event("msr/tsc/")
> + low = max(tsc - cyc, 0)
> + return Metric(
> + "idle",
> + "Percentage of total wallclock cycles where CPUs are in low power state (C1 or deeper sleep state)",
> + d_ratio(low, tsc), "100%")

TBH I fail to see the advantage over the JSON. That's much more verbose
and we don't expect to have really complex metrics anyways.

And then we have a gigantic patch kit for what gain?

The motivation was the lack of comments in JSON? We could just add some
to the parser (e.g. with /* */ ). And we could allow an JSON array for the
expression to get multiple lines.


-Andi