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
|
||||
|
||||
static bool gcInitialised = false;
|
||||
static GC_word gcCyclesAfterInit = 0;
|
||||
|
||||
void initGC()
|
||||
{
|
||||
|
@ -218,10 +225,11 @@ void initGC()
|
|||
|
||||
#if HAVE_BOEHMGC
|
||||
initGCReal();
|
||||
|
||||
gcCyclesAfterInit = GC_get_gc_no();
|
||||
#endif
|
||||
|
||||
gcInitialised = true;
|
||||
gcCyclesAfterInit = GC_get_gc_no();
|
||||
}
|
||||
|
||||
void assertGCInitialized()
|
||||
|
@ -229,10 +237,4 @@ void assertGCInitialized()
|
|||
assert(gcInitialised);
|
||||
}
|
||||
|
||||
size_t getGCCycles()
|
||||
{
|
||||
assertGCInitialized();
|
||||
return GC_get_gc_no() - gcCyclesAfterInit;
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
|
|
Loading…
Reference in a new issue