Add environment variable NIX_SHOW_SYMBOLS for dumping the symbol table

This commit is contained in:
Eelco Dolstra 2019-04-11 23:04:13 +02:00
parent 41ba5135e0
commit bb6e6923f2
2 changed files with 13 additions and 0 deletions

View file

@ -1811,6 +1811,7 @@ void EvalState::printStats()
gc.attr("totalBytes", totalBytes);
}
#endif
if (countCalls) {
{
auto obj = topObj.object("primops");
@ -1846,6 +1847,11 @@ void EvalState::printStats()
}
}
}
if (getEnv("NIX_SHOW_SYMBOLS", "0") != "0") {
auto list = topObj.list("symbols");
symbols.dump([&](const std::string & s) { list.elem(s); });
}
}
}

View file

@ -75,6 +75,13 @@ public:
}
size_t totalSize() const;
template<typename T>
void dump(T callback)
{
for (auto & s : symbols)
callback(s);
}
};
}