Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Wed, 31 May 2023 19:36:43 -0700 | Subject | [PATCH v1 1/2] perf pmu: Only warn about unsupported configs once | From | Ian Rogers <> |
| |
Avoid scanning format list for each event parsed.
Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/util/pmu.c | 5 +++++ tools/perf/util/pmu.h | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 0520aa9fe991..204ce3f02e63 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -934,6 +934,11 @@ void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu) { struct perf_pmu_format *format; + if (pmu->formats_checked) + return; + + pmu->formats_checked = true; + /* fake pmu doesn't have format list */ if (pmu == &perf_pmu__fake) return; diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 287f593b15c7..7a1535dc1f12 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -76,6 +76,11 @@ struct perf_pmu { * specific code. */ bool auxtrace; + /** + * @formats_checked: Only check PMU's formats are valid for + * perf_event_attr once. + */ + bool formats_checked; /** * @max_precise: Number of levels of :ppp precision supported by the * PMU, read from -- 2.41.0.rc0.172.g3f132b7071-goog
| ![\](/images/icornerr.gif) |