about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/eval.cc1
-rw-r--r--src/libexpr/nixexpr.cc12
-rw-r--r--src/libexpr/symbol-table.hh2
3 files changed, 15 insertions, 0 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index df129eda66b7..0e15a8d9374e 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -1262,6 +1262,7 @@ void EvalState::printStats()
     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());
+    printMsg(v, format("  size of symbol table: %1%") % symbols.totalSize());
     printMsg(v, format("  number of thunks: %1%") % nrThunks);
     printMsg(v, format("  number of thunks avoided: %1%") % nrAvoided);
     printMsg(v, format("  number of attr lookups: %1%") % nrLookups);
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 28049bb0d638..2e26d50817fb 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -336,4 +336,16 @@ string ExprLambda::showNamePos()
 }
 
 
+
+/* Symbol table. */
+
+size_t SymbolTable::totalSize() const
+{
+    size_t n = 0;
+    foreach (Symbols::const_iterator, i, symbols)
+        n += i->size();
+    return n;
+}
+
+
 }
diff --git a/src/libexpr/symbol-table.hh b/src/libexpr/symbol-table.hh
index ccdabb0280b4..9129f0f460c3 100644
--- a/src/libexpr/symbol-table.hh
+++ b/src/libexpr/symbol-table.hh
@@ -89,6 +89,8 @@ public:
     {
         return symbols.size();
     }
+
+    size_t totalSize() const;
 };
 
 }