mirror of
https://github.com/NixOS/nix.git
synced 2025-11-22 18:29:36 +01:00
Setting the environment variable NIX_COUNT_CALLS to 1 enables some
basic profiling in the evaluator. It will count calls to functions
and primops as well as evaluations of attributes.
For example, to see where evaluation of a NixOS configuration spends
its time:
$ NIX_SHOW_STATS=1 NIX_COUNT_CALLS=1 ./src/nix-instantiate/nix-instantiate '<nixos>' -A system --readonly-mode
...
calls to 39 primops:
239532 head
233962 tail
191252 hasAttr
...
calls to 1595 functions:
224157 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:19'
221767 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:14'
221767 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:10'
...
evaluations of 7088 attributes:
167377 undefined position
132459 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/attrsets.nix:119:41'
47322 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/attrsets.nix:13:21'
...
|
||
|---|---|---|
| .. | ||
| archive.cc | ||
| archive.hh | ||
| hash.cc | ||
| hash.hh | ||
| immutable.cc | ||
| immutable.hh | ||
| Makefile.am | ||
| md5.c | ||
| md5.h | ||
| md32_common.h | ||
| serialise.cc | ||
| serialise.hh | ||
| sha1.c | ||
| sha1.h | ||
| sha256.c | ||
| sha256.h | ||
| types.hh | ||
| util.cc | ||
| util.hh | ||
| xml-writer.cc | ||
| xml-writer.hh | ||