aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-test.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-08-08 06:22:36 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-14 16:03:49 -0400
commit6a4bb04caacc8c2d06f345130e9086e3fea38ca7 (patch)
tree96a4c4e049c303a92ababf2807b5b8044f55bf74 /tools/perf/builtin-test.c
parentf5b1135bf79557563a814e53ecd610cce663c1e3 (diff)
perf tools: Enable grouping logic for parsed events
This patch adds a functionality that allows to create event groups based on the way they are specified on the command line. Adding functionality to the '{}' group syntax introduced in earlier patch. The current '--group/-g' option behaviour remains intact. If you specify it for record/stat/top command, all the specified events become members of a single group with the first event as a group leader. With the new '{}' group syntax you can create group like: # perf record -e '{cycles,faults}' ls resulting in single event group containing 'cycles' and 'faults' events, with cycles event as group leader. All groups are created with regards to threads and cpus. Thus recording an event group within a 2 threads on server with 4 CPUs will create 8 separate groups. Examples (first event in brackets is group leader): # 1 group (cpu-clock,task-clock) perf record --group -e cpu-clock,task-clock ls perf record -e '{cpu-clock,task-clock}' ls # 2 groups (cpu-clock,task-clock) (minor-faults,major-faults) perf record -e '{cpu-clock,task-clock},{minor-faults,major-faults}' ls # 1 group (cpu-clock,task-clock,minor-faults,major-faults) perf record --group -e cpu-clock,task-clock -e minor-faults,major-faults ls perf record -e '{cpu-clock,task-clock,minor-faults,major-faults}' ls # 2 groups (cpu-clock,task-clock) (minor-faults,major-faults) perf record -e '{cpu-clock,task-clock} -e '{minor-faults,major-faults}' \ -e instructions ls # 1 group # (cpu-clock,task-clock,minor-faults,major-faults,instructions) perf record --group -e cpu-clock,task-clock \ -e minor-faults,major-faults -e instructions ls perf record -e '{cpu-clock,task-clock,minor-faults,major-faults,instructions}' ls It's possible to use standard event modifier for a group, which spans over all events in the group and updates each event modifier settings, for example: # perf record -r '{faults:k,cache-references}:p' resulting in ':kp' modifier being used for 'faults' and ':p' modifier being used for 'cache-references' event. Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ulrich Drepper <drepper@gmail.com> Link: http://lkml.kernel.org/n/tip-ho42u0wcr8mn1otkalqi13qp@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-test.c')
-rw-r--r--tools/perf/builtin-test.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 1d592f5cbea..9a479b68fc9 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -294,7 +294,7 @@ static int test__open_syscall_event(void)
294 goto out_thread_map_delete; 294 goto out_thread_map_delete;
295 } 295 }
296 296
297 if (perf_evsel__open_per_thread(evsel, threads, false, NULL) < 0) { 297 if (perf_evsel__open_per_thread(evsel, threads) < 0) {
298 pr_debug("failed to open counter: %s, " 298 pr_debug("failed to open counter: %s, "
299 "tweak /proc/sys/kernel/perf_event_paranoid?\n", 299 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
300 strerror(errno)); 300 strerror(errno));
@@ -369,7 +369,7 @@ static int test__open_syscall_event_on_all_cpus(void)
369 goto out_thread_map_delete; 369 goto out_thread_map_delete;
370 } 370 }
371 371
372 if (perf_evsel__open(evsel, cpus, threads, false, NULL) < 0) { 372 if (perf_evsel__open(evsel, cpus, threads) < 0) {
373 pr_debug("failed to open counter: %s, " 373 pr_debug("failed to open counter: %s, "
374 "tweak /proc/sys/kernel/perf_event_paranoid?\n", 374 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
375 strerror(errno)); 375 strerror(errno));
@@ -533,7 +533,7 @@ static int test__basic_mmap(void)
533 533
534 perf_evlist__add(evlist, evsels[i]); 534 perf_evlist__add(evlist, evsels[i]);
535 535
536 if (perf_evsel__open(evsels[i], cpus, threads, false, NULL) < 0) { 536 if (perf_evsel__open(evsels[i], cpus, threads) < 0) {
537 pr_debug("failed to open counter: %s, " 537 pr_debug("failed to open counter: %s, "
538 "tweak /proc/sys/kernel/perf_event_paranoid?\n", 538 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
539 strerror(errno)); 539 strerror(errno));
@@ -737,7 +737,7 @@ static int test__PERF_RECORD(void)
737 * Call sys_perf_event_open on all the fds on all the evsels, 737 * Call sys_perf_event_open on all the fds on all the evsels,
738 * grouping them if asked to. 738 * grouping them if asked to.
739 */ 739 */
740 err = perf_evlist__open(evlist, opts.group); 740 err = perf_evlist__open(evlist);
741 if (err < 0) { 741 if (err < 0) {
742 pr_debug("perf_evlist__open: %s\n", strerror(errno)); 742 pr_debug("perf_evlist__open: %s\n", strerror(errno));
743 goto out_delete_evlist; 743 goto out_delete_evlist;