diff options
| author | Adrian Hunter <adrian.hunter@intel.com> | 2013-08-31 14:50:53 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-09-02 13:58:20 -0400 |
| commit | 395c307089c9f5f0d82c63c11c79227b57bb7ac5 (patch) | |
| tree | fb0574d23782254c3781a7a21f1f11ab80121e65 /tools/perf/util | |
| parent | d22d1a2a2c224b3b378d873589ced27add7ebde4 (diff) | |
perf tests: Add 'keep tracking' test
Add a test for the newly added PERF_COUNT_SW_DUMMY event. The test
checks that tracking events continue when an event is disabled but a
dummy software event is not disabled.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1377975053-3811-4-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
| -rw-r--r-- | tools/perf/util/evlist.c | 42 | ||||
| -rw-r--r-- | tools/perf/util/evlist.h | 5 |
2 files changed, 45 insertions, 2 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 5df4ca91bed3..b8727ae45e3b 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
| @@ -246,7 +246,7 @@ void perf_evlist__disable(struct perf_evlist *evlist) | |||
| 246 | 246 | ||
| 247 | for (cpu = 0; cpu < nr_cpus; cpu++) { | 247 | for (cpu = 0; cpu < nr_cpus; cpu++) { |
| 248 | list_for_each_entry(pos, &evlist->entries, node) { | 248 | list_for_each_entry(pos, &evlist->entries, node) { |
| 249 | if (!perf_evsel__is_group_leader(pos)) | 249 | if (!perf_evsel__is_group_leader(pos) || !pos->fd) |
| 250 | continue; | 250 | continue; |
| 251 | for (thread = 0; thread < nr_threads; thread++) | 251 | for (thread = 0; thread < nr_threads; thread++) |
| 252 | ioctl(FD(pos, cpu, thread), | 252 | ioctl(FD(pos, cpu, thread), |
| @@ -264,7 +264,7 @@ void perf_evlist__enable(struct perf_evlist *evlist) | |||
| 264 | 264 | ||
| 265 | for (cpu = 0; cpu < nr_cpus; cpu++) { | 265 | for (cpu = 0; cpu < nr_cpus; cpu++) { |
| 266 | list_for_each_entry(pos, &evlist->entries, node) { | 266 | list_for_each_entry(pos, &evlist->entries, node) { |
| 267 | if (!perf_evsel__is_group_leader(pos)) | 267 | if (!perf_evsel__is_group_leader(pos) || !pos->fd) |
| 268 | continue; | 268 | continue; |
| 269 | for (thread = 0; thread < nr_threads; thread++) | 269 | for (thread = 0; thread < nr_threads; thread++) |
| 270 | ioctl(FD(pos, cpu, thread), | 270 | ioctl(FD(pos, cpu, thread), |
| @@ -273,6 +273,44 @@ void perf_evlist__enable(struct perf_evlist *evlist) | |||
| 273 | } | 273 | } |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | int perf_evlist__disable_event(struct perf_evlist *evlist, | ||
| 277 | struct perf_evsel *evsel) | ||
| 278 | { | ||
| 279 | int cpu, thread, err; | ||
| 280 | |||
| 281 | if (!evsel->fd) | ||
| 282 | return 0; | ||
| 283 | |||
| 284 | for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { | ||
| 285 | for (thread = 0; thread < evlist->threads->nr; thread++) { | ||
| 286 | err = ioctl(FD(evsel, cpu, thread), | ||
| 287 | PERF_EVENT_IOC_DISABLE, 0); | ||
| 288 | if (err) | ||
| 289 | return err; | ||
| 290 | } | ||
| 291 | } | ||
| 292 | return 0; | ||
| 293 | } | ||
| 294 | |||
| 295 | int perf_evlist__enable_event(struct perf_evlist *evlist, | ||
| 296 | struct perf_evsel *evsel) | ||
| 297 | { | ||
| 298 | int cpu, thread, err; | ||
| 299 | |||
| 300 | if (!evsel->fd) | ||
| 301 | return -EINVAL; | ||
| 302 | |||
| 303 | for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { | ||
| 304 | for (thread = 0; thread < evlist->threads->nr; thread++) { | ||
| 305 | err = ioctl(FD(evsel, cpu, thread), | ||
| 306 | PERF_EVENT_IOC_ENABLE, 0); | ||
| 307 | if (err) | ||
| 308 | return err; | ||
| 309 | } | ||
| 310 | } | ||
| 311 | return 0; | ||
| 312 | } | ||
| 313 | |||
| 276 | static int perf_evlist__alloc_pollfd(struct perf_evlist *evlist) | 314 | static int perf_evlist__alloc_pollfd(struct perf_evlist *evlist) |
| 277 | { | 315 | { |
| 278 | int nr_cpus = cpu_map__nr(evlist->cpus); | 316 | int nr_cpus = cpu_map__nr(evlist->cpus); |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 841a39405f6a..880d7139d2fb 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
| @@ -110,6 +110,11 @@ void perf_evlist__munmap(struct perf_evlist *evlist); | |||
| 110 | void perf_evlist__disable(struct perf_evlist *evlist); | 110 | void perf_evlist__disable(struct perf_evlist *evlist); |
| 111 | void perf_evlist__enable(struct perf_evlist *evlist); | 111 | void perf_evlist__enable(struct perf_evlist *evlist); |
| 112 | 112 | ||
| 113 | int perf_evlist__disable_event(struct perf_evlist *evlist, | ||
| 114 | struct perf_evsel *evsel); | ||
| 115 | int perf_evlist__enable_event(struct perf_evlist *evlist, | ||
| 116 | struct perf_evsel *evsel); | ||
| 117 | |||
| 113 | void perf_evlist__set_selected(struct perf_evlist *evlist, | 118 | void perf_evlist__set_selected(struct perf_evlist *evlist, |
| 114 | struct perf_evsel *evsel); | 119 | struct perf_evsel *evsel); |
| 115 | 120 | ||
