about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-10-20T15·48+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-10-20T15·48+0000
commit76feaf016a7e9a9b019148df5ff84a63e48dbda7 (patch)
tree1da0ef464260a29388f3d27419662b3a370415c3 /src/libexpr/eval.cc
parente879a0371ba7ef99da2d82547823c3f96b445fdb (diff)
* Keep some more stats.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index ba331749fe9c..46978f6d0b81 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -119,6 +119,7 @@ EvalState::EvalState()
 {
     nrEnvs = nrValuesInEnvs = nrValues = nrListElems = 0;
     nrEvaluated = recursionDepth = maxRecursionDepth = 0;
+    nrAttrsets = nrOpUpdates = nrOpUpdateValuesCopied = 0;
     deepestStack = (char *) -1;
 
     createBaseEnv();
@@ -294,6 +295,7 @@ void EvalState::mkAttrs(Value & v)
 {
     v.type = tAttrs;
     v.attrs = new (UseGC) Bindings;
+    nrAttrsets++;
 }
 
 
@@ -758,6 +760,8 @@ void ExprOpUpdate::eval(EvalState & state, Env & env, Value & v)
     state.evalAttrs(env, e1, v1);
     state.evalAttrs(env, e2, v2);
 
+    state.nrOpUpdates++;
+
     if (v1.attrs->size() == 0) { v = v2; return; }
     if (v2.attrs->size() == 0) { v = v1; return; }
 
@@ -768,6 +772,8 @@ void ExprOpUpdate::eval(EvalState & state, Env & env, Value & v)
         mkCopy(a.value, i->second.value);
         a.pos = i->second.pos;
     }
+
+    state.nrOpUpdateValuesCopied += v.attrs->size();
 }
 
 
@@ -1107,6 +1113,9 @@ void EvalState::printStats()
         % nrListElems % (nrListElems * sizeof(Value *)));
     printMsg(v, format("  misc. values allocated: %1% (%2% bytes)")
         % nrValues % (nrValues * sizeof(Value)));
+    printMsg(v, format("  attribute sets allocated: %1%") % nrAttrsets);
+    printMsg(v, format("  right-biased unions: %1%") % nrOpUpdates);
+    printMsg(v, format("  values copied in right-biased unions: %1%") % nrOpUpdateValuesCopied);
     printMsg(v, format("  symbols in symbol table: %1%") % symbols.size());
 }