Author: eelco
Date: Wed Oct 20 15:48:00 2010
New Revision: 24391
URL: https://svn.nixos.org/websvn/nix/?rev=24391&sc=1

Log:
* Keep some more stats.

Modified:
   nix/branches/gc/src/libexpr/eval.cc
   nix/branches/gc/src/libexpr/eval.hh

Modified: nix/branches/gc/src/libexpr/eval.cc
==============================================================================
--- nix/branches/gc/src/libexpr/eval.cc Wed Oct 20 15:35:13 2010        (r24390)
+++ nix/branches/gc/src/libexpr/eval.cc Wed Oct 20 15:48:00 2010        (r24391)
@@ -119,6 +119,7 @@
 {
     nrEnvs = nrValuesInEnvs = nrValues = nrListElems = 0;
     nrEvaluated = recursionDepth = maxRecursionDepth = 0;
+    nrAttrsets = nrOpUpdates = nrOpUpdateValuesCopied = 0;
     deepestStack = (char *) -1;
 
     createBaseEnv();
@@ -294,6 +295,7 @@
 {
     v.type = tAttrs;
     v.attrs = new (UseGC) Bindings;
+    nrAttrsets++;
 }
 
 
@@ -758,6 +760,8 @@
     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 @@
         mkCopy(a.value, i->second.value);
         a.pos = i->second.pos;
     }
+
+    state.nrOpUpdateValuesCopied += v.attrs->size();
 }
 
 
@@ -1107,6 +1113,9 @@
         % 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());
 }
 

Modified: nix/branches/gc/src/libexpr/eval.hh
==============================================================================
--- nix/branches/gc/src/libexpr/eval.hh Wed Oct 20 15:35:13 2010        (r24390)
+++ nix/branches/gc/src/libexpr/eval.hh Wed Oct 20 15:48:00 2010        (r24391)
@@ -310,6 +310,9 @@
     unsigned long nrValues;
     unsigned long nrListElems;
     unsigned long nrEvaluated;
+    unsigned long nrAttrsets;
+    unsigned long nrOpUpdates;
+    unsigned long nrOpUpdateValuesCopied;
     unsigned int recursionDepth;
     unsigned int maxRecursionDepth;
     char * deepestStack; /* for measuring stack usage */
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to