Skip to content

Commit 04f072c

Browse files
committed
Switch to AllocationSampled Event
Even after switching to just enabling GCKeyword, the 1s tracee app had a 1% failure rate locally. On the other hand, AllocationSampled had no failures after 1000 runs.
1 parent ffc0c16 commit 04f072c

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
let Microsoft_Windows_DotNETRuntime_flags = new_dotnet_provider_flags();
2-
record_dotnet_provider("Microsoft-Windows-DotNETRuntime", 0x1, 4, Microsoft_Windows_DotNETRuntime_flags);
2+
record_dotnet_provider("Microsoft-Windows-DotNETRuntime", 0x80000000000, 4, Microsoft_Windows_DotNETRuntime_flags);

src/tests/tracing/eventpipe/userevents/userevents.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,26 +132,22 @@ public static int TestEntryPoint()
132132
private static bool ValidateTraceeEvents(string traceFilePath)
133133
{
134134
using EventPipeEventSource source = new EventPipeEventSource(traceFilePath);
135-
bool startEventFound = false;
136-
bool stopEventFound = false;
135+
bool allocationSampledEventFound = false;
137136

137+
// TraceEvent's ClrTraceEventParser does not know about the AllocationSampled Event, so it shows up as "Unknown(303)"
138138
source.Dynamic.All += (TraceEvent e) =>
139139
{
140140
if (e.ProviderName == "Microsoft-Windows-DotNETRuntime")
141141
{
142-
if (e.EventName == "GC/Start" || (e.ID == (TraceEventID)1 && e.EventName.StartsWith("Unknown")))
142+
if (e.EventName == "AllocationSampled" || (e.ID == (TraceEventID)303 && e.EventName.StartsWith("Unknown")))
143143
{
144-
startEventFound = true;
145-
}
146-
else if (e.EventName == "GC/Stop" || (e.ID == (TraceEventID)2 && e.EventName.StartsWith("Unknown")))
147-
{
148-
stopEventFound = true;
144+
allocationSampledEventFound = true;
149145
}
150146
}
151147
};
152148

153149
source.Process();
154-
return startEventFound && stopEventFound;
150+
return allocationSampledEventFound;
155151
}
156152
}
157153
}

src/tests/tracing/eventpipe/userevents/usereventstracee.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ public static void Run()
1818

1919
while (Stopwatch.GetTimestamp() - startTimestamp < targetTicks)
2020
{
21-
for (int i = 0; i < 100; i++)
22-
{
23-
s_array = new byte[1024 * 10];
24-
}
25-
26-
GC.Collect();
21+
s_array = new byte[1024 * 100];
2722
Thread.Sleep(100);
2823
}
2924
}

0 commit comments

Comments
 (0)