mirror of
https://github.com/NixOS/nix
synced 2025-07-01 12:37:59 +02:00
This patch adds support for a native stack sampling profiler to the evaluator, which saves a collapsed stack profile information to a configurable location. Introduced options (in `EvalSettings`): - `eval-profile-file` - path to the collected profile file. - `eval-profiler-frequency` - sampling frequency. - `eval-profiler` - enumeration option for enabling the profiler. Currently only `flamegraph` is supported, but having this an enumeration rather than a boolean switch leaves the door open for other profiler variants (e.g. tracy). Profile includes the following information on best-effort basis (e.g. some lambdas might have an undefined name). Callstack information contains: - Call site location (where the function gets called). - Primop/lambda name of the function being called. - Functors/partial applications don't have a name attached to them unlike special-cased primops and lambads. For cases where callsite location isn't available we have to resort to providing the location where the lambda itself is defined. This removes some of the confusing `«none»:0` locations in the profile from previous attempts. Example usage with piping directly into zstd for compression: ``` nix eval --no-eval-cache nixpkgs#nixosTests.gnome \ --eval-profiler flamegraph \ --eval-profile-file >(zstd -of nix.profile.zstd) ``` Co-authored-by: Jörg Thalheim <joerg@thalheim.io> |
||
---|---|---|
.. | ||
include/nix/expr | ||
primops | ||
value | ||
.version | ||
attr-path.cc | ||
attr-set.cc | ||
eval-cache.cc | ||
eval-error.cc | ||
eval-gc.cc | ||
eval-profiler-settings.cc | ||
eval-profiler.cc | ||
eval-settings.cc | ||
eval.cc | ||
fetchurl.nix | ||
function-trace.cc | ||
get-drvs.cc | ||
imported-drv-to-derivation.nix | ||
json-to-value.cc | ||
lexer-helpers.cc | ||
lexer-helpers.hh | ||
lexer.l | ||
meson.build | ||
meson.options | ||
nix-meson-build-support | ||
nixexpr.cc | ||
package.nix | ||
parser.y | ||
paths.cc | ||
primops.cc | ||
print-ambiguous.cc | ||
print.cc | ||
search-path.cc | ||
value-to-json.cc | ||
value-to-xml.cc |