On Mon, Jul 7, 2014 at 12:16 PM, Brendan Gregg
<brendan.d.gr...@gmail.com> wrote:
> On Mon, Jul 7, 2014 at 12:00 PM, Brendan Gregg
> <brendan.d.gr...@gmail.com> wrote:
>> On Mon, Jul 7, 2014 at 11:44 AM, David Ahern <dsah...@gmail.com> wrote:
>>> On 7/7/14, 12:38 PM, Brendan Gregg wrote:
>>>>
>>>> G'Day perf users,
>>>>
>>>> Is there a way to filter perf from tracing itself?
>>>>
>>>> Here's an idle system:
>>>>
>>>> # ./perf record -e syscalls:sys_enter_read -a sleep 5
>>>> [ perf record: Woken up 2 times to write data ]
>>>> [ perf record: Captured and wrote 0.569 MB perf.data (~24864 samples) ]
>>>> # ./perf record -e syscalls:sys_enter_write -a sleep 5
>>>> [ perf record: Woken up 0 times to write data ]
>>>> [ perf record: Captured and wrote 150.381 MB perf.data (~6570251 samples)
>>>> ]
>>>>
>>>> Note the disparity. perf is capturing its own writes, creating a feedback
>>>> loop.
>>>
>>>
>>> Not a filter, but works around the problem using mmap'ed output file:
>>>
>>> https://github.com/dsahern/linux/commit/ae2d7010256f5a5b247fb4df9f764a911a34a2f3
>>>
>>
>> Ah, thanks David, that should work! Looking forward to having this
>> patch included.
>>
>
> While this should help a lot of cases, I realized I am using stdout
> from time to time as well (similar to the "perf script" framework),
> where I don't think mmap() is going to work. Eg:
>
> # perf record -e raw_syscalls:sys_enter -a -o - sleep 5 | perf script
> -i - | stuff...
>
> Maybe perf should skip itself by-default, unless asked (eg, -I to
> include perf's own events). Or some way to filter it would also work,
> eg, common_ppid.

I figured out one workaround...:

# sh -c 'exec ./perf record -e syscalls:sys_enter_write --filter
"common_pid != "$$ -a sleep 5'
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.161 MB perf.data (~7051 samples) ]

Brendan

-- 
http://www.brendangregg.com
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to