prctl(PR_TASK_PERF_EVENTS_DISABLE) doesn't appear to disable perf event
counters. Here is a demonstration program:
#include <linux/prctl.h>
void loop_events_disabled() {
volatile int x;
int i;
for (i = 0; i < 1000000000; i++)
x = i;
return;
}
void loop_events_enabled() {
volatile int x;
int i;
for (i = 0; i < 1000000000; i++)
x = i;
return;
}
int main(int argc, char **argv) {
prctl(PR_TASK_PERF_EVENTS_ENABLE);
loop_events_enabled();
prctl(PR_TASK_PERF_EVENTS_DISABLE);
loop_events_disabled();
}
I would not expect to see loop_events_disabled() show up in the profile
as reported by perf report, but it does.
$ perf record ./a.out
$ perf report -n --stdio
# Events: 3K cycles
#
# Overhead Samples Command Shared Object Symbol
# ........ .......... ....... ................. ....................
#
51.80% 1679 a.out a.out [.] loop_events_enabled
48.07% 1578 a.out a.out [.] loop_events_disabled
0.03% 5 a.out [kernel.kallsyms] [k] intel_pmu_enable_all
0.03% 1 a.out [kernel.kallsyms] [k] sched_clock
0.03% 1 a.out [kernel.kallsyms] [k] ktime_get
0.03% 1 a.out [kernel.kallsyms] [k] update_cpu_load
0.01% 1 a.out [sunrpc] [k] generic_match
I have tested this on several kernels including 3.3rc1. Can anyone tell
me if I'm using this wrong or if this is a bug?
-Andrew
--
---------------------------------------------------------------
This email, along with any attachments, is confidential. If you
believe you received this message in error, please contact the
sender immediately and delete all copies of the message.
Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html