about summary refs log tree commit diff
path: root/src/libexpr/function-trace.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-05T15·21+0100
committerEelco Dolstra <edolstra@gmail.com>2020-01-05T15·30+0100
commitf84c3f9d65c0170fa6955b8a7fff38d8c006d6cf (patch)
treebc2a978f36b8983b2f5e02868432750fd2043770 /src/libexpr/function-trace.hh
parentc94fd5f51a3c11e07a278d43bcf453c16507e58e (diff)
Hide FunctionCallTrace constructor/destructor
This prevents them from being inlined. On gcc 9, this reduces the
stack size needed for

  nix-instantiate '<nixpkgs>' -A texlive.combined.scheme-full --dry-run

from 12.9 MiB to 4.8 MiB.

(cherry picked from commit cb90e382b5b6e177ea902b3909fd1897643ae3cd)
Diffstat (limited to 'src/libexpr/function-trace.hh')
-rw-r--r--src/libexpr/function-trace.hh14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/libexpr/function-trace.hh b/src/libexpr/function-trace.hh
index 8b0ec848d5a8..3100ffea2c57 100644
--- a/src/libexpr/function-trace.hh
+++ b/src/libexpr/function-trace.hh
@@ -8,17 +8,7 @@ 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());
-    }
+    FunctionCallTrace(const Pos & pos);
+    ~FunctionCallTrace();
 };
 }