flamegraph.sh 546 B

12345678910111213141516
  1. #!/bin/bash
  2. # install brendangregg's FlameGraph
  3. if [ ! -d "/usr/local/src/flamegraph" ]; then
  4. mkdir /usr/local/src/flamegraph &&
  5. cd /usr/local/src/flamegraph &&
  6. git clone https://github.com/brendangregg/FlameGraph.git
  7. fi
  8. # let the test warm up
  9. sleep 10
  10. # run a 30 second profile on the Caddy admin port
  11. cd /usr/local/src/flamegraph/FlameGraph &&
  12. go tool pprof -raw -output=cpu.txt 'http://localhost:2019/debug/pprof/profile?seconds=30' &&
  13. ./stackcollapse-go.pl cpu.txt | ./flamegraph.pl >/go/src/app/testdata/performance/flamegraph.svg