From ea099fba14da84c3e81eb8d5ad93ecae7c659489 Mon Sep 17 00:00:00 2001 From: Maoni Stephens Date: Wed, 27 Feb 2019 16:35:03 -0800 Subject: added a lightweight GC profiling option (#22866) added a profiling event mask in the high 32-bit, COR_PRF_HIGH_BASIC_GC, for basic GC monitoring. it can be set via `ICorProfilerInfo5::SetEventMask2`. all this gives you is * GC start callback * GC end callback * update generational bounds note that one different behavior between this and the existing COR_PRF_MONITOR_GC is, aside from the obvious that it doesn't give you any info beyond the above, is that the GC end callback + update generational bounds are enabled for _all_ GCs, not just non concurrent GCs. I kept the behavior the same for COR_PRF_MONITOR_GC because I don't want to risk breaking existing profiling tools that do not anticipate these for concurrent GCs. --- src/vm/gcenv.ee.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/vm/gcenv.ee.cpp') diff --git a/src/vm/gcenv.ee.cpp b/src/vm/gcenv.ee.cpp index 6ecd325a08..f27d3f32c8 100644 --- a/src/vm/gcenv.ee.cpp +++ b/src/vm/gcenv.ee.cpp @@ -742,7 +742,7 @@ void GCToEEInterface::DiagGCStart(int gen, bool isInduced) void GCToEEInterface::DiagUpdateGenerationBounds() { #ifdef GC_PROFILING - if (CORProfilerTrackGC()) + if (CORProfilerTrackGC() || CORProfilerTrackBasicGC()) UpdateGenerationBounds(); #endif // GC_PROFILING } @@ -750,9 +750,16 @@ void GCToEEInterface::DiagUpdateGenerationBounds() void GCToEEInterface::DiagGCEnd(size_t index, int gen, int reason, bool fConcurrent) { #ifdef GC_PROFILING + // We were only doing generation bounds and GC finish callback for non concurrent GCs so + // I am keeping that behavior to not break profilers. But if BasicGC monitoring is enabled + // we will do these for all GCs. if (!fConcurrent) { GCProfileWalkHeap(); + } + + if (CORProfilerTrackBasicGC() || (!fConcurrent && CORProfilerTrackGC())) + { DiagUpdateGenerationBounds(); GarbageCollectionFinishedCallback(); } -- cgit v1.2.3