This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH -tip 10/10] perf probe: Accessing members in data structures
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: Frederic Weisbecker <fweisbec at gmail dot com>, Steven Rostedt <rostedt at goodmis dot org>
- Cc: Mark Wielaard <mjw at redhat dot com>, Ingo Molnar <mingo at elte dot hu>, lkml <linux-kernel at vger dot kernel dot org>, systemtap <systemtap at sources dot redhat dot com>, DLE <dle-develop at lists dot sourceforge dot net>, Arnaldo Carvalho de Melo <acme at redhat dot com>, Paul Mackerras <paulus at samba dot org>, Mike Galbraith <efault at gmx dot de>, Peter Zijlstra <a dot p dot zijlstra at chello dot nl>
- Date: Sat, 20 Mar 2010 00:20:12 -0400
- Subject: Re: [PATCH -tip 10/10] perf probe: Accessing members in data structures
- References: <20100316220515.32050.82185.stgit@localhost6.localdomain6> <20100316220626.32050.57552.stgit@localhost6.localdomain6> <1268821537.6022.12.camel@springer.wildebeest.org> <4BA12A23.4030109@redhat.com> <20100318032804.GA5045@nowhere>
Frederic Weisbecker wrote:
> On Wed, Mar 17, 2010 at 03:14:43PM -0400, Masami Hiramatsu wrote:
>> Mark Wielaard wrote:
>>> On Tue, 2010-03-16 at 18:06 -0400, Masami Hiramatsu wrote:
>>>> Support accessing members in the data structures. With this,
>>>> perf-probe accepts data-structure members(IOW, it now accepts
>>>> dot '.' and arrow '->' operators) as probe arguemnts.
>>>>
>>>> e.g.
>>>>
>>>> ./perf probe --add 'schedule:44 rq->curr'
>>>>
>>>> ./perf probe --add 'vfs_read file->f_op->read file->f_path.dentry'
>>>>
>>>> Note that '>' can be interpreted as redirection in command-line.
>>>
>>> If you find that a problem then you can do like SystemTap does and allow
>>> '.' in place of '->'. In the code you already use the
>>> perf_probe_arg_field ref flag only to check that the DIE gives you the
>>> same information. So you could just drop that and use any separator.
>>> Then you decide based on whether you see a DW_TAG_pointer_type. This
>>> gives the user some extra flexibility by letting them not having to care
>>> about specifying extra type information already available elsewhere.
>>
>> Thanks, when designing this feature, I considered it too.
>>
>> Since perf probe already support displaying source code by --line option,
>> users will read the probed code itself and try to probe it. In that case,
>> I think they naturally use '.' and '->' as they read (they might try to
>> copy & paste it).
>>
>> So, I think that it would be good to support both of '.' and '->' as
>> they are used in the code, because it will not confuse users.
>>
>> Thank you,
>
>
> Agreed.
>
> And lets people use what is common for them: expressions that follow
> C rules in the context.
>
> And those who will be more familiar with perf probe will know they can
> use the simplified "." based scheme.
Hi Frederic, Steven,
BTW, currently perf trace can't parse these 'data structure' type
field yet.
e.g.
execute following commands;
./perf probe vfs_read 'file->f_mode'
./perf record -e probe:vfs_read -afR ls -l
./perf trace
Warning: Error: expected ';' but read '->'
Warning: failed to read event format for vfs_read
Because perf trace expects that the field name should be a
C-variable name. Moreover, if perf probe supports array element,
it becomes more problematic, e.g. 'field:u8 array[8]'! oops!
what does the field contain? an array with 8 elements? or
8th element of 'array' array? :(
Should I suppose that trace event format only accept C-style
variable name for field?
Thank you,
--
Masami Hiramatsu
e-mail: mhiramat@redhat.com