Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracy-based expr evaluation profiler #9967

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Feb 8, 2024

  1. Naive build system setup

    This is a first quick-and-dirty way to get the tracy integration up
    and running without losing my sanity trying to bend the autotools
    setup to work with it.
    
    Introducing a tracy submodule, injecting the required headers from
    here, building the TracyClient.cpp file to get the actual tracy client
    library.
    picnoir committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    0905dea View commit details
    Browse the repository at this point in the history
  2. Trace the eval.cc functions with Tracy

    We're leveraging the ZoneTransientN macro to send dynamic strings
    containing the expression type, file and position in that file of the
    expression Nix is currently evaluating.
    
    We had to add a new showExprType method to the Expr class to get a
    const string containing the name of an expression.
    picnoir committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    f2e832d View commit details
    Browse the repository at this point in the history
  3. Tracing EvalState members

    Two expressions evaluations seem to be contained in the EvalState
    class. Tracing them as well through a new macro.
    picnoir committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    b35cc13 View commit details
    Browse the repository at this point in the history
  4. Tracing primops

    Tracing the primops with Tracy as well. Not sure it really worth the
    overhead, but we still can revisit this decision later if we realize
    primops are not that important perf-wise.
    picnoir committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    376d9dd View commit details
    Browse the repository at this point in the history
  5. Tracy: autotools setup

    Well, this was as painful as expected.
    
    Introducing a proper autotool-based tracy build. I don't think this is
    the right approach, but hey, it works.
    
    Tracy is not distributing any pkg-config file, so we had to fallback
    to a more "manual" method to propagate the headers path. Instead of
    having a plain enable/disable flag, we send the path to the tracy
    /public subfolder (~= $out in the Tracy Nix derivation).
    
    The flake Nixpkgs is currently pointing to 23.05. The tracy derivation
    was only building the visualizer, not the client library back then. We
    introduce a 23.11 Nixpkgs and build its Tracy derivation with the
    23.05 toolchain to go around some glibc ABI incompatibilities.
    
    Kudos to Mic92 for the help for the flake bit.
    
    Co-authored-by: Jörg Thalheim <[email protected]>
    picnoir and Mic92 committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    3ea4870 View commit details
    Browse the repository at this point in the history