perf tools: Allow system-wide events to keep their own threads
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 24 May 2022 07:54:36 +0000 (10:54 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 26 May 2022 15:36:57 +0000 (12:36 -0300)
System-wide events do not have threads, so do not propagate threads to
them.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Link: https://lore.kernel.org/r/20220524075436.29144-16-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/perf/evlist.c

index 9a6801b..e6c98a6 100644 (file)
@@ -52,8 +52,11 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
                evsel->cpus = perf_cpu_map__get(evsel->own_cpus);
        }
 
-       perf_thread_map__put(evsel->threads);
-       evsel->threads = perf_thread_map__get(evlist->threads);
+       if (!evsel->system_wide) {
+               perf_thread_map__put(evsel->threads);
+               evsel->threads = perf_thread_map__get(evlist->threads);
+       }
+
        evlist->all_cpus = perf_cpu_map__merge(evlist->all_cpus, evsel->cpus);
 }