diff options
-rw-r--r-- | tools/perf/builtin-top.c | 6 | ||||
-rw-r--r-- | tools/perf/tests/mmap-basic.c | 3 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 6 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 31a7c51aac76..a30647487ba3 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -910,10 +910,8 @@ static void perf_top__start_counters(struct perf_top *top) | |||
910 | attr->sample_freq = top->freq; | 910 | attr->sample_freq = top->freq; |
911 | } | 911 | } |
912 | 912 | ||
913 | if (evlist->nr_entries > 1) { | 913 | if (evlist->nr_entries > 1) |
914 | perf_evsel__set_sample_bit(counter, ID); | 914 | perf_evsel__set_sample_id(counter); |
915 | attr->read_format |= PERF_FORMAT_ID; | ||
916 | } | ||
917 | 915 | ||
918 | if (perf_target__has_cpu(&top->target)) | 916 | if (perf_target__has_cpu(&top->target)) |
919 | perf_evsel__set_sample_bit(counter, CPU); | 917 | perf_evsel__set_sample_bit(counter, CPU); |
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index 4743b6d7a09a..cdd50755af51 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
@@ -70,8 +70,7 @@ int test__basic_mmap(void) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | evsels[i]->attr.wakeup_events = 1; | 72 | evsels[i]->attr.wakeup_events = 1; |
73 | evsels[i]->attr.read_format |= PERF_FORMAT_ID; | 73 | perf_evsel__set_sample_id(evsels[i]); |
74 | perf_evsel__set_sample_bit(evsels[i], ID); | ||
75 | 74 | ||
76 | perf_evlist__add(evlist, evsels[i]); | 75 | perf_evlist__add(evlist, evsels[i]); |
77 | 76 | ||
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index fc80f5a32fa6..9dde7e933be9 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -68,6 +68,12 @@ void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel, | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | void perf_evsel__set_sample_id(struct perf_evsel *evsel) | ||
72 | { | ||
73 | perf_evsel__set_sample_bit(evsel, ID); | ||
74 | evsel->attr.read_format |= PERF_FORMAT_ID; | ||
75 | } | ||
76 | |||
71 | void perf_evsel__init(struct perf_evsel *evsel, | 77 | void perf_evsel__init(struct perf_evsel *evsel, |
72 | struct perf_event_attr *attr, int idx) | 78 | struct perf_event_attr *attr, int idx) |
73 | { | 79 | { |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 739853969243..5c089775064f 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -129,6 +129,8 @@ void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel, | |||
129 | #define perf_evsel__reset_sample_bit(evsel, bit) \ | 129 | #define perf_evsel__reset_sample_bit(evsel, bit) \ |
130 | __perf_evsel__reset_sample_bit(evsel, PERF_SAMPLE_##bit) | 130 | __perf_evsel__reset_sample_bit(evsel, PERF_SAMPLE_##bit) |
131 | 131 | ||
132 | void perf_evsel__set_sample_id(struct perf_evsel *evsel); | ||
133 | |||
132 | int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads, | 134 | int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads, |
133 | const char *filter); | 135 | const char *filter); |
134 | 136 | ||