Skip to content

Various primitive scripts cobbled together to produce an easy flamegraph of nix eval

License

Notifications You must be signed in to change notification settings

turbio/nix-flamegraph

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semi-usable flamegraph generation for troubleshooting just why your Nix code is so damn slow. This mostly just shows a useful visualization of the call stack, so that you can get an impression of which function is being called recursively five thousand times. :P

Usage

Help page:

nix run github:crabdancing/nix-flamegraph -- --help

Process a flake (e.g.):

nix run github:crabdancing/nix-flamegraph -- -t /etc/nixos

You just point it at a target, and it hopefully prints out the path to an SVG. Internals are very jank. Results may vary.

Note that it prints status info via STDERR, and the actual path via STDOUT. Therefore, it should be easy to extract the path for machine usage if desired. Alternatively, look at the -o flag for telling the script to dump your SVG to a given path. Note that it will error if path already exists with exit code 5.

Credits

Internal script is mostly based on posts from here cobbled together. Yoinked stack-collapse.py from here, and made slight alterations (to pin Python version against flake deps).

License

This is basically just a bunch of templates & scripts cobbled together. The parts I contributed are too trivial to really be worthy of anything other than public domain. So, um, do whatever you want.

About

Various primitive scripts cobbled together to produce an easy flamegraph of nix eval

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 58.1%
  • Python 27.5%
  • Shell 14.4%