forked from lix-project/lix
Jonas Chevalier
619cc4af85
If the user invokes nix with --trace-function-calls it means that they want to see the trace.
25 lines
716 B
C++
25 lines
716 B
C++
#pragma once
|
|
|
|
#include "eval.hh"
|
|
#include <sys/time.h>
|
|
|
|
namespace nix {
|
|
|
|
struct FunctionCallTrace
|
|
{
|
|
const Pos & pos;
|
|
|
|
FunctionCallTrace(const Pos & pos) : pos(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%", pos, ns.count());
|
|
}
|
|
|
|
~FunctionCallTrace() {
|
|
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%", pos, ns.count());
|
|
}
|
|
};
|
|
}
|