1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-08 03:27:04 +09:00

Report collection counts non-inclusively (#51)

This commit is contained in:
Vladimir Sadov 2025-05-17 12:20:08 -07:00 committed by GitHub
parent 51785a4467
commit 50b175bcbb
Signed by: github
GPG key ID: B5690EEEBB952194

View file

@ -197,13 +197,26 @@ unsigned SatoriGC::WhichGeneration(Object* obj)
int SatoriGC::CollectionCount(int generation, int get_bgc_fgc_coutn) int SatoriGC::CollectionCount(int generation, int get_bgc_fgc_coutn)
{ {
//get_bgc_fgc_coutn N/A // get_bgc_fgc_coutn - not sure what this is. thus N/A
if ((unsigned)generation > (unsigned)2) if ((unsigned)generation > (unsigned)2)
{ {
return 0; return 0;
} }
return (int)m_heap->Recycler()->GetCollectionCount(generation); int64_t count = m_heap->Recycler()->GetCollectionCount(generation);
// in the public API GC counts are not inclusive
if (generation < 1)
{
count -= m_heap->Recycler()->GetCollectionCount(1);
}
else if (generation < 2)
{
count -= m_heap->Recycler()->GetCollectionCount(2);
}
return (int)count;
} }
int SatoriGC::StartNoGCRegion(uint64_t totalSize, bool lohSizeKnown, uint64_t lohSize, bool disallowFullBlockingGC) int SatoriGC::StartNoGCRegion(uint64_t totalSize, bool lohSizeKnown, uint64_t lohSize, bool disallowFullBlockingGC)
@ -360,6 +373,8 @@ bool SatoriGC::IsGCInProgressHelper(bool bConsiderGCStart)
return m_gcInProgress; return m_gcInProgress;
} }
// this is basically a GC index
// it is used in suspend events, and in GC stress.
unsigned SatoriGC::GetGcCount() unsigned SatoriGC::GetGcCount()
{ {
if (!m_heap) if (!m_heap)
@ -367,7 +382,7 @@ unsigned SatoriGC::GetGcCount()
return 0; return 0;
} }
return (unsigned)(int)m_heap->Recycler()->GetCollectionCount(/*gen*/ 1); return (unsigned)(int)m_heap->Recycler()->GetCollectionCount(/*gen*/ 0);
} }
bool SatoriGC::IsThreadUsingAllocationContextHeap(gc_alloc_context* acontext, int thread_number) bool SatoriGC::IsThreadUsingAllocationContextHeap(gc_alloc_context* acontext, int thread_number)