diff --git a/src/tests/tracing/eventpipe/simpleruntimeeventvalidation/simpleruntimeeventvalidation.cs b/src/tests/tracing/eventpipe/simpleruntimeeventvalidation/simpleruntimeeventvalidation.cs index 23597c43dd83d9..6472a2f995cc9f 100644 --- a/src/tests/tracing/eventpipe/simpleruntimeeventvalidation/simpleruntimeeventvalidation.cs +++ b/src/tests/tracing/eventpipe/simpleruntimeeventvalidation/simpleruntimeeventvalidation.cs @@ -25,8 +25,8 @@ public static int TestEntryPoint() // Validation is done with _DoesTraceContainEvents new Dictionary(){{ "Microsoft-Windows-DotNETRuntime", -1 }}, _eventGeneratingActionForGC, - //GCKeyword (0x1): 0b1 - new List(){new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Informational, 0b1)}, + // GCKeyword (0x1): 0b1, GCAllocationTick requries Verbose level + new List(){new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Verbose, 0b1)}, 1024, _DoesTraceContainGCEvents, enableRundownProvider:false); // Run the 2nd test scenario only if the first one passes @@ -35,7 +35,7 @@ public static int TestEntryPoint() ret = IpcTraceTest.RunAndValidateEventCounts( new Dictionary(){{ "Microsoft-DotNETCore-EventPipe", 1 }}, _eventGeneratingActionForExceptions, - //ExceptionKeyword (0x8000): 0b1000_0000_0000_0000 + // ExceptionKeyword (0x8000): 0b1000_0000_0000_0000 new List(){new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Warning, 0b1000_0000_0000_0000)}, 1024, _DoesTraceContainExceptionEvents, enableRundownProvider:false); @@ -64,6 +64,9 @@ public static int TestEntryPoint() RuntimeEventValidation eventValidation = new RuntimeEventValidation(); eventValidation = null; GC.Collect(); + + // Explicitly targeting AllocationTick event + GC.KeepAlive(new int[1000]); } }; @@ -114,6 +117,9 @@ public static int TestEntryPoint() source.Clr.GCSuspendEEStart += (eventData) => GCSuspendEEEvents += 1; source.Clr.GCSuspendEEStop += (eventData) => GCSuspendEEEndEvents += 1; + int GCAllocationTickEvents = 0; + source.Clr.GCAllocationTick += (eventData) => GCAllocationTickEvents += 1; + return () => { Logger.logger.Log("Event counts validation"); @@ -132,7 +138,10 @@ public static int TestEntryPoint() bool GCSuspendEEStartStopResult = GCSuspendEEEvents >= 50 && GCSuspendEEEndEvents >= 50; Logger.logger.Log("GCSuspendEEStartStopResult check: " + GCSuspendEEStartStopResult); - return GCStartStopResult && GCRestartEEStartStopResult && GCSuspendEEStartStopResult ? 100 : -1; + Logger.logger.Log("GCAllocationTickEvents: " + GCAllocationTickEvents); + bool GCAllocationTickResult = GCAllocationTickEvents > 0; + + return GCStartStopResult && GCRestartEEStartStopResult && GCSuspendEEStartStopResult && GCAllocationTickResult ? 100 : -1; }; };