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