forked from clasp-developers/clasp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo-flame-invert
executable file
·27 lines (24 loc) · 1015 Bytes
/
do-flame-invert
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /bin/bash
PID=$1
TIME=${2:-10s}
FRAMES=${3:-4000}
## in case there is no symbols file
#sudo rm -f /tmp/out-$1.user_stacks && sudo dtrace -p $PID -x ustackframes=${FRAMES} -n "profile-$RATE /pid == $PID && arg1 / { @[ustack()] = count(); } tick-$TIME { exit(0); }" -o /tmp/out-$1.user_stacks
#if [ -f /tmp/clasp-symbols-$1 ]; then
# ./symbolicate.lisp -i /tmp/out-$1.user_stacks -o /tmp/out-symbol-$1.user_stacks -s /tmp/perf-$1.map
#else
# cp /tmp/out-$1.user_stacks /tmp/out-symbol-$1.user_stacks
#fi
if [[ "$OSTYPE" == "linux-gnu" ]]; then
exec ./do-perf $PID $TIME $RATE $FRAMES
else
./do-dtrace $PID $TIME $RATE $FRAMES
fi
echo About to invert
./invert -i /tmp/out-$PID.stacks -o /tmp/out-$PID.invstacks -m 20
# PRUNE_OUTFILE=${OUTFILE%.prune_stacks}
# ./prune-trace.lisp $OUTFILE $PRUNE_OUTFILE
echo /tmp/out-$PID.invstacks
./collapse -i /tmp/out-$1.invstacks -o /tmp/out-$1.folded -m 400
$FLAME_GRAPH_HOME/flamegraph.pl -color clasp /tmp/out-$1.folded >/tmp/out-$1.svg
echo /tmp/out-$1.svg