From f84c3f9d65c0170fa6955b8a7fff38d8c006d6cf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 5 Jan 2020 16:21:34 +0100 Subject: Hide FunctionCallTrace constructor/destructor This prevents them from being inlined. On gcc 9, this reduces the stack size needed for nix-instantiate '' -A texlive.combined.scheme-full --dry-run from 12.9 MiB to 4.8 MiB. (cherry picked from commit cb90e382b5b6e177ea902b3909fd1897643ae3cd) --- src/libexpr/function-trace.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/libexpr/function-trace.cc (limited to 'src/libexpr/function-trace.cc') diff --git a/src/libexpr/function-trace.cc b/src/libexpr/function-trace.cc new file mode 100644 index 0000000000..af1486f789 --- /dev/null +++ b/src/libexpr/function-trace.cc @@ -0,0 +1,17 @@ +#include "function-trace.hh" + +namespace nix { + +FunctionCallTrace::FunctionCallTrace(const Pos & pos) : pos(pos) { + auto duration = std::chrono::high_resolution_clock::now().time_since_epoch(); + auto ns = std::chrono::duration_cast(duration); + printMsg(lvlInfo, "function-trace entered %1% at %2%", pos, ns.count()); +} + +FunctionCallTrace::~FunctionCallTrace() { + auto duration = std::chrono::high_resolution_clock::now().time_since_epoch(); + auto ns = std::chrono::duration_cast(duration); + printMsg(lvlInfo, "function-trace exited %1% at %2%", pos, ns.count()); +} + +} -- cgit 1.4.1