mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
Rejiggle getGCCycles() for buildNoGc
This commit is contained in:
parent
e20b0a5dda
commit
eb89e50cbb
|
@ -206,10 +206,17 @@ static inline void initGCReal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static size_t gcCyclesAfterInit = 0;
|
||||||
|
|
||||||
|
size_t getGCCycles()
|
||||||
|
{
|
||||||
|
assertGCInitialized();
|
||||||
|
return static_cast<size_t>(GC_get_gc_no()) - gcCyclesAfterInit;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool gcInitialised = false;
|
static bool gcInitialised = false;
|
||||||
static GC_word gcCyclesAfterInit = 0;
|
|
||||||
|
|
||||||
void initGC()
|
void initGC()
|
||||||
{
|
{
|
||||||
|
@ -218,10 +225,11 @@ void initGC()
|
||||||
|
|
||||||
#if HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
initGCReal();
|
initGCReal();
|
||||||
|
|
||||||
|
gcCyclesAfterInit = GC_get_gc_no();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gcInitialised = true;
|
gcInitialised = true;
|
||||||
gcCyclesAfterInit = GC_get_gc_no();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertGCInitialized()
|
void assertGCInitialized()
|
||||||
|
@ -229,10 +237,4 @@ void assertGCInitialized()
|
||||||
assert(gcInitialised);
|
assert(gcInitialised);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t getGCCycles()
|
|
||||||
{
|
|
||||||
assertGCInitialized();
|
|
||||||
return GC_get_gc_no() - gcCyclesAfterInit;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
Loading…
Reference in a new issue