Skip to content

Commit 62d39e0

Browse files
authored
add script to help setup performance measuring in linux (#12)
motivation: performance tuning changes: add script with setup code and example for running strace and perf
1 parent 5bc3aeb commit 62d39e0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

scripts/linux_performance_setup.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# docker run --cap-add SYS_ADMIN -it -v `pwd`:/code -w /code swift:5.1 bash
4+
5+
apt-get update
6+
apt-get install -y vim htop strace linux-tools-common linux-tools-generic
7+
8+
cd /usr/bin
9+
rm -rf perf
10+
ln -s /usr/lib/linux-tools/4.15.0-88-generic/perf perf
11+
cd -
12+
13+
cd build
14+
git clone https://github.com/brendangregg/FlameGraph.git
15+
cd -
16+
17+
# build the code in relase mode with debug symbols
18+
# swift build -c release -Xswiftc -g
19+
#
20+
# run the server
21+
# (.build/release/MockServer) &
22+
#
23+
# strace
24+
# export MAX_REQUESTS=10000
25+
# strace -o .build/strace-c-string-$MAX_REQUESTS -c .build/release/SwiftAwsLambdaStringSample
26+
# strace -o .build/strace-ffftt-string-$MAX_REQUESTS -fftt .build/release/SwiftAwsLambdaStringSample
27+
#
28+
# perf
29+
# export MAX_REQUESTS=10000
30+
# perf record -o .build/perf-$MAX_REQUESTS.data -g .build/release/SwiftAwsLambdaStringSample dward
31+
# perf script -i .build/perf-$MAX_REQUESTS.data | .build/FlameGraph/stackcollapse-perf.pl | swift-demangle | .build/FlameGraph/flamegraph.pl > .build/flamegraph-$MAX_REQUESTS.svg

0 commit comments

Comments
 (0)