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 != "-")
|
||||
fs.open(outPath, std::fstream::out);
|
||||
JSONObject topObj(outPath == "-" ? std::cerr : fs, true);
|
||||
topObj.attr("cpuTime",cpuTime);
|
||||
topObj.attr("cpuTime", cpuTime);
|
||||
{
|
||||
auto envs = topObj.object("envs");
|
||||
envs.attr("number", nrEnvs);
|
||||
|
|
@ -1700,6 +1700,13 @@ void EvalState::printStats()
|
|||
topObj.attr("nrLookups", nrLookups);
|
||||
topObj.attr("nrPrimOpCalls", nrPrimOpCalls);
|
||||
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) {
|
||||
{
|
||||
|
|
|
|||
|
|
@ -191,10 +191,16 @@ private:
|
|||
|
||||
std::array<FreeList, 8> freeLists;
|
||||
|
||||
public:
|
||||
|
||||
size_t getHeapSize() { return totalSize * WORD_SIZE; }
|
||||
|
||||
size_t allTimeWordsAllocated = 0;
|
||||
size_t allTimeWordsFreed = 0;
|
||||
uint64_t totalDurationMs = 0;
|
||||
|
||||
private:
|
||||
|
||||
Object * allocObject(size_t size)
|
||||
{
|
||||
assert(size >= 2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue