Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AllocationTick event test scenario #103290

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading