Re: perf: prctl(PR_TASK_PERF_EVENTS_DISABLE) has no effect

From: Ingo Molnar
Date: Mon Jan 30 2012 - 06:31:27 EST



* Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:

> On Mon, 2012-01-30 at 11:11 +0100, Ingo Molnar wrote:
> > So, what workflow are you suggesting to Andrew?
>
> Librarize perf record, then in your code do something like:
>
> #include "perf_record.h"

Maybe. (and then it shouldnt be limited to perf_record.h but
should be events.h plus libevents.so or such)

>
> handle = perf_record_init(); /* creates perf events and creates
> a record thread that writes samples
> to perf.data, consumes env(PERF_*)
> for configuration, registers with
> at_exit() for cleanup */
> if (!handle)
> /* burn */
>
> /* do you other code */
>
> perf_record_start(handle);
>
> /* do the bit you want profiled */
>
> perf_record_stop(handle);
>
> Then build with -lperfrecord or so. Not too hard, right?

Isnt a simple prctl() so much easier and faster?

What's your concern with the prctl()? This would arguably be the
right kind of usage for prctl(): it's an established API/ABI for
process/task-wide settings.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/