diff options
| author | Ian Rogers <irogers@google.com> | 2026-07-22 10:31:38 -0700 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2026-07-23 22:59:42 -0700 |
| commit | eaab2eb09dc2f86f41e8fa55243c31a274978233 (patch) | |
| tree | f730652ac432fc6a78cc2eeb4f90e55b6fbb7982 /tools/lib/python | |
| parent | 1fa8d81be1ebaf0393a5141c48916f335e26f2f2 (diff) | |
perf pmu-events: Parallelize JSON and metric pre-computation in jevents.py
Currently, jevents.py parses hundreds of JSON event and metric files
sequentially across all CPU architectures during Kbuild startup,
taking ~3.5 seconds of single-core execution time.
Refactor jevents.py to pre-populate its internal JSON AST cache in
parallel across all available CPU cores using
ProcessPoolExecutor. First gather all the paths with ftw and
collect_json, then spawn _parallel_read_json_events that starts
workers to just read the json events. Define the worker process
initializer _init_worker so that _arch_std_events is available under
spawn multiprocessing semantics.
This accelerates the JSON parsing phase by over 10x (from ~3.0s down
to ~290ms), reducing overall jevents.py execution time by 3.5x (from
~3.56s down to ~1.03s).
Tested-by: James Clark <james.clark@linaro.org>
Assisted-by: Gemini:gemini-3.1-pro-preview
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
