Add support for SystemTap profile script output, add process name prefix #4

Merged
merged 3 commits into from Nov 20, 2012

2 participants

@ackalker

This adds a command-line tool and reader for dealing with output of SystemTap profiling scripts.

To capture data using SystemTap, you can use:

# stap -e "global ubt; \
           probe timer.profile { ubt[execname(), sprint_ubacktrace()] += 1 }; \
           probe timer.s(30) { exit() }" \
       -o stap.out
$ cmd/stackcollapse-stap < stap.out > collapsed.out

Please see commit message for dealing with stap warnings about missing unwind data.

ackalker added some commits Nov 20, 2012
@ackalker ackalker lib/input-perf.js: Add process name prefix
Add process name as a prefix to each stack frame. This is
useful to better distinguish between different processes calling
functions in the same shared library:

    bar (in process 'foo')

becomes:

    foo`bar

This brings the output of this reader more in line with the others.
c7b7437
@ackalker ackalker Add support for SystemTap profile script output
Add a command-line tool and reader for dealing with output of
SystemTap profiling scripts.

To capture data using SystemTap, you can use:

$ stap -e "global ubt; \
           probe timer.profile { ubt[execname(), sprint_ubacktrace()] += 1 }; \
           probe timer.s(30) { exit() }" \
       -o stap.out
$ cmd/stackcollapse-stap < stap.out > collapsed.out

If stap warns about missing unwind data for a module, and stap
suggests adding '-d /lib/libquux.so', which you know to be a shared
library used by the 'foo' binary, add the following to the stap
command above:

       -d /path/to/foo $(ldd /path/to/foo | awk 'NF==4 { print "-d", $3 }')

You can add other stap expressions as keys to the ubt[] array, as
long as sprint_ubacktrace() remains the last key in the list.
Values of the other expressions will be added as prefixes to the
frames in the collapsed stacks, for example:

ubt[execname(), sprint_ubacktrace()]

and running some binary 'foo' which calls functions 'bar' and 'baz',
will output foo's stack frames as:

foo`bar,foo`baz

in the collapsed stacks output.
0d4c65a
@ackalker ackalker Add cmd/stackcollapse-perf and cmd/stackcollapse-stap to package.json 9ac49ca
@davepacheco davepacheco merged commit be2d8bf into joyent:master Nov 20, 2012
@ackalker

Thanks for merging :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment