systemtap 화염 도 생 성
7145 단어 동적 추적
global bt;
global quit = 0
probe timer.profile
{
if (pid() == target())
{
if (!quit)
{
bt[backtrace(), ubacktrace()] <<<1
}
else
{
foreach ([sys, usr] in bt- limit 1000)
{
print_stack(sys)
print_ustack(usr)
printf("\t%d
", @count(bt[sys, usr]))
}
exit()
}
}
}
probe timer.s(20) {
quit = 1
}
tick , ,20s , 。 fire.stp。
4、 nginx
ab、polygraph nginx , , :
stap
--ldd
-d /usr/local/nginx/sbin/nginx \
--all
-modules
-D MAXMAPENTRIES
=
10240 \
-D MAXACTION
=
20000 \
-D MAXTRACE
=
100 \
-D MAXSTRINGLEN
=
4096 \
-D MAXBACKTRACE
=
100
-x 1750 fire.stp
>a.out
-d , , nginx -g 。-D , , , man stap。-x , nginx work 。fire.stp ,a.out , 。
stap , :
WARNING: Missing unwind data
for module, rerun with 'stap -d stap_554dc449843d32431205d7d8e384a4e_22086'
WARNING
: _stp_read_address failed to access memory location
ERROR
: Skipped too many probes, check MAXSKIPPED
or try again with stap
-t
for more details.
WARNING
: Number of errors
:
0, skipped probes
:
105
WARNING
:
/usr
/bin
/staprun exited with status
:
1
Pass
5
: run failed. Try again with another
'--vp 00001' option.
, , Google Groups , 。 , utrace/uprobes , 。
5、
perl , FlameGraph, :
[root@FWD_YF_009_111
~]
# perl stackcollapse-stap.pl a.out > a.out2
[root@FWD_YF_009_111 ~]# perl flamegraph.pl a.out2 > a.svg
window a.svg