forked from naugtur/node-example-flamegraph
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflame-external.sh
More file actions
executable file
·22 lines (18 loc) · 1.25 KB
/
Copy pathflame-external.sh
File metadata and controls
executable file
·22 lines (18 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
echo 0 > /proc/sys/kernel/kptr_restrict
cd ./linux-$(uname -r | cut -d'.' -f1-3 | cut -d'-' -f1)/tools/perf
./perf record -F99 -p "$(pgrep -n node)" -g -- sleep 30
if [ ! -d FlameGraph ]
then
git clone https://github.com/brendangregg/FlameGraph
fi
# regular
./perf script --header | egrep -v "( __libc_start| LazyCompile | v8::internal::| Builtin:| Stub:| LoadIC:|\[unknown\]| LoadPolymorphicIC:)" | sed 's/ LazyCompile:[*~]\?/ /' | ./FlameGraph/stackcollapse-perf.pl | ./FlameGraph/flamegraph.pl > flame1.svg
cp flame1.svg "/usr/src/app/out/flame-external-$NODE_VERSION.svg"
# inverted
./perf script --header | egrep -v "( __libc_start| LazyCompile | v8::internal::| Builtin:| Stub:| LoadIC:|\[unknown\]| LoadPolymorphicIC:)" | sed 's/ LazyCompile:[*~]\?/ /' | ./FlameGraph/stackcollapse-perf.pl | ./FlameGraph/flamegraph.pl --inverted --reverse > flame1.svg
cp flame1.svg "/usr/src/app/out/flame-external-$NODE_VERSION-inverted.svg"
# ./perf script | egrep -v "( __libc_start| LazyCompile | v8::internal::| Builtin:| Stub:| LoadIC:|\[unknown\]| LoadPolymorphicIC:)" | sed 's/ LazyCompile:[*~]\?/ /' > perfs.out
# stackvis perf < perfs.out > flamegraph.htm
# cp flamegraph.htm /usr/src/app/out/
# cp flamegraph.htm "/usr/src/app/out/flamegraph-$NODE_VERSION.htm"