I am new to systemtap and would like to understand how to attach instrumentation dynamically to a production application using debug information in the application.
For a target application (example apache webserver). I would like to find the amount of time spent in the execution of a given function. i.e. i'd like to find time spent from beginning to end of a function, using the function's symbolic information. How can I do this using systemtap- Can you please give the instructions on:
In particular I would like to find out how I can use the - Debuginfo-based instrumentation for user space tracing.
Here is the reference for "Debuginfo-based information" - https://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
List the functions:
stap -L 'process("/usr/sbin/httpd").function("*").call'
Basic count of function call rates:
stap /usr/share/doc/systemtap*/examples/*/eventcount.stp \
'process("/usr/sbin/httpd").function("*").call'
Time a function:
stap -e 'probe process("/usr/sbin/httpd").function("ap_getword_conf").return {
printf("%s %d\n", ppfunc(), gettimeofday_us()-@entry(gettimeofday_us()))
}'