|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +set -e |
| 4 | +set -x |
| 5 | + |
| 6 | +go install golang.org/x/tools/cmd/goimports@latest |
| 7 | +go get -u github.com/google/pprof |
| 8 | +apt update && apt install -y graphviz |
| 9 | + |
| 10 | +cd /go-control-plane |
| 11 | + |
| 12 | +NUM_DIFF_LINES=`/go/bin/goimports -local github.com/envoyproxy/go-control-plane -d pkg | wc -l` |
| 13 | +if [[ $NUM_DIFF_LINES > 0 ]]; then |
| 14 | + echo "Failed format check. Run make format" |
| 15 | + exit 1 |
| 16 | +fi |
| 17 | + |
| 18 | +make benchmark MODE=0 |
| 19 | +make benchmark MODE=1 |
| 20 | +make benchmark MODE=2 |
| 21 | +make benchmark MODE=3 |
| 22 | +make benchmark MODE=4 |
| 23 | + |
| 24 | +mkdir -p benchmarks/reports |
| 25 | +mkdir -p benchmarks/pngs |
| 26 | + |
| 27 | +# generate our consumable pprof profiles |
| 28 | +pprof -text bin/test cpu.pprof > benchmarks/reports/cpu_text.txt |
| 29 | +pprof -tree bin/test cpu.pprof > benchmarks/reports/cpu_tree.txt |
| 30 | +pprof -traces bin/test cpu.pprof > benchmarks/reports/cpu_trace.txt |
| 31 | + |
| 32 | +pprof -text bin/test goroutine.pprof > benchmarks/reports/goroutine_text.txt |
| 33 | +pprof -tree bin/test goroutine.pprof > benchmarks/reports/goroutine_tree.txt |
| 34 | +pprof -traces bin/test goroutine.pprof > benchmarks/reports/goroutine_trace.txt |
| 35 | + |
| 36 | +pprof -text bin/test block.pprof > benchmarks/reports/block_text.txt |
| 37 | +pprof -tree bin/test block.pprof > benchmarks/reports/block_tree.txt |
| 38 | +pprof -traces bin/test block.pprof > benchmarks/reports/block_trace.txt |
| 39 | + |
| 40 | +pprof -text bin/test mutex.pprof > benchmarks/reports/mutex_text.txt |
| 41 | +pprof -tree bin/test mutex.pprof > benchmarks/reports/mutex_tree.txt |
| 42 | +pprof -traces bin/test mutex.pprof > benchmarks/reports/mutex_trace.txt |
| 43 | + |
| 44 | +pprof -text bin/test mem.pprof > benchmarks/reports/mem_text.txt |
| 45 | +pprof -tree bin/test mem.pprof > benchmarks/reports/mem_tree.txt |
| 46 | +pprof -traces bin/test mem.pprof > benchmarks/reports/mem_trace.txt |
| 47 | + |
| 48 | +# generate some cool pprof graphs |
| 49 | +pprof -png bin/test cpu.pprof > benchmarks/pngs/cpu_graph.png |
| 50 | +pprof -png bin/test goroutine.pprof > benchmarks/pngs/goroutine_graph.png |
| 51 | +pprof -png bin/test block.pprof > benchmarks/pngs/block_graph.png |
| 52 | +pprof -png bin/test mutex.pprof > benchmarks/pngs/mutex_graph.png |
| 53 | +pprof -png bin/test mem.pprof > benchmarks/pngs/mem_graph.png |
0 commit comments