mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
Include GC stats in printStats
This commit is contained in:
parent
c6ff34bd86
commit
351fbfcb9b
2 changed files with 14 additions and 1 deletions
|
|
@ -1657,7 +1657,7 @@ void EvalState::printStats()
|
||||||
if (outPath != "-")
|
if (outPath != "-")
|
||||||
fs.open(outPath, std::fstream::out);
|
fs.open(outPath, std::fstream::out);
|
||||||
JSONObject topObj(outPath == "-" ? std::cerr : fs, true);
|
JSONObject topObj(outPath == "-" ? std::cerr : fs, true);
|
||||||
topObj.attr("cpuTime",cpuTime);
|
topObj.attr("cpuTime", cpuTime);
|
||||||
{
|
{
|
||||||
auto envs = topObj.object("envs");
|
auto envs = topObj.object("envs");
|
||||||
envs.attr("number", nrEnvs);
|
envs.attr("number", nrEnvs);
|
||||||
|
|
@ -1700,6 +1700,13 @@ void EvalState::printStats()
|
||||||
topObj.attr("nrLookups", nrLookups);
|
topObj.attr("nrLookups", nrLookups);
|
||||||
topObj.attr("nrPrimOpCalls", nrPrimOpCalls);
|
topObj.attr("nrPrimOpCalls", nrPrimOpCalls);
|
||||||
topObj.attr("nrFunctionCalls", nrFunctionCalls);
|
topObj.attr("nrFunctionCalls", nrFunctionCalls);
|
||||||
|
{
|
||||||
|
auto j = topObj.object("gc");
|
||||||
|
j.attr("heapSize", gc.getHeapSize());
|
||||||
|
j.attr("totalBytes", gc.allTimeWordsAllocated * WORD_SIZE);
|
||||||
|
j.attr("reclaimedBytes", gc.allTimeWordsFreed * WORD_SIZE);
|
||||||
|
j.attr("gcTime", gc.totalDurationMs / 1000.0);
|
||||||
|
}
|
||||||
|
|
||||||
if (countCalls) {
|
if (countCalls) {
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -191,10 +191,16 @@ private:
|
||||||
|
|
||||||
std::array<FreeList, 8> freeLists;
|
std::array<FreeList, 8> freeLists;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
size_t getHeapSize() { return totalSize * WORD_SIZE; }
|
||||||
|
|
||||||
size_t allTimeWordsAllocated = 0;
|
size_t allTimeWordsAllocated = 0;
|
||||||
size_t allTimeWordsFreed = 0;
|
size_t allTimeWordsFreed = 0;
|
||||||
uint64_t totalDurationMs = 0;
|
uint64_t totalDurationMs = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
Object * allocObject(size_t size)
|
Object * allocObject(size_t size)
|
||||||
{
|
{
|
||||||
assert(size >= 2);
|
assert(size >= 2);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue