mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
* It is tough to contribute to a project that doesn't use a formatter, * It is extra hard to contribute to a project which has configured the formatter, but ignores it for some files * Code formatting makes it harder to hide obscure / weird bugs by accident or on purpose, Let's rip the bandaid off? Note that PRs currently in flight should be able to be merged relatively easily by applying `clang-format` to their tip prior to merge.
22 lines
880 B
C++
22 lines
880 B
C++
#include "nix/expr/function-trace.hh"
|
|
#include "nix/util/logging.hh"
|
|
|
|
namespace nix {
|
|
|
|
void FunctionCallTrace::preFunctionCallHook(
|
|
EvalState & state, const Value & v, std::span<Value *> args, const PosIdx pos)
|
|
{
|
|
auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
|
|
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(duration);
|
|
printMsg(lvlInfo, "function-trace entered %1% at %2%", state.positions[pos], ns.count());
|
|
}
|
|
|
|
void FunctionCallTrace::postFunctionCallHook(
|
|
EvalState & state, const Value & v, std::span<Value *> args, const PosIdx pos)
|
|
{
|
|
auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
|
|
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(duration);
|
|
printMsg(lvlInfo, "function-trace exited %1% at %2%", state.positions[pos], ns.count());
|
|
}
|
|
|
|
} // namespace nix
|