diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-07-21 07:24:38 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-29 17:34:45 -0400 |
commit | fe1f61b37ffada9fc7ec2c9d4ca5376b5a797dbc (patch) | |
tree | 5301cb4bad68af7cd9bdddebbe98c37bf0097c86 | |
parent | d400bd3abf2cc68df2df32047d3533faf690f404 (diff) |
libperf: Add own_cpus to struct perf_evsel
Move own_cpus from tools/perf's evsel to libbpf's perf_evsel.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-52-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/lib/include/internal/evsel.h | 1 | ||||
-rw-r--r-- | tools/perf/tests/event_update.c | 4 | ||||
-rw-r--r-- | tools/perf/util/evlist.c | 6 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 4 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 1 | ||||
-rw-r--r-- | tools/perf/util/header.c | 10 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 2 |
7 files changed, 14 insertions, 14 deletions
diff --git a/tools/perf/lib/include/internal/evsel.h b/tools/perf/lib/include/internal/evsel.h index b2c76e1a6244..d15d8ccfa3dc 100644 --- a/tools/perf/lib/include/internal/evsel.h +++ b/tools/perf/lib/include/internal/evsel.h | |||
@@ -11,6 +11,7 @@ struct perf_evsel { | |||
11 | struct list_head node; | 11 | struct list_head node; |
12 | struct perf_event_attr attr; | 12 | struct perf_event_attr attr; |
13 | struct perf_cpu_map *cpus; | 13 | struct perf_cpu_map *cpus; |
14 | struct perf_cpu_map *own_cpus; | ||
14 | }; | 15 | }; |
15 | 16 | ||
16 | #endif /* __LIBPERF_INTERNAL_EVSEL_H */ | 17 | #endif /* __LIBPERF_INTERNAL_EVSEL_H */ |
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c index 2bc5145284c0..c37ff49c07c7 100644 --- a/tools/perf/tests/event_update.c +++ b/tools/perf/tests/event_update.c | |||
@@ -109,11 +109,11 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu | |||
109 | TEST_ASSERT_VAL("failed to synthesize attr update name", | 109 | TEST_ASSERT_VAL("failed to synthesize attr update name", |
110 | !perf_event__synthesize_event_update_name(&tmp.tool, evsel, process_event_name)); | 110 | !perf_event__synthesize_event_update_name(&tmp.tool, evsel, process_event_name)); |
111 | 111 | ||
112 | evsel->own_cpus = perf_cpu_map__new("1,2,3"); | 112 | evsel->core.own_cpus = perf_cpu_map__new("1,2,3"); |
113 | 113 | ||
114 | TEST_ASSERT_VAL("failed to synthesize attr update cpus", | 114 | TEST_ASSERT_VAL("failed to synthesize attr update cpus", |
115 | !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus)); | 115 | !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus)); |
116 | 116 | ||
117 | perf_cpu_map__put(evsel->own_cpus); | 117 | perf_cpu_map__put(evsel->core.own_cpus); |
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 713968130d1d..d203305ac187 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -159,12 +159,12 @@ static void __perf_evlist__propagate_maps(struct evlist *evlist, | |||
159 | * We already have cpus for evsel (via PMU sysfs) so | 159 | * We already have cpus for evsel (via PMU sysfs) so |
160 | * keep it, if there's no target cpu list defined. | 160 | * keep it, if there's no target cpu list defined. |
161 | */ | 161 | */ |
162 | if (!evsel->own_cpus || evlist->has_user_cpus) { | 162 | if (!evsel->core.own_cpus || evlist->has_user_cpus) { |
163 | perf_cpu_map__put(evsel->core.cpus); | 163 | perf_cpu_map__put(evsel->core.cpus); |
164 | evsel->core.cpus = perf_cpu_map__get(evlist->cpus); | 164 | evsel->core.cpus = perf_cpu_map__get(evlist->cpus); |
165 | } else if (evsel->core.cpus != evsel->own_cpus) { | 165 | } else if (evsel->core.cpus != evsel->core.own_cpus) { |
166 | perf_cpu_map__put(evsel->core.cpus); | 166 | perf_cpu_map__put(evsel->core.cpus); |
167 | evsel->core.cpus = perf_cpu_map__get(evsel->own_cpus); | 167 | evsel->core.cpus = perf_cpu_map__get(evsel->core.own_cpus); |
168 | } | 168 | } |
169 | 169 | ||
170 | perf_thread_map__put(evsel->threads); | 170 | perf_thread_map__put(evsel->threads); |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 651f66ee902e..c5f6ee6d5f3b 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -1125,7 +1125,7 @@ void perf_evsel__config(struct evsel *evsel, struct record_opts *opts, | |||
1125 | attr->exclude_user = 1; | 1125 | attr->exclude_user = 1; |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | if (evsel->own_cpus || evsel->unit) | 1128 | if (evsel->core.own_cpus || evsel->unit) |
1129 | evsel->core.attr.read_format |= PERF_FORMAT_ID; | 1129 | evsel->core.attr.read_format |= PERF_FORMAT_ID; |
1130 | 1130 | ||
1131 | /* | 1131 | /* |
@@ -1326,7 +1326,7 @@ void perf_evsel__exit(struct evsel *evsel) | |||
1326 | perf_evsel__free_config_terms(evsel); | 1326 | perf_evsel__free_config_terms(evsel); |
1327 | cgroup__put(evsel->cgrp); | 1327 | cgroup__put(evsel->cgrp); |
1328 | perf_cpu_map__put(evsel->core.cpus); | 1328 | perf_cpu_map__put(evsel->core.cpus); |
1329 | perf_cpu_map__put(evsel->own_cpus); | 1329 | perf_cpu_map__put(evsel->core.own_cpus); |
1330 | perf_thread_map__put(evsel->threads); | 1330 | perf_thread_map__put(evsel->threads); |
1331 | zfree(&evsel->group_name); | 1331 | zfree(&evsel->group_name); |
1332 | zfree(&evsel->name); | 1332 | zfree(&evsel->name); |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 8ece5edf65ac..2eff837f10bd 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -123,7 +123,6 @@ struct evsel { | |||
123 | u64 db_id; | 123 | u64 db_id; |
124 | struct cgroup *cgrp; | 124 | struct cgroup *cgrp; |
125 | void *handler; | 125 | void *handler; |
126 | struct perf_cpu_map *own_cpus; | ||
127 | struct perf_thread_map *threads; | 126 | struct perf_thread_map *threads; |
128 | unsigned int sample_size; | 127 | unsigned int sample_size; |
129 | int id_pos; | 128 | int id_pos; |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index fa914ba8cd56..f97df418d661 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -3861,10 +3861,10 @@ perf_event__synthesize_event_update_cpus(struct perf_tool *tool, | |||
3861 | int max, err; | 3861 | int max, err; |
3862 | u16 type; | 3862 | u16 type; |
3863 | 3863 | ||
3864 | if (!evsel->own_cpus) | 3864 | if (!evsel->core.own_cpus) |
3865 | return 0; | 3865 | return 0; |
3866 | 3866 | ||
3867 | ev = cpu_map_data__alloc(evsel->own_cpus, &size, &type, &max); | 3867 | ev = cpu_map_data__alloc(evsel->core.own_cpus, &size, &type, &max); |
3868 | if (!ev) | 3868 | if (!ev) |
3869 | return -ENOMEM; | 3869 | return -ENOMEM; |
3870 | 3870 | ||
@@ -3874,7 +3874,7 @@ perf_event__synthesize_event_update_cpus(struct perf_tool *tool, | |||
3874 | ev->id = evsel->id[0]; | 3874 | ev->id = evsel->id[0]; |
3875 | 3875 | ||
3876 | cpu_map_data__synthesize((struct cpu_map_data *) ev->data, | 3876 | cpu_map_data__synthesize((struct cpu_map_data *) ev->data, |
3877 | evsel->own_cpus, | 3877 | evsel->core.own_cpus, |
3878 | type, max); | 3878 | type, max); |
3879 | 3879 | ||
3880 | err = process(tool, (union perf_event*) ev, NULL, NULL); | 3880 | err = process(tool, (union perf_event*) ev, NULL, NULL); |
@@ -3985,7 +3985,7 @@ int perf_event__synthesize_extra_attr(struct perf_tool *tool, | |||
3985 | } | 3985 | } |
3986 | } | 3986 | } |
3987 | 3987 | ||
3988 | if (counter->own_cpus) { | 3988 | if (counter->core.own_cpus) { |
3989 | err = perf_event__synthesize_event_update_cpus(tool, counter, process); | 3989 | err = perf_event__synthesize_event_update_cpus(tool, counter, process); |
3990 | if (err < 0) { | 3990 | if (err < 0) { |
3991 | pr_err("Couldn't synthesize evsel cpus.\n"); | 3991 | pr_err("Couldn't synthesize evsel cpus.\n"); |
@@ -4082,7 +4082,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused, | |||
4082 | 4082 | ||
4083 | map = cpu_map__new_data(&ev_cpus->cpus); | 4083 | map = cpu_map__new_data(&ev_cpus->cpus); |
4084 | if (map) | 4084 | if (map) |
4085 | evsel->own_cpus = map; | 4085 | evsel->core.own_cpus = map; |
4086 | else | 4086 | else |
4087 | pr_err("failed to get event_update cpus\n"); | 4087 | pr_err("failed to get event_update cpus\n"); |
4088 | default: | 4088 | default: |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index a27771eca9c2..8182b1e66ec6 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -334,7 +334,7 @@ __add_event(struct list_head *list, int *idx, | |||
334 | 334 | ||
335 | (*idx)++; | 335 | (*idx)++; |
336 | evsel->core.cpus = perf_cpu_map__get(cpus); | 336 | evsel->core.cpus = perf_cpu_map__get(cpus); |
337 | evsel->own_cpus = perf_cpu_map__get(cpus); | 337 | evsel->core.own_cpus = perf_cpu_map__get(cpus); |
338 | evsel->system_wide = pmu ? pmu->is_uncore : false; | 338 | evsel->system_wide = pmu ? pmu->is_uncore : false; |
339 | evsel->auto_merge_stats = auto_merge_stats; | 339 | evsel->auto_merge_stats = auto_merge_stats; |
340 | 340 | ||