Open ww898 opened 5 days ago
Tagging subscribers to this area: @tommcdon See info in area-owners.md if you want to be subscribed.
This is the two charts measured by me with the server GC enabled. I used completely the empty profiler: no any actions in callback except minimum logs. Horizontal axis is GC number. The first chart show time in mS from GarbageCollectionStarted
callback to ObjectsAllocatedByClass
and GarbageCollectionFinished
callbacks. The second is GarbageCollectionFinished
-ObjectsAllocatedByClass
time.
Hi, this is a proposal to speed up the profiler in case the profiler does not use
ICorProfilerCallback::ObjectsAllocatedByClass
callback for its work, but wants to use other GC callbacks activated byCOR_PRF_MONITOR_GC
. We can completely disable theDiagWalkHeap(&AllocByClassHelper, (void *)&context, 0, false)
call in this case. For that I propose to create a separate additional flag inCOR_PRF_HIGH_MONITOR
, for exampleCOR_PRF_HIGH_MONITOR_GC_SKIP_ALLOCATED_BY_CLASS_STATISTIC
.The reason: in according to my measurements on .NET 8.0.8 x64,
DiagWalkHeap
sometimes takes from 18 to 35 seconds on my scenario with the server GC. I measured the time betweenICorProfilerCallback2::GarbageCollectionStarted
andICorProfilerCallback::ObjectsAllocatedByClass
callbacks.The original code: https://github.com/dotnet/runtime/blob/080fcae7eaa8367abf7900e08ff2e52e3efea5bf/src/coreclr/vm/gcenv.ee.cpp#L813-L822
P.S. Discussion is welcome...