Re: [PATCH] perf session: Add option to copy events when queueing

From: David Ahern
Date: Wed Oct 02 2013 - 08:53:23 EST


On 10/2/13 6:38 AM, Jiri Olsa wrote:
Examples hitting this problem are 'perf kvm stat live', especially with nested
VMs which generate 100,000+ traces per second, and a command processing
scheduling events with a high rate of context switching -- e.g., running
'perf bench sched pipe'.

This patch offers live commands an option to copy the event when it is
placed in
the ordered samples queue.

So I guess you have some other patch that actually sets
session::copy_on_queue?

Yes, with this patch commands have to set session->copy_on_queue to true.

My latest perf-sched-daemon code actually solves this another way: rather than asking perf-session to copy the events, the command itself does and passes the copied event to the perf-session processing code.

I like this design better because the command itself controls the allocation and free which the daemon needs because the events are added to another queue so the flow is:

read from mmmap --> copy event --> pass to session code for time ordering --> process time ordered events

The daemon puts the time ordered events into a time-limited queue and only processes the event when requested.

If that is too confusing take a look at:

https://github.com/dsahern/linux/blob/perf-sched-timehist-3.11/tools/perf/schedmon.c

process_event is the handler for sample events coming out of the mmaps. It allocates memory, copies the event and then calls perf_session_queue_event on the copy.

David

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