Re: [RFC PATCH -tip 2/2 v2] add a scripts for pagecache usage perprocess

From: Frederic Weisbecker
Date: Tue Feb 23 2010 - 12:54:19 EST


On Mon, Feb 01, 2010 at 02:17:35AM -0600, Tom Zanussi wrote:
> Here's one way, using the tracepoint filters - it does make a big
> difference in this case.
>
> Before (using the new -P option, which includes perf in the trace
> data):
>
> root@tropicana:~# perf record -c 1 -f -a -M -R -e filemap:add_to_page_cache -e filemap:find_get_page -e filemap:remove_from_page_cache -P sleep 5
> [ perf record: Woken up 0 times to write data ]
> [ perf record: Captured and wrote 71.201 MB perf.data (~3110815 samples) ]
>
> After (filters out events generated by perf):
>
> root@tropicana:~# perf record -c 1 -f -a -M -R -e filemap:add_to_page_cache -e filemap:find_get_page -e filemap:remove_from_page_cache sleep 5
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.309 MB perf.data (~13479 samples) ]
>
> Tom
>
> [PATCH] perf record: filter out perf process tracepoint events
>
> The perf process itself can generate a lot of trace data, which most
> of the time isn't of any interest. This patch adds a predicate to the
> kernel tracepoint filter of each recorded event type which effectively
> screens out any event generated by perf.
>
> Assuming the common case would be to ignore perf, this makes it the
> default; the old behavior can be selected by using 'perf record -P'.


I think filtering out perf from the instrumentation is a very
desirable features.

But I see two drawbacks with this patch.
First of all, we want to keep perf as a part of the instrumentation
as a default behaviour I think, as it is a true part of the system
wide load. So I would rather suggest to keep it as a default and
have an exclude_perf option instead of include_perf.

The other downside is that this filtering only applies to ftrace events
and not to other perf events. I would expect an exclude_perf option
to apply to every events, not just a family of them.

This is not that easy though. It's trivial for a process bound
instrumentation as we only need to use enable_on_exec for that
(assuming we create the targeted process from perf).

Otherwise we need the cpu events to filter out a given context, which
needs to be done from the kernel, on events scheduling time.
It's just an idea, I'm adding more interested parties in Cc.

Thanks.

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