[mirr@Mirr-N FlameGraph]$ sudo perf record -a -g -p 1 sleep 60
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.493 MB perf.data (~21534 samples) ]
[mirr@Mirr-N FlameGraph]$
STAP ( Kernel System Tap Debugging Tool )
[mirr@Mirr-N FlameGraph]$ sudo stap -s 32 -D MAXTRACE=100 -D MAXSTRINGLEN=4096 -D MAXMAPENTRIES=10240 -D MAXACTION=1000 -D STP_OVERLOAD_THRESHOLD=5000000000 --all-modules -ve 'global s; probe timer.profile { s[backtrace()] <<< 1; } probe end { foreach (i in s+) { print_stack(i); printf("\t%d\n", @count(s[i])); } } probe timer.s(60) { exit(); }' > stap.dataPass 1: parsed user script and 93 library script(s) using 208236virt/30512res/3044shr kb, in 140usr/10sys/501real ms.
Pass 2: analyzed script: 3 probe(s), 3 function(s), 0 embed(s), 1 global(s) using 209028virt/31816res/3300shr kb, in 0usr/10sys/33real ms.
Pass 3: translated to C into "/tmp/stapdr7Wfw/stap_03588c5c747120471bbc0122f9972d92_3517_src.c" using 518892virt/178072res/83636shr kb, in 3780usr/400sys/13359real ms.
Pass 4: compiled C into "stap_03588c5c747120471bbc0122f9972d92_3517.ko" in 9290usr/800sys/16043real ms.
Pass 5: starting run.
WARNING: no or bad debug frame hdr
WARNING: No binary search table for debug frame, doing slow linear search for xfs
WARNING: Unexpected DW_CFA_def_cfa_register
Pass 5: run completed in 10usr/530sys/61811real ms.
[mirr@Mirr-N FlameGraph]$
사실 Dtrace 부분은 Fedora 쪽에서 사용법이 약간 달라 (버젼인가) 직접해보진 못했다.
2. Fold Stacks
- Stack Data 들을 각 카운터 ( 이벤트 ) 별로 구분하여 라인별로 정리한다.
Stackcollapse-perf.pl, Stackcollapse-stap.pl, Stackcollapse.pl
세개로 나뉘어 각각 캡춰 데이타의 종류별로 정리를 해준다.