Thread (8 messages) 8 messages, 2 authors, 2016-08-23

Re: Accessing sample data (like period) for trace events from python scripts

From: Milian Wolff <hidden>
Date: 2016-08-20 20:31:03

On Freitag, 19. August 2016 10:51:01 CEST Namhyung Kim wrote:
On Fri, Aug 19, 2016 at 10:35:49AM +0900, Namhyung Kim wrote:
quoted
On Wed, Aug 17, 2016 at 10:48:31AM +0200, Milian Wolff wrote:
quoted
On Wednesday, August 17, 2016 12:05:53 PM CEST Namhyung Kim wrote:
quoted
Hi Milian,

On Tue, Aug 16, 2016 at 08:42:01PM +0200, Milian Wolff wrote:
quoted
Hey all,

It doesn't seem to be possible to access the period, tid and various
other
sample fields from a python (and perl?) script using `perf script`.
My
use-
case would be analyzing a perf data file created by perf inject
--sched-stat.
I think you can access param_dict["sample"]["period"].
No, that is not possible, but would be a viable solution as well.
Sorry for late reply.  Oh, you wanted to access period of tracepoint
but I guess it's always 1, no?
OK, it seems sched_stat events have periods bigger than 1.  But you
can access it using 'runtime' or 'delay' field in the event too.  I
think sample data of tracepoint event is mostly meaningless and you
should access to the event fields for useful information.  That's why
it doesn't provide the info for tracepoint events, I guess.

What do you specifically want to know from sample data?
Using `perf inject --sched-stat`, I can get the sched_stat event period to the 
sched_switch event (which has the proper backtrace). That is the data I want 
to access. This is doable when I run:

perf script -F event,period

But it is not accessible from Perl or Python.

Note: the runtime/delay fields are not translated by perf inject, it simply 
sets the period which is then used by the other perf tools.

I really think it should be made possible to access that data from Python/
Perl.

Cheers
-- 
Milian Wolff | milian.wolff@kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help