summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2009-06-30 08:07:19 +0200
committerIngo Molnar <mingo@elte.hu>2009-06-30 12:00:16 +0200
commit57e7986ed142417498155ebcd5eaf617ac37136d (patch)
tree81ce9acd79ee7e6383dfd5cdadc4e016a012990e /tools/perf/builtin-stat.c
parentperf_counter tools: Reduce perf stat measurement overhead/skew (diff)
downloadlinux-57e7986ed142417498155ebcd5eaf617ac37136d.tar.xz
linux-57e7986ed142417498155ebcd5eaf617ac37136d.zip
perf_counter: Provide a way to enable counters on exec
This provides a way to mark a counter to be enabled on the next exec. This is useful for measuring the total activity of a program without including overhead from the process that launches it. This also changes the perf stat command to use this new facility. Signed-off-by: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <19017.43927.838745.689203@cargo.ozlabs.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to '')
-rw-r--r--tools/perf/builtin-stat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 201ef2367dcb..2e03524a1de0 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -116,8 +116,9 @@ static void create_perf_stat_counter(int counter, int pid)
fd[cpu][counter], strerror(errno));
}
} else {
- attr->inherit = inherit;
- attr->disabled = 1;
+ attr->inherit = inherit;
+ attr->disabled = 1;
+ attr->enable_on_exec = 1;
fd[0][counter] = sys_perf_counter_open(attr, pid, -1, -1, 0);
if (fd[0][counter] < 0 && verbose)
@@ -262,7 +263,6 @@ static int run_perf_stat(int argc, const char **argv)
* Enable counters and exec the command:
*/
t0 = rdclock();
- prctl(PR_TASK_PERF_COUNTERS_ENABLE);
close(go_pipe[1]);
wait(&status);