diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-08-06 05:35:19 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-09-25 08:51:46 -0400 |
commit | 648b5af3f3ae7f4fad7395c8dc84cb79eafe2ba9 (patch) | |
tree | 86619a0fb6a508bb1fe98b400f57a760612d08ff /tools | |
parent | 65aa2e6bae3658cbc84c2e628a5c0ca163686204 (diff) |
libperf: Move 'system_wide' from 'struct evsel' to 'struct perf_evsel'
Move the 'system_wide 'member from perf's evsel to libperf's perf_evsel.
Committer notes:
Added stdbool.h as we now use bool here.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lore.kernel.org/lkml/20190913132355.21634-20-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/arch/x86/util/intel-pt.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-script.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 4 | ||||
-rw-r--r-- | tools/perf/lib/include/internal/evsel.h | 2 | ||||
-rw-r--r-- | tools/perf/tests/switch-tracking.c | 6 | ||||
-rw-r--r-- | tools/perf/util/evlist.c | 10 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 8 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 1 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 2 | ||||
-rw-r--r-- | tools/perf/util/stat.c | 2 |
10 files changed, 21 insertions, 20 deletions
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index 34d7118bf390..1aa86a88884a 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c | |||
@@ -422,7 +422,7 @@ static int intel_pt_track_switches(struct evlist *evlist) | |||
422 | perf_evsel__set_sample_bit(evsel, CPU); | 422 | perf_evsel__set_sample_bit(evsel, CPU); |
423 | perf_evsel__set_sample_bit(evsel, TIME); | 423 | perf_evsel__set_sample_bit(evsel, TIME); |
424 | 424 | ||
425 | evsel->system_wide = true; | 425 | evsel->core.system_wide = true; |
426 | evsel->no_aux_samples = true; | 426 | evsel->no_aux_samples = true; |
427 | evsel->immediate = true; | 427 | evsel->immediate = true; |
428 | 428 | ||
@@ -723,7 +723,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, | |||
723 | switch_evsel->core.attr.sample_period = 1; | 723 | switch_evsel->core.attr.sample_period = 1; |
724 | switch_evsel->core.attr.context_switch = 1; | 724 | switch_evsel->core.attr.context_switch = 1; |
725 | 725 | ||
726 | switch_evsel->system_wide = true; | 726 | switch_evsel->core.system_wide = true; |
727 | switch_evsel->no_aux_samples = true; | 727 | switch_evsel->no_aux_samples = true; |
728 | switch_evsel->immediate = true; | 728 | switch_evsel->immediate = true; |
729 | 729 | ||
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index a17a9306bdf6..e7a49e2d7575 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -1916,7 +1916,7 @@ static void __process_stat(struct evsel *counter, u64 tstamp) | |||
1916 | int cpu, thread; | 1916 | int cpu, thread; |
1917 | static int header_printed; | 1917 | static int header_printed; |
1918 | 1918 | ||
1919 | if (counter->system_wide) | 1919 | if (counter->core.system_wide) |
1920 | nthreads = 1; | 1920 | nthreads = 1; |
1921 | 1921 | ||
1922 | if (!header_printed) { | 1922 | if (!header_printed) { |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index f7d13326b830..0d55eb6bd6e2 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -278,7 +278,7 @@ static int read_counter(struct evsel *counter, struct timespec *rs) | |||
278 | if (!counter->supported) | 278 | if (!counter->supported) |
279 | return -ENOENT; | 279 | return -ENOENT; |
280 | 280 | ||
281 | if (counter->system_wide) | 281 | if (counter->core.system_wide) |
282 | nthreads = 1; | 282 | nthreads = 1; |
283 | 283 | ||
284 | for (thread = 0; thread < nthreads; thread++) { | 284 | for (thread = 0; thread < nthreads; thread++) { |
@@ -1671,7 +1671,7 @@ static void setup_system_wide(int forks) | |||
1671 | struct evsel *counter; | 1671 | struct evsel *counter; |
1672 | 1672 | ||
1673 | evlist__for_each_entry(evsel_list, counter) { | 1673 | evlist__for_each_entry(evsel_list, counter) { |
1674 | if (!counter->system_wide) | 1674 | if (!counter->core.system_wide) |
1675 | return; | 1675 | return; |
1676 | } | 1676 | } |
1677 | 1677 | ||
diff --git a/tools/perf/lib/include/internal/evsel.h b/tools/perf/lib/include/internal/evsel.h index 8b854d1c9b45..1bff789b0923 100644 --- a/tools/perf/lib/include/internal/evsel.h +++ b/tools/perf/lib/include/internal/evsel.h | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/perf_event.h> | 6 | #include <linux/perf_event.h> |
7 | #include <stdbool.h> | ||
7 | 8 | ||
8 | struct perf_cpu_map; | 9 | struct perf_cpu_map; |
9 | struct perf_thread_map; | 10 | struct perf_thread_map; |
@@ -18,6 +19,7 @@ struct perf_evsel { | |||
18 | 19 | ||
19 | /* parse modifier helper */ | 20 | /* parse modifier helper */ |
20 | int nr_members; | 21 | int nr_members; |
22 | bool system_wide; | ||
21 | }; | 23 | }; |
22 | 24 | ||
23 | int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads); | 25 | int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads); |
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index e5c3f2ee223a..de700aad1fed 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c | |||
@@ -144,7 +144,7 @@ static int process_sample_event(struct evlist *evlist, | |||
144 | return err; | 144 | return err; |
145 | /* | 145 | /* |
146 | * Check for no missing sched_switch events i.e. that the | 146 | * Check for no missing sched_switch events i.e. that the |
147 | * evsel->system_wide flag has worked. | 147 | * evsel->core.system_wide flag has worked. |
148 | */ | 148 | */ |
149 | if (switch_tracking->tids[cpu] != -1 && | 149 | if (switch_tracking->tids[cpu] != -1 && |
150 | switch_tracking->tids[cpu] != prev_tid) { | 150 | switch_tracking->tids[cpu] != prev_tid) { |
@@ -316,7 +316,7 @@ out_free_nodes: | |||
316 | * | 316 | * |
317 | * This function implements a test that checks that sched_switch events and | 317 | * This function implements a test that checks that sched_switch events and |
318 | * tracking events can be recorded for a workload (current process) using the | 318 | * tracking events can be recorded for a workload (current process) using the |
319 | * evsel->system_wide and evsel->tracking flags (respectively) with other events | 319 | * evsel->core.system_wide and evsel->tracking flags (respectively) with other events |
320 | * sometimes enabled or disabled. | 320 | * sometimes enabled or disabled. |
321 | */ | 321 | */ |
322 | int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_unused) | 322 | int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_unused) |
@@ -396,7 +396,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ | |||
396 | perf_evsel__set_sample_bit(switch_evsel, CPU); | 396 | perf_evsel__set_sample_bit(switch_evsel, CPU); |
397 | perf_evsel__set_sample_bit(switch_evsel, TIME); | 397 | perf_evsel__set_sample_bit(switch_evsel, TIME); |
398 | 398 | ||
399 | switch_evsel->system_wide = true; | 399 | switch_evsel->core.system_wide = true; |
400 | switch_evsel->no_aux_samples = true; | 400 | switch_evsel->no_aux_samples = true; |
401 | switch_evsel->immediate = true; | 401 | switch_evsel->immediate = true; |
402 | 402 | ||
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 16d47a420bc2..16866533745c 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -319,7 +319,7 @@ int perf_evlist__add_newtp(struct evlist *evlist, | |||
319 | static int perf_evlist__nr_threads(struct evlist *evlist, | 319 | static int perf_evlist__nr_threads(struct evlist *evlist, |
320 | struct evsel *evsel) | 320 | struct evsel *evsel) |
321 | { | 321 | { |
322 | if (evsel->system_wide) | 322 | if (evsel->core.system_wide) |
323 | return 1; | 323 | return 1; |
324 | else | 324 | else |
325 | return perf_thread_map__nr(evlist->core.threads); | 325 | return perf_thread_map__nr(evlist->core.threads); |
@@ -410,7 +410,7 @@ int perf_evlist__alloc_pollfd(struct evlist *evlist) | |||
410 | struct evsel *evsel; | 410 | struct evsel *evsel; |
411 | 411 | ||
412 | evlist__for_each_entry(evlist, evsel) { | 412 | evlist__for_each_entry(evlist, evsel) { |
413 | if (evsel->system_wide) | 413 | if (evsel->core.system_wide) |
414 | nfds += nr_cpus; | 414 | nfds += nr_cpus; |
415 | else | 415 | else |
416 | nfds += nr_cpus * nr_threads; | 416 | nfds += nr_cpus * nr_threads; |
@@ -536,7 +536,7 @@ static void perf_evlist__set_sid_idx(struct evlist *evlist, | |||
536 | sid->cpu = evlist->core.cpus->map[cpu]; | 536 | sid->cpu = evlist->core.cpus->map[cpu]; |
537 | else | 537 | else |
538 | sid->cpu = -1; | 538 | sid->cpu = -1; |
539 | if (!evsel->system_wide && evlist->core.threads && thread >= 0) | 539 | if (!evsel->core.system_wide && evlist->core.threads && thread >= 0) |
540 | sid->tid = perf_thread_map__pid(evlist->core.threads, thread); | 540 | sid->tid = perf_thread_map__pid(evlist->core.threads, thread); |
541 | else | 541 | else |
542 | sid->tid = -1; | 542 | sid->tid = -1; |
@@ -763,7 +763,7 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx, | |||
763 | mp->prot &= ~PROT_WRITE; | 763 | mp->prot &= ~PROT_WRITE; |
764 | } | 764 | } |
765 | 765 | ||
766 | if (evsel->system_wide && thread) | 766 | if (evsel->core.system_wide && thread) |
767 | continue; | 767 | continue; |
768 | 768 | ||
769 | cpu = perf_cpu_map__idx(evsel->core.cpus, evlist_cpu); | 769 | cpu = perf_cpu_map__idx(evsel->core.cpus, evlist_cpu); |
@@ -793,7 +793,7 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx, | |||
793 | * other events, so it should not need to be polled anyway. | 793 | * other events, so it should not need to be polled anyway. |
794 | * Therefore don't add it for polling. | 794 | * Therefore don't add it for polling. |
795 | */ | 795 | */ |
796 | if (!evsel->system_wide && | 796 | if (!evsel->core.system_wide && |
797 | __perf_evlist__add_pollfd(evlist, fd, &maps[idx], revent) < 0) { | 797 | __perf_evlist__add_pollfd(evlist, fd, &maps[idx], revent) < 0) { |
798 | perf_mmap__put(&maps[idx]); | 798 | perf_mmap__put(&maps[idx]); |
799 | return -1; | 799 | return -1; |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 502bc3d50e0d..566c9413246c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -1232,7 +1232,7 @@ int perf_evsel__alloc_id(struct evsel *evsel, int ncpus, int nthreads) | |||
1232 | if (ncpus == 0 || nthreads == 0) | 1232 | if (ncpus == 0 || nthreads == 0) |
1233 | return 0; | 1233 | return 0; |
1234 | 1234 | ||
1235 | if (evsel->system_wide) | 1235 | if (evsel->core.system_wide) |
1236 | nthreads = 1; | 1236 | nthreads = 1; |
1237 | 1237 | ||
1238 | evsel->sample_id = xyarray__new(ncpus, nthreads, sizeof(struct perf_sample_id)); | 1238 | evsel->sample_id = xyarray__new(ncpus, nthreads, sizeof(struct perf_sample_id)); |
@@ -1663,7 +1663,7 @@ static bool ignore_missing_thread(struct evsel *evsel, | |||
1663 | return false; | 1663 | return false; |
1664 | 1664 | ||
1665 | /* The system wide setup does not work with threads. */ | 1665 | /* The system wide setup does not work with threads. */ |
1666 | if (evsel->system_wide) | 1666 | if (evsel->core.system_wide) |
1667 | return false; | 1667 | return false; |
1668 | 1668 | ||
1669 | /* The -ESRCH is perf event syscall errno for pid's not found. */ | 1669 | /* The -ESRCH is perf event syscall errno for pid's not found. */ |
@@ -1772,7 +1772,7 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus, | |||
1772 | threads = empty_thread_map; | 1772 | threads = empty_thread_map; |
1773 | } | 1773 | } |
1774 | 1774 | ||
1775 | if (evsel->system_wide) | 1775 | if (evsel->core.system_wide) |
1776 | nthreads = 1; | 1776 | nthreads = 1; |
1777 | else | 1777 | else |
1778 | nthreads = threads->nr; | 1778 | nthreads = threads->nr; |
@@ -1819,7 +1819,7 @@ retry_sample_id: | |||
1819 | for (thread = 0; thread < nthreads; thread++) { | 1819 | for (thread = 0; thread < nthreads; thread++) { |
1820 | int fd, group_fd; | 1820 | int fd, group_fd; |
1821 | 1821 | ||
1822 | if (!evsel->cgrp && !evsel->system_wide) | 1822 | if (!evsel->cgrp && !evsel->core.system_wide) |
1823 | pid = perf_thread_map__pid(threads, thread); | 1823 | pid = perf_thread_map__pid(threads, thread); |
1824 | 1824 | ||
1825 | group_fd = get_group_fd(evsel, cpu, thread); | 1825 | group_fd = get_group_fd(evsel, cpu, thread); |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 74df298acb31..f757ff449a17 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -146,7 +146,6 @@ struct evsel { | |||
146 | bool disabled; | 146 | bool disabled; |
147 | bool no_aux_samples; | 147 | bool no_aux_samples; |
148 | bool immediate; | 148 | bool immediate; |
149 | bool system_wide; | ||
150 | bool tracking; | 149 | bool tracking; |
151 | bool per_pkg; | 150 | bool per_pkg; |
152 | bool precise_max; | 151 | bool precise_max; |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 9cf1371c90a3..d7aebe9b005d 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -335,7 +335,7 @@ __add_event(struct list_head *list, int *idx, | |||
335 | (*idx)++; | 335 | (*idx)++; |
336 | evsel->core.cpus = perf_cpu_map__get(cpus); | 336 | evsel->core.cpus = perf_cpu_map__get(cpus); |
337 | evsel->core.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->core.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 | ||
341 | if (name) | 341 | if (name) |
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index fcd54342c04c..ebdd130557fb 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c | |||
@@ -336,7 +336,7 @@ static int process_counter_maps(struct perf_stat_config *config, | |||
336 | int ncpus = perf_evsel__nr_cpus(counter); | 336 | int ncpus = perf_evsel__nr_cpus(counter); |
337 | int cpu, thread; | 337 | int cpu, thread; |
338 | 338 | ||
339 | if (counter->system_wide) | 339 | if (counter->core.system_wide) |
340 | nthreads = 1; | 340 | nthreads = 1; |
341 | 341 | ||
342 | for (thread = 0; thread < nthreads; thread++) { | 342 | for (thread = 0; thread < nthreads; thread++) { |