Skip to content

Commit

Permalink
validate AllocationTick event (#103290)
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshanF authored Jun 12, 2024
1 parent f5efc59 commit 2a0162b
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static int TestEntryPoint()
// Validation is done with _DoesTraceContainEvents
new Dictionary<string, ExpectedEventCount>(){{ "Microsoft-Windows-DotNETRuntime", -1 }},
_eventGeneratingActionForGC,
//GCKeyword (0x1): 0b1
new List<EventPipeProvider>(){new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Informational, 0b1)},
// GCKeyword (0x1): 0b1, GCAllocationTick requries Verbose level
new List<EventPipeProvider>(){new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Verbose, 0b1)},
1024, _DoesTraceContainGCEvents, enableRundownProvider:false);

// Run the 2nd test scenario only if the first one passes
Expand All @@ -35,7 +35,7 @@ public static int TestEntryPoint()
ret = IpcTraceTest.RunAndValidateEventCounts(
new Dictionary<string, ExpectedEventCount>(){{ "Microsoft-DotNETCore-EventPipe", 1 }},
_eventGeneratingActionForExceptions,
//ExceptionKeyword (0x8000): 0b1000_0000_0000_0000
// ExceptionKeyword (0x8000): 0b1000_0000_0000_0000
new List<EventPipeProvider>(){new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Warning, 0b1000_0000_0000_0000)},
1024, _DoesTraceContainExceptionEvents, enableRundownProvider:false);

Expand Down Expand Up @@ -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]);
}
};

Expand Down Expand Up @@ -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");

Expand All @@ -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;
};
};

Expand Down

0 comments on commit 2a0162b

Please sign in to comment.