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

System.Int32

The ID of the TaskScheduler that started the loop.

OriginatingTaskID

System.Int32

The ID of the task that started the loop.

ForkJoinContextID

System.Int32

A unique identifier used to indicate nesting and pairs for events with fork/join semantics.

OperationType

System.Int32

Indicates the type of loop:

1 = ParallelInvoke

2 = ParallelFor

3 = ParallelForEach

InclusiveFrom

System.Int64

The starting value of the loop counter

ExclusiveTo

System.Int64

The ending value of the loop counter

Parallel Loop End

EVENT_DESCRIPTOR.Task = 2

EVENT_DESCRIPTOR.Id = 2

User Data

Name

Type

Description

OriginatingTaskSchedulerID

System.Int32

The ID of the TaskScheduler that started the loop.

OriginatingTaskID

System.Int32

The ID of the task that started the loop.

ForkJoinContextID

System.Int32

A unique identifier used to indicate nesting and pairs for events with fork/join semantics.

totalIterations

System.Int64

The total number of iterations

Parallel Invoke Begin

EVENT_DESCRIPTOR.Task = 3

EVENT_DESCRIPTOR.Id = 3

User Data

Name

Type

Description

OriginatingTaskSchedulerID

System.Int32

The ID of the TaskScheduler that started the loop.

OriginatingTaskID

System.Int32

The ID of the task that started the loop.

ForkJoinContextID

System.Int32

A unique identifier used to indicate nesting and pairs for events with fork/join semantics.

totalIterations

System.Int64

The total number of iterations

operationType

System.Int32

Indicates the type of loop:

1 = ParallelInvoke

2 = ParallelFor

3 = ParallelForEach

ActionCount

System.Int32

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

System.Int32

The ID of the TaskScheduler that started the loop.

OriginatingTaskID

System.Int32

The ID of the task that started the loop.

ForkJoinContextID

System.Int32

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

System.Int32

The ID of the TaskScheduler that started the loop.

OriginatingTaskID

System.Int32

The ID of the task that started the loop.

QueryID

System.Int32

A unique query identifier.

Parallel Query End

EVENT_DESCRIPTOR.Task = 2

EVENT_DESCRIPTOR.Id = 2

User Data

Name

Type

Description

OriginatingTaskSchedulerID

System.Int32

The ID of the TaskScheduler that started the loop.

OriginatingTaskID

System.Int32

The ID of the task that started the loop.

QueryID

System.Int32

A unique query identifier.

See Also

Concepts

Task Parallel Library

Parallel LINQ (PLINQ)

Other Resources

ETW Events in the .NET Framework