Re: [PATCH v4 11/14] perf pmu-events: Parallelize JSON and metric pre-computation in jevents.py
From: Namhyung Kim
Date: Sun May 17 2026 - 20:53:10 EST
On Fri, May 15, 2026 at 04:05:40PM -0700, Ian Rogers wrote:
> On Fri, May 15, 2026 at 12:41 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > On Fri, May 15, 2026 at 10:38:48AM -0700, Ian Rogers wrote:
> > > Currently, jevents.py parses hundreds of JSON event and metric files
> > > sequentially across all CPU architectures during Kbuild startup, taking
> > > ~3.3 seconds of pure single-core execution time.
> >
> > I'm curious about this. Does it really need to parse all architectures?
> > Oh... is it for perf stat record/report?
>
> So it is controlled by JEVENTS_ARCH and JEVENTS_MODEL:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n24
> The default for JEVENTS_ARCH is SRCARCH (e.g. x86) while JEVENTS_MODEL
> defaults to "all". We have a build test for JEVENTS_ARCH is "all":
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/make?h=perf-tools-next#n74
> So saying "all CPU architectures" is a bit over the top, but not
> wholly inaccurate.
Ok, so it's all x86 models. I think it's ok to have "all" for build
tests.
>
> Fwiw, I created a script to convert CPUIDs into models:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/models.py?h=perf-tools-next
> which maybe could be used to reduce the perf binary size by building
> only the native CPU's JSON. It is a useful script for debugging :-)
Sounds like it should be used by default to pick the current model.
Thanks,
Namhyung