Re: perf scripting

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tom Zanussi
Date: Friday, September 17, 2010 - 10:04 pm

Hi,

On Fri, 2010-09-17 at 19:32 +0900, Masami Hiramatsu wrote:

Rather than adding extra arguments to the handlers, how about providing
functions to get these, similar to how you can already get the 'less
common' fields of the event such as common_pc(), common_lock_depth(),
etc.  You call these during the event processing loop, giving them the
$context passed into the handler, and they in turn call perf internally
to get the data for the event.  This method can be used to get pretty
much anything out of perf internally.

So initially for callchains and callers we could have a couple functions
like:

get_callchain($context)

which would return an array of strings representing the callchain, and

get_caller($context)

which would just return the caller.

It would probably also make sense to have a raw version of at least
get_callchain() that would avoid the overhead of resolving the
callchains until a later time e.g. you should be able to use the raw
callchains as hash keys and resolve them only later when they get dumped
out in the report.  So maybe additionally something like:

get_raw_callchain($context)

which would return an array of u64 and a function to resolve a raw
callchain:

resolve_callchain($context, callchain[])

Or since in this case you need to keep the callchain and the $context
together, they could both just be contained in a callchain_object that
defines its own hash value and can be directly hashed or turned into the
string version by a callchain.tostring() method or something like that.

I don't know how soon I'll be able to implement this since I'm really
busy for the next several weeks, but if it makes sense, I can at least
try to do something for the first two (get_callchain() and
get_caller())...

Tom



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/6] vmscan: tracing: Roll up of patches curren ..., Frederic Weisbecker, (Fri Jul 30, 7:04 am)
Re: [PATCH 1/6] vmscan: tracing: Roll up of patches curren ..., Frederic Weisbecker, (Fri Jul 30, 7:15 am)
perf scripting, Christoph Hellwig, (Sat Aug 14, 1:04 pm)
Re: perf scripting, Frederic Weisbecker, (Thu Sep 16, 5:08 am)
Re: perf scripting, Masami Hiramatsu, (Fri Sep 17, 3:32 am)
Re: perf scripting, Tom Zanussi, (Fri Sep 17, 10:04 pm)