Created
March 7, 2017 23:53
-
-
Save p0pr0ck5/7aaec068ce4d5d08e9839d2fa6cb973e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function profile_fw() { | |
pushd `pwd` | |
cd ~poprocks/code/Lua/lua-resty-waf | |
make | |
popd | |
title=$1 | |
OPATH=$PATH | |
s=$(date +%s) | |
pid=$(pgrep nginx | tail -1) | |
pushd /home/poprocks/code/tools/stapxx | |
export PATH=$PWD:$PATH | |
echo "traces..." | |
./samples/ngx-lj-trace-exits.sxx -x $pid | |
echo "ljvm states..." | |
./samples/lj-vm-states.sxx -x $pid | |
echo "Timing info..." | |
./samples/ngx-lua-exec-time.sxx -x $pid | |
echo "Flame graph..." | |
#./samples/lj-lua-stacks.sxx --arg nojit=1 --skip-badvars -x $pid > ../fw_"$s".bt | |
#./samples/lj-lua-stacks.sxx --arg nointerp=1 --skip-badvars -x $pid > ../fw_"$s".bt | |
./samples/lj-lua-stacks.sxx --skip-badvars -x $pid > ../fw_"$s".bt | |
../FlameGraph/stackcollapse-stap.pl <(../nginx-systemtap-toolkit/fix-lua-bt ../fw_"$s".bt) > ../fw_"$s".cbt | |
../FlameGraph/flamegraph.pl --title=\"$title\" ../fw_"$s".cbt > ../flamegraphs/fw_"$title"_"$s".svg | |
rm ../fw_"$s".bt ../fw_"$s".cbt | |
export PATH=$OPATH | |
popd | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment