Skip to content

Latest commit

 

History

History
120 lines (81 loc) · 5.68 KB

etw-events-in-task-parallel-library-and-plinq.md

File metadata and controls

120 lines (81 loc) · 5.68 KB
title description ms.date helpviewer_keywords ms.topic
ETW Events in Task Parallel Library and PLINQ
Read about ETW events in the Task Parallel Library and PLINQ. Use these events to profile and troubleshoot applications.
03/30/2017
tasks, ETW events
reference

ETW Events in Task Parallel Library and PLINQ

Both the Task Parallel Library and PLINQ generate Event Trace for Windows (ETW) events that you can use to profile and troubleshoot applications by using tools such as the Windows Performance Analyzer. However, in most scenarios, the best way to profile parallel application code is to use the Concurrency Visualizer in Visual Studio.

Task Parallel Library ETW Events

In the EVENT_HEADER structure, the ProviderId GUID for events generated by xref:System.Threading.Tasks.Parallel.For%2A?displayProperty=nameWithType, xref:System.Threading.Tasks.Parallel.ForEach%2A?displayProperty=nameWithType and xref:System.Threading.Tasks.Parallel.Invoke%2A?displayProperty=nameWithType is:

0x2e5dba47, 0xa3d2, 0x4d16, 0x8e, 0xe0, 0x66, 0x71, 0xff, 0xdc, 0xd7, 0xb5

Parallel Loop Begin

EVENT_DESCRIPTOR.Task = 1

EVENT_DESCRIPTOR.Id = 1

User Data

Name Type Description
OriginatingTaskSchedulerID xref:System.Int32?displayProperty=nameWithType The ID of the TaskScheduler that started the loop.
OriginatingTaskID xref:System.Int32?displayProperty=nameWithType The ID of the task that started the loop.
ForkJoinContextID xref:System.Int32?displayProperty=nameWithType A unique identifier used to indicate nesting and pairs for events with fork/join semantics.
OperationType xref:System.Int32?displayProperty=nameWithType Indicates the type of loop:

1 = ParallelInvoke

2 = ParallelFor

3 = ParallelForEach
InclusiveFrom xref:System.Int64?displayProperty=nameWithType The starting value of the loop counter
ExclusiveTo xref:System.Int64?displayProperty=nameWithType The ending value of the loop counter

Parallel Loop End

EVENT_DESCRIPTOR.Task = 2

EVENT_DESCRIPTOR.Id = 2

User Data

Name Type Description
OriginatingTaskSchedulerID xref:System.Int32?displayProperty=nameWithType The ID of the TaskScheduler that started the loop.
OriginatingTaskID xref:System.Int32?displayProperty=nameWithType The ID of the task that started the loop.
ForkJoinContextID xref:System.Int32?displayProperty=nameWithType A unique identifier used to indicate nesting and pairs for events with fork/join semantics.
totalIterations xref:System.Int64?displayProperty=nameWithType The total number of iterations

Parallel Invoke Begin

EVENT_DESCRIPTOR.Task = 3

EVENT_DESCRIPTOR.Id = 3

User Data

Name Type Description
OriginatingTaskSchedulerID xref:System.Int32?displayProperty=nameWithType The ID of the TaskScheduler that started the loop.
OriginatingTaskID xref:System.Int32?displayProperty=nameWithType The ID of the task that started the loop.
ForkJoinContextID xref:System.Int32?displayProperty=nameWithType A unique identifier used to indicate nesting and pairs for events with fork/join semantics.
totalIterations xref:System.Int64?displayProperty=nameWithType The total number of iterations
operationType xref:System.Int32?displayProperty=nameWithType Indicates the type of loop:

1 = ParallelInvoke

2 = ParallelFor

3 = ParallelForEach
ActionCount xref:System.Int32?displayProperty=nameWithType The number of actions that will be executed in the parallel invoke.

Parallel Invoke End

EVENT_DESCRIPTOR.Task = 4

EVENT_DESCRIPTOR.Id = 4

User Data

Name Type Description
OriginatingTaskSchedulerID xref:System.Int32?displayProperty=nameWithType The ID of the TaskScheduler that started the loop.
OriginatingTaskID xref:System.Int32?displayProperty=nameWithType The ID of the task that started the loop.
ForkJoinContextID xref:System.Int32?displayProperty=nameWithType A unique identifier used to indicate nesting and pairs for events with fork/join semantics.

PLINQ ETW Events

The EVENT_HEADER.ProviderId GUID for PLINQ is:

0x159eeeec, 0x4a14, 0x4418, 0xa8, 0xfe, 0xfa, 0xab, 0xcd, 0x98, 0x78, 0x87

Parallel Query Begin

EVENT_DESCRIPTOR.Task = 1

EVENT_DESCRIPTOR.Id = 1

User Data

Name Type Description
OriginatingTaskSchedulerID xref:System.Int32?displayProperty=nameWithType The ID of the TaskScheduler that started the loop.
OriginatingTaskID xref:System.Int32?displayProperty=nameWithType The ID of the task that started the loop.
QueryID xref:System.Int32?displayProperty=nameWithType A unique query identifier.

Parallel Query End

EVENT_DESCRIPTOR.Task = 2

EVENT_DESCRIPTOR.Id = 2

User Data

Name Type Description
OriginatingTaskSchedulerID xref:System.Int32?displayProperty=nameWithType The ID of the TaskScheduler that started the loop.
OriginatingTaskID xref:System.Int32?displayProperty=nameWithType The ID of the task that started the loop.
QueryID xref:System.Int32?displayProperty=nameWithType A unique query identifier.

See also