From f0ec7c68623164c6dbf9452637e1e4a4fa849bb0 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Thu, 30 Jan 2025 15:56:01 -0800 Subject: [PATCH] Include datas in GCSettingsEvent --- src/coreclr/gc/gc.cpp | 9 +++++++++ src/coreclr/gc/gcinterface.h | 3 ++- src/coreclr/inc/eventtracebase.h | 11 ++++++----- src/coreclr/vm/eventtrace.cpp | 3 +++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 3b717a6e239157..c0debe623f7792 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -52945,6 +52945,15 @@ void GCHeap::DiagGetGCSettings(EtwGCSettingsInfo* etw_settings) #else true; #endif //MULTIPLE_HEAPS +#if BUILD_AS_STANDALONE + if (g_runtimeSupportedVersion.MajorVersion >= 4) +#endif //BUILD_AS_STANDALONE + etw_settings->dynamic_heap_count_p = +#ifdef DYNAMIC_HEAP_COUNT + gc_heap::dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes; +#else + false; +#endif //DYNAMIC_HEAP_COUNT #endif //FEATURE_EVENT_TRACE } diff --git a/src/coreclr/gc/gcinterface.h b/src/coreclr/gc/gcinterface.h index b41d3005ae6721..98f019363bf270 100644 --- a/src/coreclr/gc/gcinterface.h +++ b/src/coreclr/gc/gcinterface.h @@ -15,7 +15,7 @@ // The major version of the IGCToCLR interface. Breaking changes to this interface // require bumps in the major version number. -#define EE_INTERFACE_MAJOR_VERSION 3 +#define EE_INTERFACE_MAJOR_VERSION 4 struct ScanContext; struct gc_alloc_context; @@ -141,6 +141,7 @@ struct EtwGCSettingsInfo // If this is false, it means the hardlimit was set implicitly by the container. bool hard_limit_config_p; bool no_affinitize_p; + bool dynamic_heap_count_p; }; // Opaque type for tracking object pointers diff --git a/src/coreclr/inc/eventtracebase.h b/src/coreclr/inc/eventtracebase.h index 72e6cd09fc5b6a..7beef3943e2f5b 100644 --- a/src/coreclr/inc/eventtracebase.h +++ b/src/coreclr/inc/eventtracebase.h @@ -66,11 +66,12 @@ enum EtwThreadFlags enum EtwGCSettingFlags { - kEtwGCFlagConcurrent = 0x00000001, - kEtwGCFlagLargePages = 0x00000002, - kEtwGCFlagFrozenSegs = 0x00000004, - kEtwGCFlagHardLimitConfig = 0x00000008, - kEtwGCFlagNoAffinitize = 0x00000010, + kEtwGCFlagConcurrent = 0x00000001, + kEtwGCFlagLargePages = 0x00000002, + kEtwGCFlagFrozenSegs = 0x00000004, + kEtwGCFlagHardLimitConfig = 0x00000008, + kEtwGCFlagNoAffinitize = 0x00000010, + kEtwGCFlagDynamicHeapCount = 0x00000020, }; #ifndef FEATURE_NATIVEAOT diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index 19c35aa9452ed7..1972954b0f2d61 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -4117,6 +4117,9 @@ VOID ETW::EnumerationLog::SendGCRundownEvent() if (gcSettingsInfo.no_affinitize_p) dwEtwGCSettingFlags |= kEtwGCFlagNoAffinitize; + if (gcSettingsInfo.dynamic_heap_count_p) + dwEtwGCSettingFlags |= kEtwGCFlagDynamicHeapCount; + FireEtwGCSettingsRundown ( gcSettingsInfo.heap_hard_limit, gcSettingsInfo.loh_threshold,