nix-gh/src
Graham Christensen ee9c988a1b
Track function start and ends for flame graphs
With this patch, and this file I called `log.py`:

    #!/usr/bin/env nix-shell
    #!nix-shell -i python3 -p python3 --pure

    import sys
    from pprint import pprint

    stack = []
    timestack = []

    for line in open(sys.argv[1]):
        components = line.strip().split(" ", 2)
        if components[0] != "function-trace":
            continue

        direction = components[1]
        components = components[2].rsplit(" ", 2)

        loc = components[0]
        _at = components[1]
        time = int(components[2])

        if direction == "entered":
            stack.append(loc)
            timestack.append(time)
        elif direction == "exited":
            dur = time - timestack.pop()
            vst = ";".join(stack)
            print(f"{vst} {dur}")
            stack.pop()

and:

    nix-instantiate --trace-function-calls -vvvv ../nixpkgs/pkgs/top-level/release.nix -A unstable > log.matthewbauer 2>&1
    ./log.py ./log.matthewbauer > log.matthewbauer.folded
    flamegraph.pl --title matthewbauer-post-pr log.matthewbauer.folded > log.matthewbauer.folded.svg

I can make flame graphs like: http://gsc.io/log.matthewbauer.folded.svg

---

Includes test cases around function call failures and tryEval. Uses
RAII so the finish is always called at the end of the function.
2019-08-14 16:09:35 -04:00
..
build-remote canBuildLocally: check for features 2019-03-06 05:03:25 +00:00
cpptoml bump cpptoml to v0.1.1 2019-05-29 17:01:39 +08:00
libexpr Track function start and ends for flame graphs 2019-08-14 16:09:35 -04:00
libmain Automatically use --no-net if there are no network interfaces 2019-06-25 12:45:59 +02:00
libstore Merge pull request #2995 from tweag/post-build-hook 2019-08-07 15:02:29 +02:00
libutil Add a post-build-hook 2019-08-02 10:48:15 -04:00
nix Add a post-build-hook 2019-08-02 10:48:15 -04:00
nix-build nix-shell: Don't absolutize '-p' expressions 2019-05-08 14:29:36 +02:00
nix-channel nix-channel: Don't fetch binary-cache-url 2019-06-25 13:27:16 +02:00
nix-collect-garbage Merge all nix-* binaries into nix 2018-10-26 12:54:00 +02:00
nix-copy-closure Merge all nix-* binaries into nix 2018-10-26 12:54:00 +02:00
nix-daemon Style fix 2019-06-16 09:43:20 +02:00
nix-env Add pname and version to nix-env -q --json 2019-07-27 19:40:51 -07:00
nix-instantiate Merge all nix-* binaries into nix 2018-10-26 12:54:00 +02:00
nix-prefetch-url nix-prefetch-url: Stop progress bar before printing results 2018-11-09 10:34:12 +01:00
nix-store nix-store --gc --print-roots: Sort output 2019-03-14 13:59:10 +01:00
nlohmann nlohmann-json: 3.4.0 -> 3.5.0 2018-12-21 22:38:06 -06:00
resolve-system-dependencies Remove mentions of libformat, it no longer exists 2019-01-05 14:31:29 -05:00