https://sourceware.org/systemtap/examples/keyword-index.html#PROFILING
抓取当前系统进程中执行的函数:
stap -L 'process("/usr/bin/ceph-osd").function("*")' | grep _do_write
打印函数调用堆栈:
stap -e 'probe process("/usr/bin/ceph-osd").function("") { printf("------------\n");print_usyms(ubacktrace());}'
抓取调用kill命令的进程
global target
global signal
probe nd_syscall.kill
{
target[tid()] = uint_arg(1);
signal[tid()] = uint_arg(2);
}
probe nd_syscall.kill.return
{
if (target[tid()] != 0) {
printf("%-6d %-12s %-5d %-6d %6d\n", pid(), execname(),
signal[tid()], target[tid()], int_arg(1));
delete target[tid()];
delete signal[tid()];
}
}