Skip to content
Merged
Show file tree
Hide file tree
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 @@ -49,6 +49,7 @@ private static class Messages
{
public const EventOpcode IOEnqueue = (EventOpcode)13;
public const EventOpcode IODequeue = (EventOpcode)14;
public const EventOpcode IOPack = (EventOpcode)15;
public const EventOpcode Wait = (EventOpcode)90;
public const EventOpcode Sample = (EventOpcode)100;
public const EventOpcode Adjustment = (EventOpcode)101;
Expand Down Expand Up @@ -204,5 +205,17 @@ public unsafe void ThreadPoolWorkingThreadCount(uint Count, ushort ClrInstanceID
}
LogThreadPoolWorkingThreadCount(Count, ClrInstanceID);
}

[Event(65, Level = EventLevel.Verbose, Message = Messages.IO, Task = Tasks.ThreadPool, Opcode = Opcodes.IOPack, Version = 0, Keywords = Keywords.ThreadingKeyword)]
private unsafe void ThreadPoolIOPack(
IntPtr NativeOverlapped,
IntPtr Overlapped,
ushort ClrInstanceID = DefaultClrInstanceId)
{
// In .NET 6, this event is exclusively fired in CoreCLR from a QCALL.
// This function only needs to exist for the EventSource to generate metadata
// for in-process EventListeners. It will not be called.
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ private static class Messages
{
public const EventOpcode IOEnqueue = (EventOpcode)13;
public const EventOpcode IODequeue = (EventOpcode)14;
public const EventOpcode IOPack = (EventOpcode)15;
public const EventOpcode Wait = (EventOpcode)90;
public const EventOpcode Sample = (EventOpcode)100;
public const EventOpcode Adjustment = (EventOpcode)101;
Expand Down
4 changes: 4 additions & 0 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,10 @@

<!-- Known failures for mono runtime on *all* architectures/operating systems in *all* runtime modes -->
<ItemGroup Condition="'$(RuntimeFlavor)' == 'mono'" >
<ExcludeList Include = "$(XunitTestBinBase)/tracing/runtimeeventsource/nativeruntimeeventsource/*">
<Issue>https://github.com/dotnet/runtime/issues/68032</Issue>
</ExcludeList>

<ExcludeList Include = "$(XunitTestBinBase)/reflection/GenericAttribute/**">
<Issue>https://github.com/dotnet/runtime/issues/56887</Issue>
</ExcludeList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
using System.IO;
using System.Diagnostics.Tracing;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Tracing.Tests.Common;
using System.Collections.Generic;

namespace Tracing.Tests
{
Expand All @@ -22,7 +25,11 @@ static int Main(string[] args)
using (SimpleEventListener listener = new SimpleEventListener("Simple"))
{
// Trigger the allocator task.
System.Threading.Tasks.Task.Run(new Action(Allocator));
Task.Run(new Action(Allocator));

// If on Windows, attempt some Overlapped IO (triggers ThreadPool events)
if (OperatingSystem.IsWindows())
DoOverlappedIO();

// Wait for events.
Thread.Sleep(1000);
Expand All @@ -34,7 +41,11 @@ static int Main(string[] args)
Thread.Sleep(1000);

// Ensure that we've seen some events.
foreach (string s in listener.SeenProvidersAndEvents)
Console.WriteLine(s);
Assert.True("listener.EventCount > 0", listener.EventCount > 0);
if (OperatingSystem.IsWindows())
Assert.True("Saw the ThreadPoolIOPack event", listener.SeenProvidersAndEvents.Contains("Microsoft-Windows-DotNETRuntime/EVENTID(65)"));
}

// Generate some more GC events.
Expand All @@ -57,10 +68,19 @@ private static void Allocator()
Thread.Sleep(10);
}
}

private static unsafe void DoOverlappedIO()
{
Console.WriteLine("DOOVERLAPPEDIO");
Overlapped overlapped = new();
NativeOverlapped* pOverlap = overlapped.Pack(null, null);
Overlapped.Free(pOverlap);
}
}

internal sealed class SimpleEventListener : EventListener
{
public HashSet<string> SeenProvidersAndEvents { get; private set; } = new();
private string m_name;

// Keep track of the set of keywords to be enabled.
Expand Down Expand Up @@ -108,6 +128,9 @@ protected override void OnEventWritten(EventWrittenEventArgs eventData)
}
Console.WriteLine("\n");

SeenProvidersAndEvents.Add($"{eventData.EventSource.Name}");
SeenProvidersAndEvents.Add($"{eventData.EventSource.Name}/EVENTID({eventData.EventId})");

EventCount++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@
<GCStressIncompatible>true</GCStressIncompatible>
<!-- This test has a secondary thread with an infinite loop -->
<UnloadabilityIncompatible>true</UnloadabilityIncompatible>
<!--
Test is blocking official build.
Related failures: #18907, #19340, #22441, #22729.
Issue tracking to re-enable: #22898.
-->
<DisableProjectBuild>true</DisableProjectBuild>
</PropertyGroup>
<ItemGroup>
<Compile Include="RuntimeEventSourceTest.cs" />
<Compile Include="NativeRuntimeEventSourceTest.cs" />
<ProjectReference Include="../common/common.csproj" />
</ItemGroup>
</Project>