diff options
Diffstat (limited to 'packages/perf-flamegraph.nix')
| -rw-r--r-- | packages/perf-flamegraph.nix | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/packages/perf-flamegraph.nix b/packages/perf-flamegraph.nix index b472b74..780a280 100644 --- a/packages/perf-flamegraph.nix +++ b/packages/perf-flamegraph.nix @@ -1,12 +1,18 @@ -# Script that collects perf timing for the execution of a command and writes a -# flamegraph to stdout -{ pkgs, ... }: +# Script that collects perf timing for the execution of a command and +# writes a flamegraph to stdout -pkgs.writeShellScriptBin "perf-flamegraph" '' +{ + writeShellScriptBin, + linuxPackages, + flamegraph, + ... +}: + +writeShellScriptBin "perf-flamegraph" '' set -euo pipefail - ${pkgs.linuxPackages.perf}/bin/perf record -g --call-graph dwarf -F max "$@" - ${pkgs.linuxPackages.perf}/bin/perf script \ - | ${pkgs.flamegraph}/bin/stackcollapse-perf.pl \ - | ${pkgs.flamegraph}/bin/flamegraph.pl + ${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 '' |
