History

libperf: Add perf_cpu_map__get()/perf_cpu_map__put()

Moving the following functions: cpu_map__get() cpu_map__put() to libperf with following names: perf_cpu_map__get() perf_cpu_map__put() Committer notes: Added fixes for arm/arm64

Jiri Olsa committed 7 years ago

Commit 38f01d81 parent 397721e33 files · +78 −75Browse files

Unified · Split

33 files
  1. tools/perf/arch/arm/util/cs-etm.c +3 −3
  2. tools/perf/arch/arm64/util/header.c +2 −2
  3. tools/perf/builtin-ftrace.c +1 −1
  4. tools/perf/builtin-stat.c +2 −2
  5. tools/perf/lib/cpumap.c +24 −0
  6. tools/perf/lib/include/perf/cpumap.h +2 −0
  7. tools/perf/lib/libperf.map +2 −0
  8. tools/perf/tests/bitmap.c +1 −1
  9. tools/perf/tests/code-reading.c +2 −2
  10. tools/perf/tests/cpumap.c +4 −4
  11. tools/perf/tests/event-times.c +2 −2
  12. tools/perf/tests/event_update.c +2 −2
  13. tools/perf/tests/keep-tracking.c +1 −1
  14. tools/perf/tests/mem2node.c +1 −1
  15. tools/perf/tests/mmap-basic.c +1 −1
  16. tools/perf/tests/openat-syscall-all-cpus.c +1 −1
  17. tools/perf/tests/sw-clock.c +1 −1
  18. tools/perf/tests/switch-tracking.c +1 −1
  19. tools/perf/tests/task-exit.c +1 −1
  20. tools/perf/tests/topology.c +1 −1
  21. tools/perf/util/cpumap.c +0 −22
  22. tools/perf/util/cpumap.h +0 −3
  23. tools/perf/util/cputopo.c +2 −2
  24. tools/perf/util/env.c +1 −1
  25. tools/perf/util/event.c +1 −1
  26. tools/perf/util/evlist.c +8 −8
  27. tools/perf/util/evsel.c +2 −2
  28. tools/perf/util/parse-events.c +2 −2
  29. tools/perf/util/pmu.c +1 −1
  30. tools/perf/util/python.c +1 −1
  31. tools/perf/util/record.c +3 −3
  32. tools/perf/util/session.c +1 −1
  33. tools/perf/util/svghelper.c +1 −1
