2020-07-15 15:54:18 +02:00
|
|
|
# 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
|
|
|
|
|
2020-07-16 02:33:53 +02:00
|
|
|
${pkgs.linuxPackages.perf}/bin/perf record -g --call-graph dwarf -F max "$@"
|
2020-07-15 15:54:18 +02:00
|
|
|
${pkgs.linuxPackages.perf}/bin/perf script \
|
|
|
|
| ${pkgs.flamegraph}/bin/stackcollapse-perf.pl \
|
|
|
|
| ${pkgs.flamegraph}/bin/flamegraph.pl
|
|
|
|
''
|