On 11/17/2010 05:58 PM, Thomas Gleixner wrote:> >> > Filtering is also useful for fine-grained perf events; this cannot be done in> > userspace.>> Could you explain that a bit more detailed please ?

I have a tracepoint kvm:kvm_exit which is called every time a guest exits to the host (for whatever reason). The first step in profiling kvm is checking the rate at which this tracepoint is triggered.

(I have a small tool kvm_stat which shows a 'perf top' like display, except that instead of showing functions, it shows kvm tracepoints sorted by triggering rate)

If you see a high exit rate, you may also be interested in what exit reasons triggered those exits. So kvm_stat creates additional events, one per possible exit_reason (which is a field in the kvm_exit tracepoint), with a filter matching exit_reason to the enum describing the possible exit reasons. We add that to the display and get a sort of histogram showing which exit_reason is responsible for how many exits.