mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 08:46:16 +02:00
0678e4d56a
(cherry picked from commit 8beedd4486
)
25 lines
713 B
C++
25 lines
713 B
C++
#pragma once
|
|
|
|
#include "eval.hh"
|
|
|
|
#include <chrono>
|
|
|
|
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());
|
|
}
|
|
};
|
|
}
|