tools/perf/arch/arm/util/cs-etm.c+3−3
@@ -181,7 +181,7 @@ static int cs_etm_set_option(struct auxtrace_record *itr, · 180 unmodified lines
181 181
182 err = 0;182 err = 0;
183out:183out:
184 cpu_map__put(online_cpus);184 perf_cpu_map__put(online_cpus);
185 return err;185 return err;
186}186}
187 187
@@ -517,7 +517,7 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused, · 329 unmodified lines
517 }517 }
518 }518 }
519 519
520 cpu_map__put(online_cpus);520 perf_cpu_map__put(online_cpus);
521 521
522 return (CS_ETM_HEADER_SIZE +522 return (CS_ETM_HEADER_SIZE +
523 (etmv4 * CS_ETMV4_PRIV_SIZE) +523 (etmv4 * CS_ETMV4_PRIV_SIZE) +
@@ -679,7 +679,7 @@ static int cs_etm_info_fill(struct auxtrace_record *itr, · 155 unmodified lines
679 if (cpu_map__has(cpu_map, i))679 if (cpu_map__has(cpu_map, i))
680 cs_etm_get_metadata(i, &offset, itr, info);680 cs_etm_get_metadata(i, &offset, itr, info);
681 681
682 cpu_map__put(online_cpus);682 perf_cpu_map__put(online_cpus);
683 683
684 return 0;684 return 0;
685}685}
tools/perf/arch/arm64/util/header.c+2−2
@@ -27,7 +27,7 @@ char *get_cpuid_str(struct perf_pmu *pmu) · 26 unmodified lines
27 return NULL;27 return NULL;
28 28
29 /* read midr from list of cpus mapped to this pmu */29 /* read midr from list of cpus mapped to this pmu */
30 cpus = cpu_map__get(pmu->cpus);30 cpus = perf_cpu_map__get(pmu->cpus);
31 for (cpu = 0; cpu < cpus->nr; cpu++) {31 for (cpu = 0; cpu < cpus->nr; cpu++) {
32 scnprintf(path, PATH_MAX, "%s/devices/system/cpu/cpu%d"MIDR,32 scnprintf(path, PATH_MAX, "%s/devices/system/cpu/cpu%d"MIDR,
33 sysfs, cpus->map[cpu]);33 sysfs, cpus->map[cpu]);
@@ -60,6 +60,6 @@ char *get_cpuid_str(struct perf_pmu *pmu) · 26 unmodified lines
60 buf = NULL;60 buf = NULL;
61 }61 }
62 62
63 cpu_map__put(cpus);63 perf_cpu_map__put(cpus);
64 return buf;64 return buf;
65}65}
tools/perf/builtin-ftrace.c+1−1
@@ -206,7 +206,7 @@ static int reset_tracing_cpu(void) · 205 unmodified lines
206 int ret;206 int ret;
207 207
208 ret = set_tracing_cpumask(cpumap);208 ret = set_tracing_cpumask(cpumap);
209 cpu_map__put(cpumap);209 perf_cpu_map__put(cpumap);
210 return ret;210 return ret;
211}211}
212 212
tools/perf/builtin-stat.c+2−2
@@ -933,8 +933,8 @@ static int perf_stat_init_aggr_mode(void) · 932 unmodified lines
933 933
934static void perf_stat__exit_aggr_mode(void)934static void perf_stat__exit_aggr_mode(void)
935{935{
936 cpu_map__put(stat_config.aggr_map);936 perf_cpu_map__put(stat_config.aggr_map);
937 cpu_map__put(stat_config.cpus_aggr_map);937 perf_cpu_map__put(stat_config.cpus_aggr_map);
938 stat_config.aggr_map = NULL;938 stat_config.aggr_map = NULL;
939 stat_config.cpus_aggr_map = NULL;939 stat_config.cpus_aggr_map = NULL;
940}940}
tools/perf/lib/cpumap.c+24−0
@@ -3,6 +3,8 @@ · 2 unmodified lines
3#include <stdlib.h>3#include <stdlib.h>
4#include <linux/refcount.h>4#include <linux/refcount.h>
5#include <internal/cpumap.h>5#include <internal/cpumap.h>
6#include <asm/bug.h>
7#include <stdio.h>
6 8
7struct perf_cpu_map *perf_cpu_map__dummy_new(void)9struct perf_cpu_map *perf_cpu_map__dummy_new(void)
8{10{
@@ -16,3 +18,25 @@ struct perf_cpu_map *perf_cpu_map__dummy_new(void) · 7 unmodified lines
16 18
17 return cpus;19 return cpus;
18}20}
21
22static void cpu_map__delete(struct perf_cpu_map *map)
23{
24 if (map) {
25 WARN_ONCE(refcount_read(&map->refcnt) != 0,
26 "cpu_map refcnt unbalanced\n");
27 free(map);
28 }
29}
30
31struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map)
32{
33 if (map)
34 refcount_inc(&map->refcnt);
35 return map;
36}
37
38void perf_cpu_map__put(struct perf_cpu_map *map)
39{
40 if (map && refcount_dec_and_test(&map->refcnt))
41 cpu_map__delete(map);
42}
tools/perf/lib/include/perf/cpumap.h+2−0
@@ -7,5 +7,7 @@ · 6 unmodified lines
7struct perf_cpu_map;7struct perf_cpu_map;
8 8
9LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void);9LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void);
10LIBPERF_API struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map);
11LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map);
10 12
11#endif /* __LIBPERF_CPUMAP_H */13#endif /* __LIBPERF_CPUMAP_H */
tools/perf/lib/libperf.map+2−0
@@ -2,6 +2,8 @@ LIBPERF_0.0.1 { · 1 unmodified line
2 global:2 global:
3 libperf_set_print;3 libperf_set_print;
4 perf_cpu_map__dummy_new;4 perf_cpu_map__dummy_new;
5 perf_cpu_map__get;
6 perf_cpu_map__put;
5 local:7 local:
6 *;8 *;
7};9};
tools/perf/tests/bitmap.c+1−1
@@ -21,7 +21,7 @@ static unsigned long *get_bitmap(const char *str, int nbits) · 20 unmodified lines
21 }21 }
22 22
23 if (map)23 if (map)
24 cpu_map__put(map);24 perf_cpu_map__put(map);
25 return bm;25 return bm;
26}26}
27 27
tools/perf/tests/code-reading.c+2−2
@@ -655,7 +655,7 @@ static int do_test_code_reading(bool try_kcore) · 654 unmodified lines
655 * and will be freed by following perf_evlist__set_maps655 * and will be freed by following perf_evlist__set_maps
656 * call. Getting refference to keep them alive.656 * call. Getting refference to keep them alive.
657 */657 */
658 cpu_map__get(cpus);658 perf_cpu_map__get(cpus);
659 thread_map__get(threads);659 thread_map__get(threads);
660 perf_evlist__set_maps(evlist, NULL, NULL);660 perf_evlist__set_maps(evlist, NULL, NULL);
661 evlist__delete(evlist);661 evlist__delete(evlist);
@@ -705,7 +705,7 @@ out_err: · 43 unmodified lines
705 if (evlist) {705 if (evlist) {
706 evlist__delete(evlist);706 evlist__delete(evlist);
707 } else {707 } else {
708 cpu_map__put(cpus);708 perf_cpu_map__put(cpus);
709 thread_map__put(threads);709 thread_map__put(threads);
710 }710 }
711 machine__delete_threads(machine);711 machine__delete_threads(machine);
tools/perf/tests/cpumap.c+4−4
@@ -39,7 +39,7 @@ static int process_event_mask(struct perf_tool *tool __maybe_unused, · 38 unmodified lines
39 TEST_ASSERT_VAL("wrong cpu", map->map[i] == i);39 TEST_ASSERT_VAL("wrong cpu", map->map[i] == i);
40 }40 }
41 41
42 cpu_map__put(map);42 perf_cpu_map__put(map);
43 return 0;43 return 0;
44}44}
45 45
@@ -68,7 +68,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, · 22 unmodified lines
68 TEST_ASSERT_VAL("wrong cpu", map->map[0] == 1);68 TEST_ASSERT_VAL("wrong cpu", map->map[0] == 1);
69 TEST_ASSERT_VAL("wrong cpu", map->map[1] == 256);69 TEST_ASSERT_VAL("wrong cpu", map->map[1] == 256);
70 TEST_ASSERT_VAL("wrong refcnt", refcount_read(&map->refcnt) == 1);70 TEST_ASSERT_VAL("wrong refcnt", refcount_read(&map->refcnt) == 1);
71 cpu_map__put(map);71 perf_cpu_map__put(map);
72 return 0;72 return 0;
73}73}
74 74
@@ -83,7 +83,7 @@ int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __may · 8 unmodified lines
83 TEST_ASSERT_VAL("failed to synthesize map",83 TEST_ASSERT_VAL("failed to synthesize map",
84 !perf_event__synthesize_cpu_map(NULL, cpus, process_event_mask, NULL));84 !perf_event__synthesize_cpu_map(NULL, cpus, process_event_mask, NULL));
85 85
86 cpu_map__put(cpus);86 perf_cpu_map__put(cpus);
87 87
88 /* This one is better stores in cpu values. */88 /* This one is better stores in cpu values. */
89 cpus = cpu_map__new("1,256");89 cpus = cpu_map__new("1,256");
@@ -91,7 +91,7 @@ int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __may · 1 unmodified line
91 TEST_ASSERT_VAL("failed to synthesize map",91 TEST_ASSERT_VAL("failed to synthesize map",
92 !perf_event__synthesize_cpu_map(NULL, cpus, process_event_cpus, NULL));92 !perf_event__synthesize_cpu_map(NULL, cpus, process_event_cpus, NULL));
93 93
94 cpu_map__put(cpus);94 perf_cpu_map__put(cpus);
95 return 0;95 return 0;
96}96}
97 97
tools/perf/tests/event-times.c+2−2
@@ -132,7 +132,7 @@ static int attach__cpu_disabled(struct evlist *evlist) · 131 unmodified lines
132 return err;132 return err;
133 }133 }
134 134
135 cpu_map__put(cpus);135 perf_cpu_map__put(cpus);
136 return evsel__enable(evsel);136 return evsel__enable(evsel);
137}137}
138 138
@@ -154,7 +154,7 @@ static int attach__cpu_enabled(struct evlist *evlist) · 15 unmodified lines
154 if (err == -EACCES)154 if (err == -EACCES)
155 return TEST_SKIP;155 return TEST_SKIP;
156 156
157 cpu_map__put(cpus);157 perf_cpu_map__put(cpus);
158 return err ? TEST_FAIL : TEST_OK;158 return err ? TEST_FAIL : TEST_OK;
159}159}
160 160
tools/perf/tests/event_update.c+2−2
@@ -73,7 +73,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, · 72 unmodified lines
73 TEST_ASSERT_VAL("wrong cpus", map->map[0] == 1);73 TEST_ASSERT_VAL("wrong cpus", map->map[0] == 1);
74 TEST_ASSERT_VAL("wrong cpus", map->map[1] == 2);74 TEST_ASSERT_VAL("wrong cpus", map->map[1] == 2);
75 TEST_ASSERT_VAL("wrong cpus", map->map[2] == 3);75 TEST_ASSERT_VAL("wrong cpus", map->map[2] == 3);
76 cpu_map__put(map);76 perf_cpu_map__put(map);
77 return 0;77 return 0;
78}78}
79 79
@@ -113,6 +113,6 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu · 33 unmodified lines
113 TEST_ASSERT_VAL("failed to synthesize attr update cpus",113 TEST_ASSERT_VAL("failed to synthesize attr update cpus",
114 !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus));114 !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus));
115 115
116 cpu_map__put(evsel->own_cpus);116 perf_cpu_map__put(evsel->own_cpus);
117 return 0;117 return 0;
118}118}
tools/perf/tests/keep-tracking.c+1−1
@@ -149,7 +149,7 @@ out_err: · 148 unmodified lines
149 evlist__disable(evlist);149 evlist__disable(evlist);
150 evlist__delete(evlist);150 evlist__delete(evlist);
151 } else {151 } else {
152 cpu_map__put(cpus);152 perf_cpu_map__put(cpus);
153 thread_map__put(threads);153 thread_map__put(threads);
154 }154 }
155 155
tools/perf/tests/mem2node.c+1−1
@@ -32,7 +32,7 @@ static unsigned long *get_bitmap(const char *str, int nbits) · 31 unmodified lines
32 }32 }
33 33
34 if (map)34 if (map)
35 cpu_map__put(map);35 perf_cpu_map__put(map);
36 else36 else
37 free(bm);37 free(bm);
38 38
tools/perf/tests/mmap-basic.c+1−1
@@ -155,7 +155,7 @@ out_delete_evlist: · 154 unmodified lines
155 cpus = NULL;155 cpus = NULL;
156 threads = NULL;156 threads = NULL;
157out_free_cpus:157out_free_cpus:
158 cpu_map__put(cpus);158 perf_cpu_map__put(cpus);
159out_free_threads:159out_free_threads:
160 thread_map__put(threads);160 thread_map__put(threads);
161 return err;161 return err;
tools/perf/tests/openat-syscall-all-cpus.c+1−1
@@ -120,7 +120,7 @@ out_close_fd: · 119 unmodified lines
120out_evsel_delete:120out_evsel_delete:
121 evsel__delete(evsel);121 evsel__delete(evsel);
122out_cpu_map_delete:122out_cpu_map_delete:
123 cpu_map__put(cpus);123 perf_cpu_map__put(cpus);
124out_thread_map_delete:124out_thread_map_delete:
125 thread_map__put(threads);125 thread_map__put(threads);
126 return err;126 return err;
tools/perf/tests/sw-clock.c+1−1
@@ -125,7 +125,7 @@ out_init: · 124 unmodified lines
125 }125 }
126 126
127out_free_maps:127out_free_maps:
128 cpu_map__put(cpus);128 perf_cpu_map__put(cpus);
129 thread_map__put(threads);129 thread_map__put(threads);
130out_delete_evlist:130out_delete_evlist:
131 evlist__delete(evlist);131 evlist__delete(evlist);
tools/perf/tests/switch-tracking.c+1−1
@@ -569,7 +569,7 @@ out: · 568 unmodified lines
569 evlist__disable(evlist);569 evlist__disable(evlist);
570 evlist__delete(evlist);570 evlist__delete(evlist);
571 } else {571 } else {
572 cpu_map__put(cpus);572 perf_cpu_map__put(cpus);
573 thread_map__put(threads);573 thread_map__put(threads);
574 }574 }
575 575
tools/perf/tests/task-exit.c+1−1
@@ -135,7 +135,7 @@ out_init: · 134 unmodified lines
135 }135 }
136 136
137out_free_maps:137out_free_maps:
138 cpu_map__put(cpus);138 perf_cpu_map__put(cpus);
139 thread_map__put(threads);139 thread_map__put(threads);
140out_delete_evlist:140out_delete_evlist:
141 evlist__delete(evlist);141 evlist__delete(evlist);
tools/perf/tests/topology.c+1−1
@@ -133,7 +133,7 @@ int test__session_topology(struct test *test __maybe_unused, int subtest __maybe · 132 unmodified lines
133 }133 }
134 134
135 ret = check_cpu_topology(path, map);135 ret = check_cpu_topology(path, map);
136 cpu_map__put(map);136 perf_cpu_map__put(map);
137 137
138free_path:138free_path:
139 unlink(path);139 unlink(path);
tools/perf/util/cpumap.c+0−22
@@ -273,28 +273,6 @@ struct perf_cpu_map *cpu_map__empty_new(int nr) · 272 unmodified lines
273 return cpus;273 return cpus;
274}274}
275 275
276static void cpu_map__delete(struct perf_cpu_map *map)
277{
278 if (map) {
279 WARN_ONCE(refcount_read(&map->refcnt) != 0,
280 "cpu_map refcnt unbalanced\n");
281 free(map);
282 }
283}
284
285struct perf_cpu_map *cpu_map__get(struct perf_cpu_map *map)
286{
287 if (map)
288 refcount_inc(&map->refcnt);
289 return map;
290}
291
292void cpu_map__put(struct perf_cpu_map *map)
293{
294 if (map && refcount_dec_and_test(&map->refcnt))
295 cpu_map__delete(map);
296}
297
298static int cpu__get_topology_int(int cpu, const char *name, int *value)276static int cpu__get_topology_int(int cpu, const char *name, int *value)
299{277{
300 char path[PATH_MAX];278 char path[PATH_MAX];
tools/perf/util/cpumap.h+0−3
@@ -29,9 +29,6 @@ int cpu_map__build_die_map(struct perf_cpu_map *cpus, struct perf_cpu_map **diep · 28 unmodified lines
29int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep);29int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep);
30const struct perf_cpu_map *cpu_map__online(void); /* thread unsafe */30const struct perf_cpu_map *cpu_map__online(void); /* thread unsafe */
31 31
32struct perf_cpu_map *cpu_map__get(struct perf_cpu_map *map);
33void cpu_map__put(struct perf_cpu_map *map);
34
35static inline int cpu_map__socket(struct perf_cpu_map *sock, int s)32static inline int cpu_map__socket(struct perf_cpu_map *sock, int s)
36{33{
37 if (!sock || s > sock->nr || s < 0)34 if (!sock || s > sock->nr || s < 0)
tools/perf/util/cputopo.c+2−2
@@ -219,7 +219,7 @@ struct cpu_topology *cpu_topology__new(void) · 218 unmodified lines
219 }219 }
220 220
221out_free:221out_free:
222 cpu_map__put(map);222 perf_cpu_map__put(map);
223 if (ret) {223 if (ret) {
224 cpu_topology__delete(tp);224 cpu_topology__delete(tp);
225 tp = NULL;225 tp = NULL;
@@ -335,7 +335,7 @@ struct numa_topology *numa_topology__new(void) · 109 unmodified lines
335out:335out:
336 free(buf);336 free(buf);
337 fclose(fp);337 fclose(fp);
338 cpu_map__put(node_map);338 perf_cpu_map__put(node_map);
339 return tp;339 return tp;
340}340}
341 341
tools/perf/util/env.c+1−1
@@ -179,7 +179,7 @@ void perf_env__exit(struct perf_env *env) · 178 unmodified lines
179 zfree(&env->cpu);179 zfree(&env->cpu);
180 180
181 for (i = 0; i < env->nr_numa_nodes; i++)181 for (i = 0; i < env->nr_numa_nodes; i++)
182 cpu_map__put(env->numa_nodes[i].map);182 perf_cpu_map__put(env->numa_nodes[i].map);
183 zfree(&env->numa_nodes);183 zfree(&env->numa_nodes);
184 184
185 for (i = 0; i < env->caches_cnt; i++)185 for (i = 0; i < env->caches_cnt; i++)
tools/perf/util/event.c+1−1
@@ -1403,7 +1403,7 @@ size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp) · 1402 unmodified lines
1403 else1403 else
1404 ret += fprintf(fp, "failed to get cpumap from event\n");1404 ret += fprintf(fp, "failed to get cpumap from event\n");
1405 1405
1406 cpu_map__put(cpus);1406 perf_cpu_map__put(cpus);
1407 return ret;1407 return ret;
1408}1408}
1409 1409
tools/perf/util/evlist.c+8−8
@@ -141,7 +141,7 @@ void evlist__delete(struct evlist *evlist) · 140 unmodified lines
141 141
142 perf_evlist__munmap(evlist);142 perf_evlist__munmap(evlist);
143 evlist__close(evlist);143 evlist__close(evlist);
144 cpu_map__put(evlist->cpus);144 perf_cpu_map__put(evlist->cpus);
145 thread_map__put(evlist->threads);145 thread_map__put(evlist->threads);
146 evlist->cpus = NULL;146 evlist->cpus = NULL;
147 evlist->threads = NULL;147 evlist->threads = NULL;
@@ -158,11 +158,11 @@ static void __perf_evlist__propagate_maps(struct evlist *evlist, · 10 unmodified lines
158 * keep it, if there's no target cpu list defined.158 * keep it, if there's no target cpu list defined.
159 */159 */
160 if (!evsel->own_cpus || evlist->has_user_cpus) {160 if (!evsel->own_cpus || evlist->has_user_cpus) {
161 cpu_map__put(evsel->cpus);161 perf_cpu_map__put(evsel->cpus);
162 evsel->cpus = cpu_map__get(evlist->cpus);162 evsel->cpus = perf_cpu_map__get(evlist->cpus);
163 } else if (evsel->cpus != evsel->own_cpus) {163 } else if (evsel->cpus != evsel->own_cpus) {
164 cpu_map__put(evsel->cpus);164 perf_cpu_map__put(evsel->cpus);
165 evsel->cpus = cpu_map__get(evsel->own_cpus);165 evsel->cpus = perf_cpu_map__get(evsel->own_cpus);
166 }166 }
167 167
168 thread_map__put(evsel->threads);168 thread_map__put(evsel->threads);
@@ -1115,8 +1115,8 @@ void perf_evlist__set_maps(struct evlist *evlist, struct perf_cpu_map *cpus, · 946 unmodified lines
1115 * the caller to increase the reference count.1115 * the caller to increase the reference count.
1116 */1116 */
1117 if (cpus != evlist->cpus) {1117 if (cpus != evlist->cpus) {
1118 cpu_map__put(evlist->cpus);1118 perf_cpu_map__put(evlist->cpus);
1119 evlist->cpus = cpu_map__get(cpus);1119 evlist->cpus = perf_cpu_map__get(cpus);
1120 }1120 }
1121 1121
1122 if (threads != evlist->threads) {1122 if (threads != evlist->threads) {
@@ -1383,7 +1383,7 @@ static int perf_evlist__create_syswide_maps(struct evlist *evlist) · 260 unmodified lines
1383out:1383out:
1384 return err;1384 return err;
1385out_put:1385out_put:
1386 cpu_map__put(cpus);1386 perf_cpu_map__put(cpus);
1387 goto out;1387 goto out;
1388}1388}
1389 1389
tools/perf/util/evsel.c+2−2
@@ -1325,8 +1325,8 @@ void perf_evsel__exit(struct evsel *evsel) · 1324 unmodified lines
1325 perf_evsel__free_id(evsel);1325 perf_evsel__free_id(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 cpu_map__put(evsel->cpus);1328 perf_cpu_map__put(evsel->cpus);
1329 cpu_map__put(evsel->own_cpus);1329 perf_cpu_map__put(evsel->own_cpus);
1330 thread_map__put(evsel->threads);1330 thread_map__put(evsel->threads);
1331 zfree(&evsel->group_name);1331 zfree(&evsel->group_name);
1332 zfree(&evsel->name);1332 zfree(&evsel->name);
tools/perf/util/parse-events.c+2−2
@@ -332,8 +332,8 @@ __add_event(struct list_head *list, int *idx, · 331 unmodified lines
332 return NULL;332 return NULL;
333 333
334 (*idx)++;334 (*idx)++;
335 evsel->cpus = cpu_map__get(cpus);335 evsel->cpus = perf_cpu_map__get(cpus);
336 evsel->own_cpus = cpu_map__get(cpus);336 evsel->own_cpus = perf_cpu_map__get(cpus);
337 evsel->system_wide = pmu ? pmu->is_uncore : false;337 evsel->system_wide = pmu ? pmu->is_uncore : false;
338 evsel->auto_merge_stats = auto_merge_stats;338 evsel->auto_merge_stats = auto_merge_stats;
339 339
tools/perf/util/pmu.c+1−1
@@ -626,7 +626,7 @@ static bool pmu_is_uncore(const char *name) · 625 unmodified lines
626 626
627 snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name);627 snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name);
628 cpus = __pmu_cpumask(path);628 cpus = __pmu_cpumask(path);
629 cpu_map__put(cpus);629 perf_cpu_map__put(cpus);
630 630
631 return !!cpus;631 return !!cpus;
632}632}
tools/perf/util/python.c+1−1
@@ -557,7 +557,7 @@ static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus, · 556 unmodified lines
557 557
558static void pyrf_cpu_map__delete(struct pyrf_cpu_map *pcpus)558static void pyrf_cpu_map__delete(struct pyrf_cpu_map *pcpus)
559{559{
560 cpu_map__put(pcpus->cpus);560 perf_cpu_map__put(pcpus->cpus);
561 Py_TYPE(pcpus)->tp_free((PyObject*)pcpus);561 Py_TYPE(pcpus)->tp_free((PyObject*)pcpus);
562}562}
563 563
tools/perf/util/record.c+3−3
@@ -67,7 +67,7 @@ static bool perf_probe_api(setup_probe_fn_t fn) · 66 unmodified lines
67 if (!cpus)67 if (!cpus)
68 return false;68 return false;
69 cpu = cpus->map[0];69 cpu = cpus->map[0];
70 cpu_map__put(cpus);70 perf_cpu_map__put(cpus);
71 71
72 do {72 do {
73 ret = perf_do_probe_api(fn, cpu, try[i++]);73 ret = perf_do_probe_api(fn, cpu, try[i++]);
@@ -122,7 +122,7 @@ bool perf_can_record_cpu_wide(void) · 48 unmodified lines
122 if (!cpus)122 if (!cpus)
123 return false;123 return false;
124 cpu = cpus->map[0];124 cpu = cpus->map[0];
125 cpu_map__put(cpus);125 perf_cpu_map__put(cpus);
126 126
127 fd = sys_perf_event_open(&attr, -1, cpu, -1, 0);127 fd = sys_perf_event_open(&attr, -1, cpu, -1, 0);
128 if (fd < 0)128 if (fd < 0)
@@ -278,7 +278,7 @@ bool perf_evlist__can_select_event(struct evlist *evlist, const char *str) · 149 unmodified lines
278 struct perf_cpu_map *cpus = cpu_map__new(NULL);278 struct perf_cpu_map *cpus = cpu_map__new(NULL);
279 279
280 cpu = cpus ? cpus->map[0] : 0;280 cpu = cpus ? cpus->map[0] : 0;
281 cpu_map__put(cpus);281 perf_cpu_map__put(cpus);
282 } else {282 } else {
283 cpu = evlist->cpus->map[0];283 cpu = evlist->cpus->map[0];
284 }284 }
tools/perf/util/session.c+1−1
@@ -2310,7 +2310,7 @@ int perf_session__cpu_bitmap(struct perf_session *session, · 2309 unmodified lines
2310 err = 0;2310 err = 0;
2311 2311
2312out_delete_map:2312out_delete_map:
2313 cpu_map__put(map);2313 perf_cpu_map__put(map);
2314 return err;2314 return err;
2315}2315}
2316 2316
tools/perf/util/svghelper.c+1−1
@@ -745,7 +745,7 @@ static int str_to_bitmap(char *s, cpumask_t *b) · 744 unmodified lines
745 set_bit(c, cpumask_bits(b));745 set_bit(c, cpumask_bits(b));
746 }746 }
747 747
748 cpu_map__put(m);748 perf_cpu_map__put(m);
749 749
750 return ret;750 return ret;
751}751}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t