mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 00:08:07 +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
|
#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
|
||||||
|
|
|
@ -15,9 +15,11 @@ void initGC();
|
||||||
*/
|
*/
|
||||||
void assertGCInitialized();
|
void assertGCInitialized();
|
||||||
|
|
||||||
|
#ifdef HAVE_BOEHMGC
|
||||||
/**
|
/**
|
||||||
* The number of GC cycles since initGC().
|
* The number of GC cycles since initGC().
|
||||||
*/
|
*/
|
||||||
size_t getGCCycles();
|
size_t getGCCycles();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
} // namespace nix
|
||||||
|
|
Loading…
Reference in a new issue