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 Ultimate.
Task Parallel Library ETW Events
In the EVENT_HEADER structure, the ProviderId GUID for events generated by ParallelFor(), ParallelForEach() and ParallelInvoke() 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 |
The ID of the TaskScheduler that started the loop. |
|
OriginatingTaskID |
The ID of the task that started the loop. |
|
ForkJoinContextID |
A unique identifier used to indicate nesting and pairs for events with fork/join semantics. |
|
OperationType |
Indicates the type of loop: 1 = ParallelInvoke 2 = ParallelFor 3 = ParallelForEach |
|
InclusiveFrom |
The starting value of the loop counter |
|
ExclusiveTo |
The ending value of the loop counter |
Parallel Loop End
EVENT_DESCRIPTOR.Task = 2
EVENT_DESCRIPTOR.Id = 2
User Data
Name |
Type |
Description |
---|---|---|
OriginatingTaskSchedulerID |
The ID of the TaskScheduler that started the loop. |
|
OriginatingTaskID |
The ID of the task that started the loop. |
|
ForkJoinContextID |
A unique identifier used to indicate nesting and pairs for events with fork/join semantics. |
|
totalIterations |
The total number of iterations |
Parallel Invoke Begin
EVENT_DESCRIPTOR.Task = 3
EVENT_DESCRIPTOR.Id = 3
User Data
Name |
Type |
Description |
---|---|---|
OriginatingTaskSchedulerID |
The ID of the TaskScheduler that started the loop. |
|
OriginatingTaskID |
The ID of the task that started the loop. |
|
ForkJoinContextID |
A unique identifier used to indicate nesting and pairs for events with fork/join semantics. |
|
totalIterations |
The total number of iterations |
|
operationType |
Indicates the type of loop: 1 = ParallelInvoke 2 = ParallelFor 3 = ParallelForEach |
|
ActionCount |
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 |
The ID of the TaskScheduler that started the loop. |
|
OriginatingTaskID |
The ID of the task that started the loop. |
|
ForkJoinContextID |
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 |
The ID of the TaskScheduler that started the loop. |
|
OriginatingTaskID |
The ID of the task that started the loop. |
|
QueryID |
A unique query identifier. |
Parallel Query End
EVENT_DESCRIPTOR.Task = 2
EVENT_DESCRIPTOR.Id = 2
User Data
Name |
Type |
Description |
---|---|---|
OriginatingTaskSchedulerID |
The ID of the TaskScheduler that started the loop. |
|
OriginatingTaskID |
The ID of the task that started the loop. |
|
QueryID |
A unique query identifier. |