Skip to content

Commit 0286358

Browse files
committed
Debugging event emission
1 parent 10b7e42 commit 0286358

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
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", 0x80000000000, 4, Microsoft_Windows_DotNETRuntime_flags);
2+
record_dotnet_provider("Microsoft-Windows-DotNETRuntime", 0x80000000001, 4, Microsoft_Windows_DotNETRuntime_flags);

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static int TestEntryPoint()
112112
traceeProcess.BeginErrorReadLine();
113113

114114
Console.WriteLine($"Waiting for tracee process to exit...");
115-
if (!traceeProcess.HasExited && !traceeProcess.WaitForExit(5000))
115+
if (!traceeProcess.HasExited && !traceeProcess.WaitForExit(15000))
116116
{
117117
Console.WriteLine($"Tracee process did not exit within the 5s timeout, killing it.");
118118
traceeProcess.Kill();
@@ -125,7 +125,7 @@ public static int TestEntryPoint()
125125
Console.WriteLine($"Stopping record-trace with SIGINT.");
126126
Kill(recordTraceProcess.Id, SIGINT);
127127
Console.WriteLine($"Waiting for record-trace to exit...");
128-
if (!recordTraceProcess.WaitForExit(20000))
128+
if (!recordTraceProcess.WaitForExit(30000))
129129
{
130130
// record-trace needs to stop gracefully to generate the trace file
131131
Console.WriteLine($"record-trace did not exit within the 20s timeout, killing it.");
@@ -157,21 +157,32 @@ public static int TestEntryPoint()
157157
private static bool ValidateTraceeEvents(string traceFilePath)
158158
{
159159
using EventPipeEventSource source = new EventPipeEventSource(traceFilePath);
160+
bool startEventFound = false;
161+
bool stopEventFound = false;
160162
bool allocationSampledEventFound = false;
161163

162164
source.Dynamic.All += (TraceEvent e) =>
163165
{
164166
if (e.ProviderName == "Microsoft-Windows-DotNETRuntime")
165167
{
166-
if (e.EventName == "AllocationSampled" || (e.ID == (TraceEventID)303 && e.EventName.StartsWith("Unknown")))
168+
Console.WriteLine($"Event: {e.ProviderName} - {e.EventName} (ID: {e.ID})");
169+
if (e.EventName == "GC/Start" || (e.ID == (TraceEventID)1 && e.EventName.StartsWith("Unknown")))
170+
{
171+
startEventFound = true;
172+
}
173+
else if (e.EventName == "GC/Stop" || (e.ID == (TraceEventID)2 && e.EventName.StartsWith("Unknown")))
174+
{
175+
stopEventFound = true;
176+
}
177+
else if (e.EventName == "AllocationSampled" || (e.ID == (TraceEventID)303 && e.EventName.StartsWith("Unknown")))
167178
{
168179
allocationSampledEventFound = true;
169180
}
170181
}
171182
};
172183

173184
source.Process();
174-
return allocationSampledEventFound;
185+
return startEventFound && stopEventFound && allocationSampledEventFound;
175186
}
176187

177188
private static void UploadTraceFile(string traceFilePath)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ public class UserEventsTracee
1414
public static void Run()
1515
{
1616
long startTimestamp = Stopwatch.GetTimestamp();
17-
long targetTicks = Stopwatch.Frequency; // 1s
17+
long targetTicks = Stopwatch.Frequency * 10; // 10s
1818

1919
while (Stopwatch.GetTimestamp() - startTimestamp < targetTicks)
2020
{
2121
s_array = new byte[1024 * 100];
22+
GC.Collect(2);
2223
Thread.Sleep(100);
2324
}
2425
}

0 commit comments

Comments
 (0)