Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::EvalProfiler Class Reference
Inheritance diagram for nix::EvalProfiler:
nix::FunctionCallTrace nix::MultiEvalProfiler

Public Types

enum  Hook { preFunctionCall , postFunctionCall }
using Hooks = std::bitset<numHooks>

Public Member Functions

virtual void preFunctionCallHook (EvalState &state, const Value &v, std::span< Value *const > args, const PosIdx pos)
virtual void postFunctionCallHook (EvalState &state, const Value &v, std::span< Value *const > args, const PosIdx pos)
Hooks getNeededHooks ()

Static Public Attributes

static constexpr std::size_t numHooks = Hook::postFunctionCall + 1

Protected Member Functions

void invalidateNeededHooks ()
virtual Hooks getNeededHooksImpl () const

Member Function Documentation

◆ getNeededHooks()

Hooks nix::EvalProfiler::getNeededHooks ( )
inline

Get which hooks need to be invoked for this EvalProfiler instance.

◆ getNeededHooksImpl()

virtual Hooks nix::EvalProfiler::getNeededHooksImpl ( ) const
inlineprotectedvirtual

Get which hooks need to be called.

This is the actual implementation which has to be defined by subclasses. Public API goes through the needsHooks, which is a non-virtual interface (NVI) which caches the return value.

◆ invalidateNeededHooks()

void nix::EvalProfiler::invalidateNeededHooks ( )
inlineprotected

Invalidate the cached neededHooks.

◆ postFunctionCallHook()

void nix::EvalProfiler::postFunctionCallHook ( EvalState & state,
const Value & v,
std::span< Value *const > args,
const PosIdx pos )
virtual

Hook called on EvalState::callFunction exit. Gets called only if (getNeededHooks().test(Hook::postFunctionCall)) is true.

Parameters
stateEvaluator state.
vFunction being invoked.
argsFunction arguments.
posFunction position.

Reimplemented in nix::FunctionCallTrace, and nix::MultiEvalProfiler.

◆ preFunctionCallHook()

void nix::EvalProfiler::preFunctionCallHook ( EvalState & state,
const Value & v,
std::span< Value *const > args,
const PosIdx pos )
virtual

Hook called in the EvalState::callFunction preamble. Gets called only if (getNeededHooks().test(Hook::preFunctionCall)) is true.

Parameters
stateEvaluator state.
vFunction being invoked.
argsFunction arguments.
posFunction position.

Reimplemented in nix::FunctionCallTrace, and nix::MultiEvalProfiler.


The documentation for this class was generated from the following files: