mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-19 01:26:47 +02:00
Merge pull request #11163 from NixOS/rejiggle-getGCCyles-buildNoGc
Rejiggle getGCCycles() for buildNoGc
This commit is contained in:
commit
fb450de20e
2 changed files with 13 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -15,9 +15,11 @@ void initGC();
|
|||
*/
|
||||
void assertGCInitialized();
|
||||
|
||||
#ifdef HAVE_BOEHMGC
|
||||
/**
|
||||
* The number of GC cycles since initGC().
|
||||
*/
|
||||
size_t getGCCycles();
|
||||
#endif
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
Loading…
Reference in a new issue