On Sun, Aug 20, 2023 at 6:30 PM Yang Jihong <yangjihong1@xxxxxxxxxx> wrote:This part of the code is implemented according to Adrian's suggestion.
For dummy events that keep tracking, we may need to modify its cpu_maps.
For example, change the cpu_maps to record sideband events for all CPUS.
Add perf_evlist__go_system_wide() helper to support this scenario.
Signed-off-by: Yang Jihong <yangjihong1@xxxxxxxxxx>
Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
tools/lib/perf/evlist.c | 9 +++++++++
tools/lib/perf/include/internal/evlist.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
index b8b066d0dc5e..3acbbccc1901 100644
--- a/tools/lib/perf/evlist.c
+++ b/tools/lib/perf/evlist.c
@@ -738,3 +738,12 @@ int perf_evlist__nr_groups(struct perf_evlist *evlist)
}
return nr_groups;
}
+
+void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel)
+{
+ if (!evsel->system_wide) {
+ evsel->system_wide = true;
+ if (evlist->needs_map_propagation)
+ __perf_evlist__propagate_maps(evlist, evsel);
+ }
+}
I think this should be:
void evsel__set_system_wide(struct evsel *evsel)
{
if (evsel->system_wide)
return;
evsel->system_wide = true;
if (evsel->evlist->core.needs_map_propagation)
...
The API being on evlist makes it look like all evsels are affected.