Support PortableThreadPool native event sinks on Mono. (#53500)
authorJohan Lorensson <lateralusx.github@gmail.com>
Wed, 2 Jun 2021 16:09:20 +0000 (18:09 +0200)
committerGitHub <noreply@github.com>
Wed, 2 Jun 2021 16:09:20 +0000 (18:09 +0200)
18 files changed:
src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
src/coreclr/System.Private.CoreLib/src/System/Diagnostics/Eventing/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.CoreCLR.cs [new file with mode: 0644]
src/coreclr/scripts/genRuntimeEventSources.py
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.cs
src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs [moved from src/coreclr/System.Private.CoreLib/src/System/Diagnostics/Eventing/NativeRuntimeEventSource.PortableThreadPool.CoreCLR.cs with 81% similarity]
src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.cs
src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj
src/mono/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.Mono.cs [new file with mode: 0644]
src/mono/mono/component/event_pipe-stub.c
src/mono/mono/component/event_pipe.c
src/mono/mono/component/event_pipe.h
src/mono/mono/eventpipe/ep-rt-mono.c
src/mono/mono/eventpipe/ep-rt-mono.h
src/mono/mono/eventpipe/gen-eventing-event-inc.lst
src/mono/mono/metadata/icall-decl.h
src/mono/mono/metadata/icall-def-netcore.h
src/mono/mono/metadata/icall-eventpipe.c

index 0a76781..626f0ee 100644 (file)
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debugger.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\EditAndContinueHelper.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventPipe.CoreCLR.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\NativeRuntimeEventSource.PortableThreadPool.CoreCLR.cs" />
+    <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\NativeRuntimeEventSource.PortableThreadPool.NativeSinks.CoreCLR.cs" Condition="'$(FeaturePortableThreadPool)' == 'true'" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\ICustomDebuggerNotification.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackFrame.CoreCLR.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackFrameHelper.cs" />
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/Eventing/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/Eventing/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.CoreCLR.cs
new file mode 100644 (file)
index 0000000..07da799
--- /dev/null
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Threading;
+using System.Diagnostics.Tracing;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using Internal.Runtime.CompilerServices;
+
+namespace System.Diagnostics.Tracing
+{
+    // This is part of the NativeRuntimeEventsource, which is the managed version of the Microsoft-Windows-DotNETRuntime provider.
+    // It contains the runtime specific interop to native event sinks.
+    internal sealed partial class NativeRuntimeEventSource : EventSource
+    {
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolWorkerThreadStart(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
+
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolWorkerThreadStop(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
+
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolWorkerThreadWait(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
+
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolWorkerThreadAdjustmentSample(double Throughput, ushort ClrInstanceID);
+
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolWorkerThreadAdjustmentAdjustment(double AverageThroughput, uint NewWorkerThreadCount, NativeRuntimeEventSource.ThreadAdjustmentReasonMap Reason, ushort ClrInstanceID);
+
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolWorkerThreadAdjustmentStats(
+            double Duration,
+            double Throughput,
+            double ThreadPoolWorkerThreadWait,
+            double ThroughputWave,
+            double ThroughputErrorEstimate,
+            double AverageThroughputErrorEstimate,
+            double ThroughputRatio,
+            double Confidence,
+            double NewControlSetting,
+            ushort NewThreadWaveMagnitude,
+            ushort ClrInstanceID);
+
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolIOEnqueue(
+            IntPtr NativeOverlapped,
+            IntPtr Overlapped,
+            bool MultiDequeues,
+            ushort ClrInstanceID);
+
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolIODequeue(
+            IntPtr NativeOverlapped,
+            IntPtr Overlapped,
+            ushort ClrInstanceID);
+
+        [NonEvent]
+        [DllImport(RuntimeHelpers.QCall)]
+        internal static extern void LogThreadPoolWorkingThreadCount(
+            uint Count,
+            ushort ClrInstanceID
+        );
+    }
+}
index 96da387..13f19cb 100644 (file)
@@ -6,6 +6,7 @@
 import os
 import xml.dom.minidom as DOM
 from utilities import open_for_update
+from genEventing import RuntimeFlavor
 import argparse
 import sys
 
@@ -23,10 +24,14 @@ This file is generated by <root>/src/coreclr/scripts/genRuntimeEventSources.py
 ########################################################################
 # START CONFIGURATION
 ########################################################################
-manifestsToGenerate = {
+coreCLRManifestsToGenerate = {
     "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource.CoreCLR.cs"
 }
 
+monoManifestsToGenerate = {
+    "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource.Mono.cs"
+}
+
 providerNameToClassNameMap = {
     "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource"
 }
@@ -71,6 +76,12 @@ def writeOutput(outputFile, str):
 def getCSharpTypeFromManifestType(manifestType):
     return manifestTypeToCSharpTypeMap[manifestType]
 
+def getManifestsToGenerate(runtimeFlavor):
+    if runtimeFlavor.coreclr:
+        return coreCLRManifestsToGenerate
+    elif runtimeFlavor.mono:
+        return monoManifestsToGenerate
+
 def generateEvent(eventNode, providerNode, outputFile, stringTable):
 
     # ThreadPool events are defined manually in NativeRuntimeEventSource.PortableThreadPool.cs
@@ -326,7 +337,7 @@ def loadStringTable(manifest):
 
     return stringTable
 
-def generateEventSources(manifestFullPath, intermediatesDirFullPath):
+def generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlavor):
 
     # Open the manifest for reading.
     manifest = DOM.parse(manifestFullPath)
@@ -335,7 +346,7 @@ def generateEventSources(manifestFullPath, intermediatesDirFullPath):
     stringTable = loadStringTable(manifest)
 
     # Iterate over each provider that we want to generate an EventSource for.
-    for providerName, outputFileName in manifestsToGenerate.items():
+    for providerName, outputFileName in getManifestsToGenerate(runtimeFlavor).items():
         for node in manifest.getElementsByTagName("provider"):
             if node.getAttribute("name") == providerName:
                 providerNode = node
@@ -401,6 +412,8 @@ def main(argv):
                           help='full path to manifest containig the description of events')
     required.add_argument('--intermediate', type=str, required=True,
                           help='full path to eventprovider intermediate directory')
+    required.add_argument('--runtimeflavor', type=str,default="CoreCLR",
+                          help='runtime flavor')
     args, unknown = parser.parse_known_args(argv)
     if unknown:
         print('Unknown argument(s): ', ', '.join(unknown))
@@ -408,6 +421,7 @@ def main(argv):
 
     manifestFullPath = args.man
     intermediatesDirFullPath = args.intermediate
+    runtimeFlavor = RuntimeFlavor(args.runtimeflavor)
 
     # Ensure the intermediates directory exists.
     try:
@@ -417,7 +431,7 @@ def main(argv):
             raise
 
     # Generate event sources.
-    generateEventSources(manifestFullPath, intermediatesDirFullPath)
+    generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlavor)
     return 0
 
 if __name__ == '__main__':
index c899b63..22a9b41 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Portable.cs" Condition="'$(FeatureCoreCLR)' != 'true'" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.PlatformNotSupported.cs" Condition="'$(FeatureCoreCLR)' != 'true'" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)System\Threading\NativeRuntimeEventSource.PortableThreadPool.cs" Condition="'$(FeatureCoreCLR)' != 'true'" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Threading\NativeRuntimeEventSource.PortableThreadPool.cs" Condition="'$(FeatureCoreCLR)' != 'true' and '$(FeatureMono)' != 'true'" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Threading\NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs" Condition="'$(FeatureCoreCLR)' == 'true' or '$(FeatureMono)' == 'true'"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.GateThread.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.HillClimbing.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.HillClimbing.Complex.cs" />
index ccada4f..0d97fde 100644 (file)
@@ -11,7 +11,7 @@ namespace System.Diagnostics.Tracing
     /// Microsoft-Windows-DotNETRuntime provider and will throw a NotImplementedException without hand-written overloads of the Events.
     /// To have a runtime event be fired from the managed code, you need to add a managed definition for that event
     /// and call into the native runtime that invoke the appropriate native sinks for the platform (i.e. ETW, EventPipe, LTTng).
-    /// To see some examples of this, refer to NativeRuntimeEventSource.PortableThreadPool.CoreClr.cs and NativeRuntimeEventSource.PortableThreadPool.cs.
+    /// To see some examples of this, refer to NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs and NativeRuntimeEventSource.PortableThreadPool.cs.
     /// Then, modify genRuntimeEventSources.py to skip over the event so that it doesn't generate the dummy method.
     /// </summary>
     [EventSource(Guid = "E13C0D23-CCBC-4E12-931B-D9CC2EEE27E4", Name = EventSourceName)]
@@ -16,8 +16,8 @@ namespace System.Diagnostics.Tracing
     // from the mechanism in NativeRuntimeEventSource.ProcessEvents that forwards native runtime events to EventListeners.
     // To prevent this, these events call directly into QCalls provided by the runtime (refer to NativeRuntimeEventSource.cs) which call
     // FireEtw* methods auto-generated from ClrEtwAll.man. This ensures that corresponding event sinks are being used
-    // for the native platform. Refer to src/coreclr/vm/nativeruntimesource.cpp.
-    // For Mono|CoreRT implementation of these events, refer to NativeRuntimeEventSource.PortableThreadPool.cs.
+    // for the native platform.
+    // For implementation of these events not supporting native sinks, refer to NativeRuntimeEventSource.PortableThreadPool.cs.
     internal sealed partial class NativeRuntimeEventSource : EventSource
     {
         // This value does not seem to be used, leaving it as zero for now. It may be useful for a scenario that may involve
@@ -204,62 +204,5 @@ namespace System.Diagnostics.Tracing
             }
             LogThreadPoolWorkingThreadCount(Count, ClrInstanceID);
         }
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolWorkerThreadStart(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolWorkerThreadStop(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolWorkerThreadWait(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolWorkerThreadAdjustmentSample(double Throughput, ushort ClrInstanceID);
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolWorkerThreadAdjustmentAdjustment(double AverageThroughput, uint NewWorkerThreadCount, NativeRuntimeEventSource.ThreadAdjustmentReasonMap Reason, ushort ClrInstanceID);
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolWorkerThreadAdjustmentStats(
-            double Duration,
-            double Throughput,
-            double ThreadPoolWorkerThreadWait,
-            double ThroughputWave,
-            double ThroughputErrorEstimate,
-            double AverageThroughputErrorEstimate,
-            double ThroughputRatio,
-            double Confidence,
-            double NewControlSetting,
-            ushort NewThreadWaveMagnitude,
-            ushort ClrInstanceID);
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolIOEnqueue(
-            IntPtr NativeOverlapped,
-            IntPtr Overlapped,
-            bool MultiDequeues,
-            ushort ClrInstanceID);
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolIODequeue(
-            IntPtr NativeOverlapped,
-            IntPtr Overlapped,
-            ushort ClrInstanceID);
-
-        [NonEvent]
-        [DllImport(RuntimeHelpers.QCall)]
-        internal static extern void LogThreadPoolWorkingThreadCount(
-            uint Count,
-            ushort ClrInstanceID
-        );
     }
 }
index aa953ec..2dcce9f 100644 (file)
@@ -8,12 +8,11 @@ using Internal.Runtime.CompilerServices;
 
 namespace System.Diagnostics.Tracing
 {
-    // This is part of the NativeRuntimeEventsource for Mono|CoreRT, which is the managed version of the Microsoft-Windows-DotNETRuntime provider.
-    // and contains the implementation of ThreadPool events. Since file is shared between Mono|CoreRT it is kept in shared part of SPC.
-    // To look at CoreCLR implementation of these events, refer to NativeRuntimeEventSource.PortableThreadPool.CoreCLR.cs.
+    // This is part of the NativeRuntimeEventsource, which is the managed version of the Microsoft-Windows-DotNETRuntime provider.
+    // Contains the implementation of ThreadPool events. This implemention is used by runtime not supporting NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs.
     internal sealed partial class NativeRuntimeEventSource : EventSource
     {
-        // On Mono|CoreRT, we don't have these keywords defined from the genRuntimeEventSources.py, so we need to manually define them here.
+        // We don't have these keywords defined from the genRuntimeEventSources.py, so we need to manually define them here.
         public static class Keywords
         {
             public const EventKeywords ThreadingKeyword = (EventKeywords)0x10000;
index ed86319..34dcb45 100644 (file)
 
     <DefineConstants>$(DefineConstants);MONO_FEATURE_SRE</DefineConstants>
 
+    <FeatureMono>true</FeatureMono>
     <FeatureManagedEtwChannels>true</FeatureManagedEtwChannels>
     <FeatureManagedEtw>true</FeatureManagedEtw>
     <FeaturePortableTimer Condition="'$(TargetsBrowser)' != 'true'">true</FeaturePortableTimer>
       <Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackFrame.Mono.cs" />
       <Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackTrace.Mono.cs" />
       <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Tracing\EventPipe.Mono.cs" />
+      <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Tracing\NativeRuntimeEventSource.PortableThreadPool.NativeSinks.Mono.cs" Condition="'$(FeaturePortableThreadPool)' == 'true'" />
       <Compile Include="$(BclSourcesRoot)\System\IO\Stream.Mono.cs" />
       <Compile Include="$(BclSourcesRoot)\System\IO\FileLoadException.Mono.cs" />
       <Compile Include="$(BclSourcesRoot)\System\Reflection\Assembly.Mono.cs" />
         SkipUnchangedFiles="true" />
   </Target>
 
+  <!-- Setup eventing file generation -->
+  <ItemGroup>
+    <EventingGenerationScript Include="$(CoreClrProjectRoot)scripts/genRuntimeEventSources.py" />
+    <EventManifestFile Include="$(CoreClrProjectRoot)vm/ClrEtwAll.man" />
+    <EventingSourceFile Include="$(IntermediateOutputPath)..\..\..\Eventing\$(TargetArchitecture)\$(Configuration)\NativeRuntimeEventSource.Mono.cs" Condition="'$(FeaturePerfTracing)' == 'true' ">
+      <Link>src\System\Diagnostics\Eventing\Generated\NativeRuntimeEventSource.Mono.cs</Link>
+    </EventingSourceFile>
+    <Compile Include="@(EventingSourceFile)" />
+  </ItemGroup>
+
+  <Target Name="GenerateEventingFiles"
+          Inputs="@(EventingGenerationScript);@(EventManifestFile)"
+          Outputs="@(EventingSourceFile)"
+          DependsOnTargets="FindPython"
+          BeforeTargets="BeforeCompile">
+
+    <Error Condition="'$(PYTHON)' == ''" Text="Unable to locate Python. NativeRuntimeEventSource.Mono.cs cannot be generated without Python installed on the machine. Either install Python in your path or point to it with the PYTHON environment variable." />
+    <PropertyGroup>
+      <_PythonWarningParameter>-Wall</_PythonWarningParameter>
+      <_PythonWarningParameter Condition="'$(MSBuildTreatWarningsAsErrors)' == 'true'">$(_PythonWarningParameter) -Werror</_PythonWarningParameter>
+      <_EventingSourceFileDirectory>%(EventingSourceFile.RootDir)%(EventingSourceFile.Directory)</_EventingSourceFileDirectory>
+      <_EventingSourceFileDirectory Condition="HasTrailingSlash('$(_EventingSourceFileDirectory)')">$(_EventingSourceFileDirectory.TrimEnd('\'))</_EventingSourceFileDirectory>
+    </PropertyGroup>
+
+    <Exec Command="$(PYTHON) -B $(_PythonWarningParameter) &quot;@(EventingGenerationScript)&quot; --man &quot;@(EventManifestFile)&quot; --intermediate &quot;$(_EventingSourceFileDirectory)&quot; --runtimeflavor mono" />
+
+    <ItemGroup>
+      <FileWrites Include="@(EventingSourceFile)" />
+    </ItemGroup>
+  </Target>
+
 </Project>
diff --git a/src/mono/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.Mono.cs
new file mode 100644 (file)
index 0000000..dcb11c3
--- /dev/null
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Threading;
+using System.Diagnostics.Tracing;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using Internal.Runtime.CompilerServices;
+
+namespace System.Diagnostics.Tracing
+{
+    // This is part of the NativeRuntimeEventsource, which is the managed version of the Microsoft-Windows-DotNETRuntime provider.
+    // It contains the runtime specific interop to native event sinks.
+    internal sealed partial class NativeRuntimeEventSource : EventSource
+    {
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolWorkerThreadStart(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
+
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolWorkerThreadStop(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
+
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolWorkerThreadWait(uint ActiveWorkerThreadCount, uint RetiredWorkerThreadCount, ushort ClrInstanceID);
+
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolWorkerThreadAdjustmentSample(double Throughput, ushort ClrInstanceID);
+
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolWorkerThreadAdjustmentAdjustment(double AverageThroughput, uint NewWorkerThreadCount, NativeRuntimeEventSource.ThreadAdjustmentReasonMap Reason, ushort ClrInstanceID);
+
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolWorkerThreadAdjustmentStats(
+            double Duration,
+            double Throughput,
+            double ThreadPoolWorkerThreadWait,
+            double ThroughputWave,
+            double ThroughputErrorEstimate,
+            double AverageThroughputErrorEstimate,
+            double ThroughputRatio,
+            double Confidence,
+            double NewControlSetting,
+            ushort NewThreadWaveMagnitude,
+            ushort ClrInstanceID);
+
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolIOEnqueue(
+            IntPtr NativeOverlapped,
+            IntPtr Overlapped,
+            bool MultiDequeues,
+            ushort ClrInstanceID);
+
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolIODequeue(
+            IntPtr NativeOverlapped,
+            IntPtr Overlapped,
+            ushort ClrInstanceID);
+
+        [NonEvent]
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal static extern void LogThreadPoolWorkingThreadCount(
+            uint Count,
+            ushort ClrInstanceID
+        );
+    }
+}
index 9abc0c5..3deb3d6 100644 (file)
@@ -98,6 +98,68 @@ event_pipe_stub_thread_ctrl_activity_id (
 static bool
 event_pipe_stub_write_event_ee_startup_start (void);
 
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_start (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_stop (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_wait (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_adjustment_sample (
+       double throughput,
+       uint16_t clr_instance_id);
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_adjustment_adjustment (
+       double average_throughput,
+       uint32_t networker_thread_count,
+       /*NativeRuntimeEventSource.ThreadAdjustmentReasonMap*/ int32_t reason,
+       uint16_t clr_instance_id);
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_adjustment_stats (
+       double duration,
+       double throughput,
+       double threadpool_worker_thread_wait,
+       double throughput_wave,
+       double throughput_error_estimate,
+       double average_throughput_error_estimate,
+       double throughput_ratio,
+       double confidence,
+       double new_control_setting,
+       uint16_t new_thread_wave_magnitude,
+       uint16_t clr_instance_id);
+
+static bool
+event_pipe_stub_write_event_threadpool_io_enqueue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       bool multi_dequeues,
+       uint16_t clr_instance_id);
+
+static bool
+event_pipe_stub_write_event_threadpool_io_dequeue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       uint16_t clr_instance_id);
+
+static bool
+event_pipe_stub_write_event_threadpool_working_thread_count (
+       uint16_t count,
+       uint16_t clr_instance_id);
+
 MonoComponentEventPipe *
 component_event_pipe_stub_init (void);
 
@@ -118,7 +180,16 @@ static MonoComponentEventPipe fn_table = {
        &event_pipe_stub_provider_add_event,
        &event_pipe_stub_get_session_info,
        &event_pipe_stub_thread_ctrl_activity_id,
-       &event_pipe_stub_write_event_ee_startup_start
+       &event_pipe_stub_write_event_ee_startup_start,
+       &event_pipe_stub_write_event_threadpool_worker_thread_start,
+       &event_pipe_stub_write_event_threadpool_worker_thread_stop,
+       &event_pipe_stub_write_event_threadpool_worker_thread_wait,
+       &event_pipe_stub_write_event_threadpool_worker_thread_adjustment_sample,
+       &event_pipe_stub_write_event_threadpool_worker_thread_adjustment_adjustment,
+       &event_pipe_stub_write_event_threadpool_worker_thread_adjustment_stats,
+       &event_pipe_stub_write_event_threadpool_io_enqueue,
+       &event_pipe_stub_write_event_threadpool_io_dequeue,
+       &event_pipe_stub_write_event_threadpool_working_thread_count
 };
 
 static bool
@@ -249,6 +320,95 @@ event_pipe_stub_write_event_ee_startup_start (void)
        return true;
 }
 
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_start (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_stop (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_wait (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_adjustment_sample (
+       double throughput,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_adjustment_adjustment (
+       double average_throughput,
+       uint32_t networker_thread_count,
+       /*NativeRuntimeEventSource.ThreadAdjustmentReasonMap*/ int32_t reason,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
+static bool
+event_pipe_stub_write_event_threadpool_worker_thread_adjustment_stats (
+       double duration,
+       double throughput,
+       double threadpool_worker_thread_wait,
+       double throughput_wave,
+       double throughput_error_estimate,
+       double average_throughput_error_estimate,
+       double throughput_ratio,
+       double confidence,
+       double new_control_setting,
+       uint16_t new_thread_wave_magnitude,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
+static bool
+event_pipe_stub_write_event_threadpool_io_enqueue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       bool multi_dequeues,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
+static bool
+event_pipe_stub_write_event_threadpool_io_dequeue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
+static bool
+event_pipe_stub_write_event_threadpool_working_thread_count (
+       uint16_t count,
+       uint16_t clr_instance_id)
+{
+       return true;
+}
+
 MonoComponentEventPipe *
 component_event_pipe_stub_init (void)
 {
index bdb4b8c..ed49b79 100644 (file)
@@ -87,7 +87,16 @@ static MonoComponentEventPipe fn_table = {
        &ep_provider_add_event,
        &event_pipe_get_session_info,
        &event_pipe_thread_ctrl_activity_id,
-       &ep_rt_mono_write_event_ee_startup_start
+       &ep_rt_mono_write_event_ee_startup_start,
+       &ep_rt_write_event_threadpool_worker_thread_start,
+       &ep_rt_write_event_threadpool_worker_thread_stop,
+       &ep_rt_write_event_threadpool_worker_thread_wait,
+       &ep_rt_write_event_threadpool_worker_thread_adjustment_sample,
+       &ep_rt_write_event_threadpool_worker_thread_adjustment_adjustment,
+       &ep_rt_write_event_threadpool_worker_thread_adjustment_stats,
+       &ep_rt_write_event_threadpool_io_enqueue,
+       &ep_rt_write_event_threadpool_io_dequeue,
+       &ep_rt_write_event_threadpool_working_thread_count
 };
 
 static bool
index 043b65b..e232849 100644 (file)
@@ -128,6 +128,68 @@ typedef bool
 typedef bool
 (*event_pipe_component_write_event_ee_startup_start_func)(void);
 
+typedef bool
+(*event_pipe_component_write_event_threadpool_worker_thread_start_func)(
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+typedef bool
+(*event_pipe_component_write_event_threadpool_worker_thread_stop_func)(
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+typedef bool
+(*event_pipe_component_write_event_threadpool_worker_thread_wait_func)(
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+typedef bool
+(*event_pipe_component_write_event_threadpool_worker_thread_adjustment_sample_func)(
+       double throughput,
+       uint16_t clr_instance_id);
+
+typedef bool
+(*event_pipe_component_write_event_threadpool_worker_thread_adjustment_adjustment_func)(
+       double average_throughput,
+       uint32_t networker_thread_count,
+       /*NativeRuntimeEventSource.ThreadAdjustmentReasonMap*/ int32_t reason,
+       uint16_t clr_instance_id);
+
+typedef bool
+(*event_pipe_component_write_event_threadpool_worker_thread_adjustment_stats_func)(
+       double duration,
+       double throughput,
+       double threadpool_worker_thread_wait,
+       double throughput_wave,
+       double throughput_error_estimate,
+       double average_throughput_error_estimate,
+       double throughput_ratio,
+       double confidence,
+       double new_control_setting,
+       uint16_t new_thread_wave_magnitude,
+       uint16_t clr_instance_id);
+
+typedef bool
+(*event_pipe_component_write_event_threadpool_io_enqueue_func)(
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       bool multi_dequeues,
+       uint16_t clr_instance_id);
+
+typedef bool
+(*event_pipe_component_write_event_threadpool_io_dequeue_func)(
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       uint16_t clr_instance_id);
+
+typedef bool
+(*event_pipe_component_write_event_threadpool_working_thread_count_func)(
+       uint16_t count,
+       uint16_t clr_instance_id);
+
 /*
  * MonoComponentEventPipe function table.
  */
@@ -150,6 +212,15 @@ typedef struct _MonoComponentEventPipe {
        event_pipe_component_get_session_info_func get_session_info;
        event_pipe_component_thread_ctrl_activity_id_func thread_ctrl_activity_id;
        event_pipe_component_write_event_ee_startup_start_func write_event_ee_startup_start;
+       event_pipe_component_write_event_threadpool_worker_thread_start_func write_event_threadpool_worker_thread_start;
+       event_pipe_component_write_event_threadpool_worker_thread_stop_func write_event_threadpool_worker_thread_stop;
+       event_pipe_component_write_event_threadpool_worker_thread_wait_func write_event_threadpool_worker_thread_wait;
+       event_pipe_component_write_event_threadpool_worker_thread_adjustment_sample_func write_event_threadpool_worker_thread_adjustment_sample;
+       event_pipe_component_write_event_threadpool_worker_thread_adjustment_adjustment_func write_event_threadpool_worker_thread_adjustment_adjustment;
+       event_pipe_component_write_event_threadpool_worker_thread_adjustment_stats_func write_event_threadpool_worker_thread_adjustment_stats;
+       event_pipe_component_write_event_threadpool_io_enqueue_func write_event_threadpool_io_enqueue;
+       event_pipe_component_write_event_threadpool_io_dequeue_func write_event_threadpool_io_dequeue;
+       event_pipe_component_write_event_threadpool_working_thread_count_func write_event_threadpool_working_thread_count;
 } MonoComponentEventPipe;
 
 MONO_COMPONENT_EXPORT_ENTRYPOINT
index 77940f6..09c3889 100644 (file)
@@ -1816,6 +1816,148 @@ ep_rt_mono_write_event_assembly_load (MonoAssembly *assembly)
        return true;
 }
 
+bool
+ep_rt_write_event_threadpool_worker_thread_start (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolWorkerThreadStart (
+               active_thread_count,
+               retired_worker_thread_count,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
+bool
+ep_rt_write_event_threadpool_worker_thread_stop (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolWorkerThreadStop (
+               active_thread_count,
+               retired_worker_thread_count,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
+bool
+ep_rt_write_event_threadpool_worker_thread_wait (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolWorkerThreadWait (
+               active_thread_count,
+               retired_worker_thread_count,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
+bool
+ep_rt_write_event_threadpool_worker_thread_adjustment_sample (
+       double throughput,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolWorkerThreadAdjustmentSample (
+               throughput,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
+bool
+ep_rt_write_event_threadpool_worker_thread_adjustment_adjustment (
+       double average_throughput,
+       uint32_t networker_thread_count,
+       /*NativeRuntimeEventSource.ThreadAdjustmentReasonMap*/ int32_t reason,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolWorkerThreadAdjustmentAdjustment (
+               average_throughput,
+               networker_thread_count,
+               reason,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
+bool
+ep_rt_write_event_threadpool_worker_thread_adjustment_stats (
+       double duration,
+       double throughput,
+       double threadpool_worker_thread_wait,
+       double throughput_wave,
+       double throughput_error_estimate,
+       double average_throughput_error_estimate,
+       double throughput_ratio,
+       double confidence,
+       double new_control_setting,
+       uint16_t new_thread_wave_magnitude,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolWorkerThreadAdjustmentStats (
+               duration,
+               throughput,
+               threadpool_worker_thread_wait,
+               throughput_wave,
+               throughput_error_estimate,
+               average_throughput_error_estimate,
+               throughput_ratio,
+               confidence,
+               new_control_setting,
+               new_thread_wave_magnitude,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
+bool
+ep_rt_write_event_threadpool_io_enqueue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       bool multi_dequeues,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolIOEnqueue (
+               (const void *)native_overlapped,
+               (const void *)overlapped,
+               multi_dequeues,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
+bool
+ep_rt_write_event_threadpool_io_dequeue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolIODequeue (
+               (const void *)native_overlapped,
+               (const void *)overlapped,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
+bool
+ep_rt_write_event_threadpool_working_thread_count (
+       uint16_t count,
+       uint16_t clr_instance_id)
+{
+       return FireEtwThreadPoolWorkingThreadCount (
+               count,
+               clr_instance_id,
+               NULL,
+               NULL) == 0 ? true : false;
+}
+
 static
 void
 profiler_jit_begin (
index 985e7d8..d1d2eb4 100644 (file)
@@ -2165,6 +2165,68 @@ ep_rt_mono_write_event_module_load (MonoImage *image);
 bool
 ep_rt_mono_write_event_assembly_load (MonoAssembly *assembly);
 
+bool
+ep_rt_write_event_threadpool_worker_thread_start (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+bool
+ep_rt_write_event_threadpool_worker_thread_stop (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+bool
+ep_rt_write_event_threadpool_worker_thread_wait (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id);
+
+bool
+ep_rt_write_event_threadpool_worker_thread_adjustment_sample (
+       double throughput,
+       uint16_t clr_instance_id);
+
+bool
+ep_rt_write_event_threadpool_worker_thread_adjustment_adjustment (
+       double average_throughput,
+       uint32_t networker_thread_count,
+       /*NativeRuntimeEventSource.ThreadAdjustmentReasonMap*/ int32_t reason,
+       uint16_t clr_instance_id);
+
+bool
+ep_rt_write_event_threadpool_worker_thread_adjustment_stats (
+       double duration,
+       double throughput,
+       double threadpool_worker_thread_wait,
+       double throughput_wave,
+       double throughput_error_estimate,
+       double average_throughput_error_estimate,
+       double throughput_ratio,
+       double confidence,
+       double new_control_setting,
+       uint16_t new_thread_wave_magnitude,
+       uint16_t clr_instance_id);
+
+bool
+ep_rt_write_event_threadpool_io_enqueue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       bool multi_dequeues,
+       uint16_t clr_instance_id);
+
+bool
+ep_rt_write_event_threadpool_io_dequeue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       uint16_t clr_instance_id);
+
+bool
+ep_rt_write_event_threadpool_working_thread_count (
+       uint16_t count,
+       uint16_t clr_instance_id);
+
 /*
 * EventPipe provider callbacks.
 */
index b80a674..40b3bfc 100644 (file)
@@ -18,3 +18,12 @@ MethodLoadVerbose_V1
 ModuleDCEnd_V2
 ModuleLoad_V2
 RuntimeInformationDCStart
+ThreadPoolIODequeue
+ThreadPoolIOEnqueue
+ThreadPoolWorkerThreadAdjustmentAdjustment
+ThreadPoolWorkerThreadAdjustmentSample
+ThreadPoolWorkerThreadAdjustmentStats
+ThreadPoolWorkerThreadStart
+ThreadPoolWorkerThreadStop
+ThreadPoolWorkerThreadWait
+ThreadPoolWorkingThreadCount
index 65cdc26..f226f71 100644 (file)
@@ -201,6 +201,16 @@ ICALL_EXPORT MonoBoolean ves_icall_System_Diagnostics_Tracing_EventPipeInternal_
 ICALL_EXPORT intptr_t ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetWaitHandle (uint64_t session_id);
 ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_EventPipeInternal_WriteEventData (intptr_t event_handle, void *event_data, uint32_t event_data_len, const uint8_t *activity_id, const uint8_t *related_activity_id);
 
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolIODequeue (intptr_t native_overlapped, intptr_t overlapped, uint16_t clr_instance_id);
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolIOEnqueue (intptr_t native_overlapped, intptr_t overlapped, MonoBoolean multi_dequeues, uint16_t clr_instance_id);
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentAdjustment (double average_throughput, uint32_t networker_thread_count, int32_t reason, uint16_t clr_instance_id);
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentSample (double throughput, uint16_t clr_instance_id);
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentStats (double duration, double throughput, double threadpool_worker_thread_wait, double throughput_wave, double throughput_error_estimate, double average_throughput_error_estimate, double throughput_ratio, double confidence, double new_control_setting, uint16_t new_thread_wave_magnitude, uint16_t clr_instance_id);
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadStart (uint32_t active_thread_count, uint32_t retired_worker_thread_count, uint16_t clr_instance_id);
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadStop (uint32_t active_thread_count, uint32_t retired_worker_thread_count, uint16_t clr_instance_id);
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadWait (uint32_t active_thread_count, uint32_t retired_worker_thread_count, uint16_t clr_instance_id);
+ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkingThreadCount (uint16_t count, uint16_t clr_instance_id);
+
 ICALL_EXPORT void ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree (GPtrArray *ptr_array);
 ICALL_EXPORT void ves_icall_Mono_RuntimeMarshal_FreeAssemblyName (MonoAssemblyName *aname, MonoBoolean free_struct);
 ICALL_EXPORT void ves_icall_Mono_SafeStringMarshal_GFree (void *c_str);
index 195faf5..42c1d77 100644 (file)
@@ -76,6 +76,17 @@ NOHANDLES(ICALL(EVENTPIPE_10, "GetSessionInfo", ves_icall_System_Diagnostics_Tra
 NOHANDLES(ICALL(EVENTPIPE_11, "GetWaitHandle", ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetWaitHandle))
 NOHANDLES(ICALL(EVENTPIPE_12, "WriteEventData", ves_icall_System_Diagnostics_Tracing_EventPipeInternal_WriteEventData))
 
+ICALL_TYPE(NATIVE_RUNTIME_EVENT_SOURCE, "System.Diagnostics.Tracing.NativeRuntimeEventSource", NATIVE_RUNTIME_EVENT_SOURCE_1)
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_1, "LogThreadPoolIODequeue", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolIODequeue))
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_2, "LogThreadPoolIOEnqueue", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolIOEnqueue))
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_3, "LogThreadPoolWorkerThreadAdjustmentAdjustment", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentAdjustment))
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_4, "LogThreadPoolWorkerThreadAdjustmentSample", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentSample))
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_5, "LogThreadPoolWorkerThreadAdjustmentStats", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentStats))
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_6, "LogThreadPoolWorkerThreadStart", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadStart))
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_7, "LogThreadPoolWorkerThreadStop", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadStop))
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_8, "LogThreadPoolWorkerThreadWait", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadWait))
+NOHANDLES(ICALL(NATIVE_RUNTIME_EVENT_SOURCE_9, "LogThreadPoolWorkingThreadCount", ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkingThreadCount))
+
 ICALL_TYPE(ENUM, "System.Enum", ENUM_1)
 HANDLES(ENUM_1, "GetEnumValuesAndNames", ves_icall_System_Enum_GetEnumValuesAndNames, MonoBoolean, 3, (MonoReflectionType, MonoArrayOut, MonoArrayOut))
 HANDLES(ENUM_2, "InternalBoxEnum", ves_icall_System_Enum_ToObject, MonoObject, 2, (MonoReflectionType, guint64))
index c9ad5cd..904b328 100644 (file)
@@ -321,6 +321,130 @@ guint64 ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetRuntimeCounter
        }
 }
 
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadStart (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_worker_thread_start (
+               active_thread_count,
+               retired_worker_thread_count,
+               clr_instance_id);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadStop (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_worker_thread_stop (
+               active_thread_count,
+               retired_worker_thread_count,
+               clr_instance_id);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadWait (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_worker_thread_wait (
+               active_thread_count,
+               retired_worker_thread_count,
+               clr_instance_id);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentSample (
+       double throughput,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_worker_thread_adjustment_sample (
+               throughput,
+               clr_instance_id);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentAdjustment (
+       double average_throughput,
+       uint32_t networker_thread_count,
+       /*NativeRuntimeEventSource.ThreadAdjustmentReasonMap*/ int32_t reason,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_worker_thread_adjustment_adjustment (
+               average_throughput,
+               networker_thread_count,
+               reason,
+               clr_instance_id);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentStats (
+       double duration,
+       double throughput,
+       double threadpool_worker_thread_wait,
+       double throughput_wave,
+       double throughput_error_estimate,
+       double average_throughput_error_estimate,
+       double throughput_ratio,
+       double confidence,
+       double new_control_setting,
+       uint16_t new_thread_wave_magnitude,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_worker_thread_adjustment_stats (
+               duration,
+               throughput,
+               threadpool_worker_thread_wait,
+               throughput_wave,
+               throughput_error_estimate,
+               average_throughput_error_estimate,
+               throughput_ratio,
+               confidence,
+               new_control_setting,
+               new_thread_wave_magnitude,
+               clr_instance_id);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolIOEnqueue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       MonoBoolean multi_dequeues,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_io_enqueue (
+               native_overlapped,
+               overlapped,
+               multi_dequeues,
+               clr_instance_id);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolIODequeue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_io_dequeue (
+               native_overlapped,
+               overlapped,
+               clr_instance_id);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkingThreadCount (
+       uint16_t count,
+       uint16_t clr_instance_id)
+{
+       mono_component_event_pipe ()->write_event_threadpool_working_thread_count (
+               count,
+               clr_instance_id);
+}
+
 #else /* ENABLE_PERFTRACING */
 
 gconstpointer
@@ -452,4 +576,111 @@ ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetRuntimeCounterValue (g
        return 0;
 }
 
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadStart (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolWorkerThreadStart");
+       mono_error_set_pending_exception (error);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadStop (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolWorkerThreadStop");
+       mono_error_set_pending_exception (error);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadWait (
+       uint32_t active_thread_count,
+       uint32_t retired_worker_thread_count,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolWorkerThreadWait");
+       mono_error_set_pending_exception (error);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentSample (
+       double throughput,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolWorkerThreadAdjustmentSample");
+       mono_error_set_pending_exception (error);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentAdjustment (
+       double average_throughput,
+       uint32_t networker_thread_count,
+       /*NativeRuntimeEventSource.ThreadAdjustmentReasonMap*/ int32_t reason,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolWorkerThreadAdjustmentAdjustment");
+       mono_error_set_pending_exception (error);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkerThreadAdjustmentStats (
+       double duration,
+       double throughput,
+       double threadpool_worker_thread_wait,
+       double throughput_wave,
+       double throughput_error_estimate,
+       double average_throughput_error_estimate,
+       double throughput_ratio,
+       double confidence,
+       double new_control_setting,
+       uint16_t new_thread_wave_magnitude,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolWorkerThreadAdjustmentStats");
+       mono_error_set_pending_exception (error);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolIOEnqueue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       MonoBoolean multi_dequeues,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolIOEnqueue");
+       mono_error_set_pending_exception (error);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolIODequeue (
+       intptr_t native_overlapped,
+       intptr_t overlapped,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolIODequeue");
+       mono_error_set_pending_exception (error);
+}
+
+void
+ves_icall_System_Diagnostics_Tracing_NativeRuntimeEventSource_LogThreadPoolWorkingThreadCount (
+       uint16_t count,
+       uint16_t clr_instance_id)
+{
+       ERROR_DECL (error);
+       mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.NativeRuntimeEventSource.LogThreadPoolWorkingThreadCount");
+       mono_error_set_pending_exception (error);
+}
+
 #endif /* ENABLE_PERFTRACING */