User: Password:
|
|
Subscribe / Log in / New account

Scripting support for perf

Scripting support for perf

Posted Feb 11, 2010 6:34 UTC (Thu) by prasadkr (subscriber, #44457)
Parent article: Scripting support for perf

While the scripting support for perf-events is a very useful feature...was wondering if anybody has seen what it takes to have 'live' reporting of data (through perf and hence the script) as opposed to the two-step process - for perf data collection followed by analysis using script?


(Log in to post comments)

live reporting of data

Posted Feb 11, 2010 9:42 UTC (Thu) by mjw (subscriber, #16740) [Link]

You would need pre-filtering/aggregating for that, not post-process scripting. You can do something like that with for example systemtap which filters and can aggregate values at probe point hit time, so the only data being recorded is that which is needed for the live reporting. e.g. live (top like) reporting failed syscalls with argument strings would be done by errsnoop.stp
$ stap errsnoop.stp
          SYSCALL         PROCESS   PID HITS ERRSTR       ARGSTR
inotify_add_watch gdm-simple-gree  2569    2  13 (EACCES) 18, "/home/mark", 16789454
             open hald-addon-stor  2178    1 123 (ENOMEDIUM) "/dev/sdh", O_RDONLY
             open hald-addon-stor  2175    1 123 (ENOMEDIUM) "/dev/sde", O_RDONLY
             open hald-addon-stor  2177    1 123 (ENOMEDIUM) "/dev/sdg", O_RDONLY
             open hald-addon-stor  2174    1 123 (ENOMEDIUM) "/dev/sdd", O_RDONLY
             open hald-addon-stor  2176    1 123 (ENOMEDIUM) "/dev/sdf", O_RDONLY
             open        sendmail  2291    1   6 (ENXIO)  "/proc/loadavg", O_RDONLY
And you can then let it simple run to see live what silly things user space programs are doing. Some other systemtap process examples.

Scripting support for perf

Posted Feb 11, 2010 16:23 UTC (Thu) by trz (subscriber, #7752) [Link]

'Live' reporting should be just a short step away - to do that we could stick a pipe in between the 'record' and 'report' steps e.g.

$ perf trace record myscript | perf trace report myscript

or more simply just get rid of the two steps and combine them into one:

$ perf trace myscript

Currently, perf isn't pipe-friendly mainly because of the header-read/write code, which pre-allocates space in the file and does a lot of seeking to fill in length and offset fields later. That works nicely for a file, but presents problems if you want to feed it into a pipe.

I think if some changes were made to that part of the code, the rest would follow naturally. I plan to look into it soon and hopefully post some patches to enable it.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds