about summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-05-08T10·00+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-05-08T10·00+0000
commit310e605995dc104bee29d330ac135e3e2bb82f97 (patch)
treef020fe0f638f1c5f820fdfcebcadabc71fb07b3b /src/libexpr
parent0832956089516d32371060c98df4f8d0cbff2b0f (diff)
* Show evaluation stats when NIX_SHOW_STATS=1.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/eval.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 38f198fb86ca..ee17c996c6f9 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -527,9 +527,12 @@ extern "C" {
 
 void printEvalStats(EvalState & state)
 {
-    printMsg(lvlInfo,
+    bool showStats = getEnv("NIX_SHOW_STATS", "0") != "0";
+    printMsg(showStats ? lvlInfo : lvlDebug,
         format("evaluated %1% expressions, %2% cache hits, %3%%% efficiency, used %4% ATerm bytes")
         % state.nrEvaluated % state.nrCached
         % ((float) state.nrCached / (float) state.nrEvaluated * 100)
         % AT_calcAllocatedSize());
+    if (showStats)
+        printATermMapStats();
 }