blob: 780a2808905dd443c5d57980cbac23db0f63f2b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# Script that collects perf timing for the execution of a command and
# writes a flamegraph to stdout
{
writeShellScriptBin,
linuxPackages,
flamegraph,
...
}:
writeShellScriptBin "perf-flamegraph" ''
set -euo pipefail
${linuxPackages.perf}/bin/perf record -g --call-graph dwarf -F max "$@"
${linuxPackages.perf}/bin/perf script \
| ${flamegraph}/bin/stackcollapse-perf.pl \
| ${flamegraph}/bin/flamegraph.pl
''
|