as there was no proposed solution that helped me in response to the same post by Andrew Steets, I would like to know if it is possible to disable/enable perf event counters from the source code?

calling prctl(PR_TASK_PERF_EVENTS_DISABLE) has no effect, nor does compiling with -fno-omit-frame-pointer option.

It would be extremely useful to disable perf event counters for some parts of code and re-enable them for other parts of code, like:

prctl(PR_TASK_PERF_EVENTS_DISABLE);
// not important for performance analysis code
prctl(PR_TASK_PERF_EVENTS_ENABLE);
// code that needs to be analysed

and then, run perf:

$ perf record ./program
$ perf report

Can anyone tell me how can I enable such functionality?
Thank you

--Oleg
--
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

Reply via email to