aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-01-07 04:13:58 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-01-08 12:15:43 -0500
commitd2190a8091124f832c8862ace3a3d7d70a2506a5 (patch)
treed6db172ec3034b099e4dbce4aa0c1a0f6d466dc9 /tools
parent23df7f798435796aff07d641456326b81cb34a77 (diff)
perf evlist: Remove perf_evlist__(enable|disable)_event functions
Replacing them with perf_evsel__(enable|disable). Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Noel Grandin <noelgrandin@gmail.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1452158050-28061-2-git-send-email-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-bts.c4
-rw-r--r--tools/perf/arch/x86/util/intel-pt.c4
-rw-r--r--tools/perf/tests/keep-tracking.c2
-rw-r--r--tools/perf/tests/switch-tracking.c6
-rw-r--r--tools/perf/util/evlist.c42
-rw-r--r--tools/perf/util/evlist.h4
6 files changed, 8 insertions, 54 deletions
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
index 9b94ce520917..8d8150f1cf9b 100644
--- a/tools/perf/arch/x86/util/intel-bts.c
+++ b/tools/perf/arch/x86/util/intel-bts.c
@@ -327,7 +327,7 @@ static int intel_bts_snapshot_start(struct auxtrace_record *itr)
327 327
328 evlist__for_each(btsr->evlist, evsel) { 328 evlist__for_each(btsr->evlist, evsel) {
329 if (evsel->attr.type == btsr->intel_bts_pmu->type) 329 if (evsel->attr.type == btsr->intel_bts_pmu->type)
330 return perf_evlist__disable_event(btsr->evlist, evsel); 330 return perf_evsel__disable(evsel);
331 } 331 }
332 return -EINVAL; 332 return -EINVAL;
333} 333}
@@ -340,7 +340,7 @@ static int intel_bts_snapshot_finish(struct auxtrace_record *itr)
340 340
341 evlist__for_each(btsr->evlist, evsel) { 341 evlist__for_each(btsr->evlist, evsel) {
342 if (evsel->attr.type == btsr->intel_bts_pmu->type) 342 if (evsel->attr.type == btsr->intel_bts_pmu->type)
343 return perf_evlist__enable_event(btsr->evlist, evsel); 343 return perf_evsel__enable(evsel);
344 } 344 }
345 return -EINVAL; 345 return -EINVAL;
346} 346}
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index b64d46285ebb..f05daacc9e78 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -725,7 +725,7 @@ static int intel_pt_snapshot_start(struct auxtrace_record *itr)
725 725
726 evlist__for_each(ptr->evlist, evsel) { 726 evlist__for_each(ptr->evlist, evsel) {
727 if (evsel->attr.type == ptr->intel_pt_pmu->type) 727 if (evsel->attr.type == ptr->intel_pt_pmu->type)
728 return perf_evlist__disable_event(ptr->evlist, evsel); 728 return perf_evsel__disable(evsel);
729 } 729 }
730 return -EINVAL; 730 return -EINVAL;
731} 731}
@@ -738,7 +738,7 @@ static int intel_pt_snapshot_finish(struct auxtrace_record *itr)
738 738
739 evlist__for_each(ptr->evlist, evsel) { 739 evlist__for_each(ptr->evlist, evsel) {
740 if (evsel->attr.type == ptr->intel_pt_pmu->type) 740 if (evsel->attr.type == ptr->intel_pt_pmu->type)
741 return perf_evlist__enable_event(ptr->evlist, evsel); 741 return perf_evsel__enable(evsel);
742 } 742 }
743 return -EINVAL; 743 return -EINVAL;
744} 744}
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 615813278334..ddb78fae064a 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -123,7 +123,7 @@ int test__keep_tracking(int subtest __maybe_unused)
123 123
124 evsel = perf_evlist__last(evlist); 124 evsel = perf_evlist__last(evlist);
125 125
126 CHECK__(perf_evlist__disable_event(evlist, evsel)); 126 CHECK__(perf_evsel__disable(evsel));
127 127
128 comm = "Test COMM 2"; 128 comm = "Test COMM 2";
129 CHECK__(prctl(PR_SET_NAME, (unsigned long)comm, 0, 0, 0)); 129 CHECK__(prctl(PR_SET_NAME, (unsigned long)comm, 0, 0, 0));
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index dfbd8d69ce89..ebd80168d51e 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -455,7 +455,7 @@ int test__switch_tracking(int subtest __maybe_unused)
455 455
456 perf_evlist__enable(evlist); 456 perf_evlist__enable(evlist);
457 457
458 err = perf_evlist__disable_event(evlist, cpu_clocks_evsel); 458 err = perf_evsel__disable(cpu_clocks_evsel);
459 if (err) { 459 if (err) {
460 pr_debug("perf_evlist__disable_event failed!\n"); 460 pr_debug("perf_evlist__disable_event failed!\n");
461 goto out_err; 461 goto out_err;
@@ -474,7 +474,7 @@ int test__switch_tracking(int subtest __maybe_unused)
474 goto out_err; 474 goto out_err;
475 } 475 }
476 476
477 err = perf_evlist__disable_event(evlist, cycles_evsel); 477 err = perf_evsel__disable(cycles_evsel);
478 if (err) { 478 if (err) {
479 pr_debug("perf_evlist__disable_event failed!\n"); 479 pr_debug("perf_evlist__disable_event failed!\n");
480 goto out_err; 480 goto out_err;
@@ -500,7 +500,7 @@ int test__switch_tracking(int subtest __maybe_unused)
500 goto out_err; 500 goto out_err;
501 } 501 }
502 502
503 err = perf_evlist__enable_event(evlist, cycles_evsel); 503 err = perf_evsel__enable(cycles_evsel);
504 if (err) { 504 if (err) {
505 pr_debug("perf_evlist__disable_event failed!\n"); 505 pr_debug("perf_evlist__disable_event failed!\n");
506 goto out_err; 506 goto out_err;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 29e085b2e168..d81f13de2476 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -393,48 +393,6 @@ void perf_evlist__toggle_enable(struct perf_evlist *evlist)
393 (evlist->enabled ? perf_evlist__disable : perf_evlist__enable)(evlist); 393 (evlist->enabled ? perf_evlist__disable : perf_evlist__enable)(evlist);
394} 394}
395 395
396int perf_evlist__disable_event(struct perf_evlist *evlist,
397 struct perf_evsel *evsel)
398{
399 int cpu, thread, err;
400 int nr_cpus = cpu_map__nr(evlist->cpus);
401 int nr_threads = perf_evlist__nr_threads(evlist, evsel);
402
403 if (!evsel->fd)
404 return 0;
405
406 for (cpu = 0; cpu < nr_cpus; cpu++) {
407 for (thread = 0; thread < nr_threads; thread++) {
408 err = ioctl(FD(evsel, cpu, thread),
409 PERF_EVENT_IOC_DISABLE, 0);
410 if (err)
411 return err;
412 }
413 }
414 return 0;
415}
416
417int perf_evlist__enable_event(struct perf_evlist *evlist,
418 struct perf_evsel *evsel)
419{
420 int cpu, thread, err;
421 int nr_cpus = cpu_map__nr(evlist->cpus);
422 int nr_threads = perf_evlist__nr_threads(evlist, evsel);
423
424 if (!evsel->fd)
425 return -EINVAL;
426
427 for (cpu = 0; cpu < nr_cpus; cpu++) {
428 for (thread = 0; thread < nr_threads; thread++) {
429 err = ioctl(FD(evsel, cpu, thread),
430 PERF_EVENT_IOC_ENABLE, 0);
431 if (err)
432 return err;
433 }
434 }
435 return 0;
436}
437
438static int perf_evlist__enable_event_cpu(struct perf_evlist *evlist, 396static int perf_evlist__enable_event_cpu(struct perf_evlist *evlist,
439 struct perf_evsel *evsel, int cpu) 397 struct perf_evsel *evsel, int cpu)
440{ 398{
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 3b7e1e2f1a86..7c4d9a206776 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -155,10 +155,6 @@ void perf_evlist__disable(struct perf_evlist *evlist);
155void perf_evlist__enable(struct perf_evlist *evlist); 155void perf_evlist__enable(struct perf_evlist *evlist);
156void perf_evlist__toggle_enable(struct perf_evlist *evlist); 156void perf_evlist__toggle_enable(struct perf_evlist *evlist);
157 157
158int perf_evlist__disable_event(struct perf_evlist *evlist,
159 struct perf_evsel *evsel);
160int perf_evlist__enable_event(struct perf_evlist *evlist,
161 struct perf_evsel *evsel);
162int perf_evlist__enable_event_idx(struct perf_evlist *evlist, 158int perf_evlist__enable_event_idx(struct perf_evlist *evlist,
163 struct perf_evsel *evsel, int idx); 159 struct perf_evsel *evsel, int idx);
164 160