diff options
Diffstat (limited to 'src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs')
-rw-r--r-- | src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs | 214 |
1 files changed, 6 insertions, 208 deletions
diff --git a/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs b/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs index 325aa91b44..12cc1daa63 100644 --- a/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs +++ b/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs @@ -14,7 +14,6 @@ using System; using System.Collections.Generic; using System.Text; using System.Security; -using System.Security.Permissions; using System.Runtime.CompilerServices; namespace System.Threading.Tasks @@ -61,17 +60,6 @@ namespace System.Threading.Tasks /// <summary>Prevent external instantiation. All logging should go through the Log instance.</summary> private TplEtwProvider() { } - /// <summary>Type of a fork/join operation.</summary> - public enum ForkJoinOperationType - { - /// <summary>Parallel.Invoke.</summary> - ParallelInvoke=1, - /// <summary>Parallel.For.</summary> - ParallelFor=2, - /// <summary>Parallel.ForEach.</summary> - ParallelForEach=3 - } - /// <summary>Configured behavior of a task wait operation.</summary> public enum TaskWaitBehavior : int { @@ -203,195 +191,6 @@ namespace System.Threading.Tasks //----------------------------------------------------------------------------------- // - // Parallel Events - // - - #region ParallelLoopBegin - /// <summary> - /// Denotes the entry point for a Parallel.For or Parallel.ForEach loop - /// </summary> - /// <param name="OriginatingTaskSchedulerID">The scheduler ID.</param> - /// <param name="OriginatingTaskID">The task ID.</param> - /// <param name="ForkJoinContextID">The loop ID.</param> - /// <param name="OperationType">The kind of fork/join operation.</param> - /// <param name="InclusiveFrom">The lower bound of the loop.</param> - /// <param name="ExclusiveTo">The upper bound of the loop.</param> - [Event(PARALLELLOOPBEGIN_ID, Level = EventLevel.Informational, ActivityOptions=EventActivityOptions.Recursive, - Task = TplEtwProvider.Tasks.Loop, Opcode = EventOpcode.Start)] - public void ParallelLoopBegin( - int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER - int ForkJoinContextID, ForkJoinOperationType OperationType, // PFX_FORKJOIN_COMMON_EVENT_HEADER - long InclusiveFrom, long ExclusiveTo) - { - if (IsEnabled() && IsEnabled(EventLevel.Informational, Keywords.Parallel)) - { - // There is no explicit WriteEvent() overload matching this event's fields. Therefore calling - // WriteEvent() would hit the "params" overload, which leads to an object allocation every time - // this event is fired. To prevent that problem we will call WriteEventCore(), which works with - // a stack based EventData array populated with the event fields. - unsafe - { - EventData* eventPayload = stackalloc EventData[6]; - - eventPayload[0].Size = sizeof(int); - eventPayload[0].DataPointer = ((IntPtr) (&OriginatingTaskSchedulerID)); - eventPayload[1].Size = sizeof(int); - eventPayload[1].DataPointer = ((IntPtr) (&OriginatingTaskID)); - eventPayload[2].Size = sizeof(int); - eventPayload[2].DataPointer = ((IntPtr) (&ForkJoinContextID)); - eventPayload[3].Size = sizeof(int); - eventPayload[3].DataPointer = ((IntPtr) (&OperationType)); - eventPayload[4].Size = sizeof(long); - eventPayload[4].DataPointer = ((IntPtr) (&InclusiveFrom)); - eventPayload[5].Size = sizeof(long); - eventPayload[5].DataPointer = ((IntPtr) (&ExclusiveTo)); - - WriteEventCore(PARALLELLOOPBEGIN_ID, 6, eventPayload); - } - } - } - #endregion - - #region ParallelLoopEnd - /// <summary> - /// Denotes the end of a Parallel.For or Parallel.ForEach loop. - /// </summary> - /// <param name="OriginatingTaskSchedulerID">The scheduler ID.</param> - /// <param name="OriginatingTaskID">The task ID.</param> - /// <param name="ForkJoinContextID">The loop ID.</param> - /// <param name="TotalIterations">the total number of iterations processed.</param> - [Event(PARALLELLOOPEND_ID, Level = EventLevel.Informational, Task = TplEtwProvider.Tasks.Loop, Opcode = EventOpcode.Stop)] - public void ParallelLoopEnd( - int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER - int ForkJoinContextID, long TotalIterations) - { - if (IsEnabled() && IsEnabled(EventLevel.Informational, Keywords.Parallel)) - { - // There is no explicit WriteEvent() overload matching this event's fields. - // Therefore calling WriteEvent() would hit the "params" overload, which leads to an object allocation every time this event is fired. - // To prevent that problem we will call WriteEventCore(), which works with a stack based EventData array populated with the event fields - unsafe - { - EventData* eventPayload = stackalloc EventData[4]; - - eventPayload[0].Size = sizeof(int); - eventPayload[0].DataPointer = ((IntPtr) (&OriginatingTaskSchedulerID)); - eventPayload[1].Size = sizeof(int); - eventPayload[1].DataPointer = ((IntPtr) (&OriginatingTaskID)); - eventPayload[2].Size = sizeof(int); - eventPayload[2].DataPointer = ((IntPtr) (&ForkJoinContextID)); - eventPayload[3].Size = sizeof(long); - eventPayload[3].DataPointer = ((IntPtr) (&TotalIterations)); - - WriteEventCore(PARALLELLOOPEND_ID, 4, eventPayload); - } - } - } - #endregion - - #region ParallelInvokeBegin - /// <summary>Denotes the entry point for a Parallel.Invoke call.</summary> - /// <param name="OriginatingTaskSchedulerID">The scheduler ID.</param> - /// <param name="OriginatingTaskID">The task ID.</param> - /// <param name="ForkJoinContextID">The invoke ID.</param> - /// <param name="OperationType">The kind of fork/join operation.</param> - /// <param name="ActionCount">The number of actions being invoked.</param> - [Event(PARALLELINVOKEBEGIN_ID, Level = EventLevel.Informational, ActivityOptions=EventActivityOptions.Recursive, - Task = TplEtwProvider.Tasks.Invoke, Opcode = EventOpcode.Start)] - public void ParallelInvokeBegin( - int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER - int ForkJoinContextID, ForkJoinOperationType OperationType, // PFX_FORKJOIN_COMMON_EVENT_HEADER - int ActionCount) - { - if (IsEnabled() && IsEnabled(EventLevel.Informational, Keywords.Parallel)) - { - // There is no explicit WriteEvent() overload matching this event's fields. - // Therefore calling WriteEvent() would hit the "params" overload, which leads to an object allocation every time this event is fired. - // To prevent that problem we will call WriteEventCore(), which works with a stack based EventData array populated with the event fields - unsafe - { - EventData* eventPayload = stackalloc EventData[5]; - - eventPayload[0].Size = sizeof(int); - eventPayload[0].DataPointer = ((IntPtr) (&OriginatingTaskSchedulerID)); - eventPayload[1].Size = sizeof(int); - eventPayload[1].DataPointer = ((IntPtr) (&OriginatingTaskID)); - eventPayload[2].Size = sizeof(int); - eventPayload[2].DataPointer = ((IntPtr) (&ForkJoinContextID)); - eventPayload[3].Size = sizeof(int); - eventPayload[3].DataPointer = ((IntPtr) (&OperationType)); - eventPayload[4].Size = sizeof(int); - eventPayload[4].DataPointer = ((IntPtr) (&ActionCount)); - - WriteEventCore(PARALLELINVOKEBEGIN_ID, 5, eventPayload); - } - } - } - #endregion - - #region ParallelInvokeEnd - /// <summary> - /// Denotes the exit point for a Parallel.Invoke call. - /// </summary> - /// <param name="OriginatingTaskSchedulerID">The scheduler ID.</param> - /// <param name="OriginatingTaskID">The task ID.</param> - /// <param name="ForkJoinContextID">The invoke ID.</param> - [Event(PARALLELINVOKEEND_ID, Level = EventLevel.Informational, Task = TplEtwProvider.Tasks.Invoke, Opcode = EventOpcode.Stop)] - public void ParallelInvokeEnd( - int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER - int ForkJoinContextID) - { - if (IsEnabled() && IsEnabled(EventLevel.Informational, Keywords.Parallel)) - { - WriteEvent(PARALLELINVOKEEND_ID, OriginatingTaskSchedulerID, OriginatingTaskID, ForkJoinContextID); - } - } - #endregion - - #region ParallelFork - /// <summary> - /// Denotes the start of an individual task that's part of a fork/join context. - /// Before this event is fired, the start of the new fork/join context will be marked - /// with another event that declares a unique context ID. - /// </summary> - /// <param name="OriginatingTaskSchedulerID">The scheduler ID.</param> - /// <param name="OriginatingTaskID">The task ID.</param> - /// <param name="ForkJoinContextID">The invoke ID.</param> - [Event(PARALLELFORK_ID, Level = EventLevel.Verbose, ActivityOptions=EventActivityOptions.Recursive, - Task = TplEtwProvider.Tasks.ForkJoin, Opcode = EventOpcode.Start)] - public void ParallelFork( - int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER - int ForkJoinContextID) - { - if (IsEnabled() && IsEnabled(EventLevel.Verbose, Keywords.Parallel)) - { - WriteEvent(PARALLELFORK_ID, OriginatingTaskSchedulerID, OriginatingTaskID, ForkJoinContextID); - } - } - #endregion - - #region ParallelJoin - /// <summary> - /// Denotes the end of an individual task that's part of a fork/join context. - /// This should match a previous ParallelFork event with a matching "OriginatingTaskID" - /// </summary> - /// <param name="OriginatingTaskSchedulerID">The scheduler ID.</param> - /// <param name="OriginatingTaskID">The task ID.</param> - /// <param name="ForkJoinContextID">The invoke ID.</param> - [Event(PARALLELJOIN_ID, Level = EventLevel.Verbose, Task = TplEtwProvider.Tasks.ForkJoin, Opcode = EventOpcode.Stop)] - public void ParallelJoin( - int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER - int ForkJoinContextID) - { - if (IsEnabled() && IsEnabled(EventLevel.Verbose, Keywords.Parallel)) - { - WriteEvent(PARALLELJOIN_ID, OriginatingTaskSchedulerID, OriginatingTaskID, ForkJoinContextID); - } - } - #endregion - - //----------------------------------------------------------------------------------- - // // Task Events // @@ -512,7 +311,7 @@ namespace System.Threading.Tasks Level = EventLevel.Informational, Keywords = Keywords.TaskTransfer|Keywords.Tasks)] public void TaskWaitBegin( int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER - int TaskID, TaskWaitBehavior Behavior, int ContinueWithTaskID, int appDomain) + int TaskID, TaskWaitBehavior Behavior, int ContinueWithTaskID) { if (IsEnabled() && IsEnabled(EventLevel.Informational, Keywords.TaskTransfer|Keywords.Tasks)) { @@ -534,8 +333,10 @@ namespace System.Threading.Tasks Guid childActivityId = CreateGuidForTaskID(TaskID); WriteEventWithRelatedActivityIdCore(TASKWAITBEGIN_ID, &childActivityId, 5, eventPayload); } - else + else + { WriteEventCore(TASKWAITBEGIN_ID, 5, eventPayload); + } } } } @@ -688,7 +489,7 @@ namespace System.Threading.Tasks } } - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] unsafe public void RunningContinuation(int TaskID, object Object) { RunningContinuation(TaskID, (long) *((void**) JitHelpers.UnsafeCastToStackPointer(ref Object))); } [Event(20, Keywords = Keywords.Debug)] private void RunningContinuation(int TaskID, long Object) @@ -697,7 +498,7 @@ namespace System.Threading.Tasks WriteEvent(20, TaskID, Object); } - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] unsafe public void RunningContinuationList(int TaskID, int Index, object Object) { RunningContinuationList(TaskID, Index, (long) *((void**) JitHelpers.UnsafeCastToStackPointer(ref Object))); } [Event(21, Keywords = Keywords.Debug)] @@ -707,9 +508,6 @@ namespace System.Threading.Tasks WriteEvent(21, TaskID, Index, Object); } - [Event(22, Keywords = Keywords.Debug)] - public void DebugMessage(string Message) { WriteEvent(22, Message); } - [Event(23, Keywords = Keywords.Debug)] public void DebugFacilityMessage(string Facility, string Message) { WriteEvent(23, Facility, Message); } |