AsyncCausalityTracer AsyncCausalityTracer AsyncCausalityTracer AsyncCausalityTracer Class

Definition

Enables tracing control flow across asynchronous operations.

public : static class AsyncCausalityTracer
public static class AsyncCausalityTracer
Public Static Class AsyncCausalityTracer
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The AsyncCausalityTracer class provides methods that enable creating, propagating, and tracking causality as control flows across asynchronous operations. The causality is an abstraction for tracking both asynchronous and synchronous activities. You can use the collected data to develop causality graphs that are useful for debugging. Causality tracing uses event tracing for Windows (ETW) for logging.

Methods

TraceOperationCompletion(CausalityTraceLevel, CausalitySource, Guid, UInt64, AsyncStatus) TraceOperationCompletion(CausalityTraceLevel, CausalitySource, Guid, UInt64, AsyncStatus) TraceOperationCompletion(CausalityTraceLevel, CausalitySource, Guid, UInt64, AsyncStatus) TraceOperationCompletion(CausalityTraceLevel, CausalitySource, Guid, UInt64, AsyncStatus)

Indicates that a previously created asynchronous operation has completed all of its asynchronous work.

public : static void TraceOperationCompletion(CausalityTraceLevel traceLevel, CausalitySource source, Platform::Guid platformId, unsigned __int64 operationId, AsyncStatus status)
public static void TraceOperationCompletion(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, UInt64 operationId, AsyncStatus status)
Public Static Function TraceOperationCompletion(traceLevel As CausalityTraceLevel, source As CausalitySource, platformId As Guid, operationId As UInt64, status As AsyncStatus) As void
Windows.Foundation.Diagnostics.AsyncCausalityTracer.traceOperationCompletion(traceLevel, source, platformId, operationId, status);
Parameters
platformId
Platform::Guid Guid Guid Guid

Identifier for the operation type.

operationId
unsigned __int64 UInt64 UInt64 UInt64

The identifier for the asynchronous operation that's unique within the platform for the operation's lifetime.

status
AsyncStatus AsyncStatus AsyncStatus AsyncStatus

The completion status of the asynchronous operation.

Remarks

This function is used to indicate that a previously created asynchronous operation has completed all of its asynchronous work. The only work that the operation may schedule after logging completion is its completion continuation. The operationId and platformId parameters must match an asynchronous operation that was previously logged by a call to the TraceOperationCreation method.

See Also

TraceOperationCreation(CausalityTraceLevel, CausalitySource, Guid, UInt64, String, UInt64) TraceOperationCreation(CausalityTraceLevel, CausalitySource, Guid, UInt64, String, UInt64) TraceOperationCreation(CausalityTraceLevel, CausalitySource, Guid, UInt64, String, UInt64) TraceOperationCreation(CausalityTraceLevel, CausalitySource, Guid, UInt64, String, UInt64)

Logs the creation of an asynchronous operation.

public : static void TraceOperationCreation(CausalityTraceLevel traceLevel, CausalitySource source, Platform::Guid platformId, unsigned __int64 operationId, Platform::String operationName, unsigned __int64 relatedContext)
public static void TraceOperationCreation(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, UInt64 operationId, String operationName, UInt64 relatedContext)
Public Static Function TraceOperationCreation(traceLevel As CausalityTraceLevel, source As CausalitySource, platformId As Guid, operationId As UInt64, operationName As String, relatedContext As UInt64) As void
Windows.Foundation.Diagnostics.AsyncCausalityTracer.traceOperationCreation(traceLevel, source, platformId, operationId, operationName, relatedContext);
Parameters
platformId
Platform::Guid Guid Guid Guid

Identifier for the operation type.

operationId
unsigned __int64 UInt64 UInt64 UInt64

An identifier for the asynchronous operation that's unique within the platform for the operation's lifetime.

operationName
Platform::String String String String

A human-readable description of the asynchronous work.

relatedContext
unsigned __int64 UInt64 UInt64 UInt64

Additional information related to this operation.

Remarks

Use the TraceOperationCreation method to log the creation of an asynchronous operation. An asynchronous operation represents a group of zero or more related synchronous work items that may be scheduled in an asynchronous way. Each asynchronous operation has a 128-bit GUID that identifies the operation type, like BCL task and WinJS Promise, and a UInt64 operation identifier that must be unique within the platform for the lifetime of the asynchronous operation. Good choices for operationId include a native pointer to an underlying object, or an integer that's incremented for each new operation. The operationName should be a human readable description of the asynchronous work. The relatedContext associates any additional information related to this operation.

See Also

TraceOperationRelation(CausalityTraceLevel, CausalitySource, Guid, UInt64, CausalityRelation) TraceOperationRelation(CausalityTraceLevel, CausalitySource, Guid, UInt64, CausalityRelation) TraceOperationRelation(CausalityTraceLevel, CausalitySource, Guid, UInt64, CausalityRelation) TraceOperationRelation(CausalityTraceLevel, CausalitySource, Guid, UInt64, CausalityRelation)

Logs the relation between the currently running synchronous work item and a specific asynchronous operation that it's related to.

public : static void TraceOperationRelation(CausalityTraceLevel traceLevel, CausalitySource source, Platform::Guid platformId, unsigned __int64 operationId, CausalityRelation relation)
public static void TraceOperationRelation(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, UInt64 operationId, CausalityRelation relation)
Public Static Function TraceOperationRelation(traceLevel As CausalityTraceLevel, source As CausalitySource, platformId As Guid, operationId As UInt64, relation As CausalityRelation) As void
Windows.Foundation.Diagnostics.AsyncCausalityTracer.traceOperationRelation(traceLevel, source, platformId, operationId, relation);
Parameters
platformId
Platform::Guid Guid Guid Guid

Identifier for the operation type.

operationId
unsigned __int64 UInt64 UInt64 UInt64

The identifier for the asynchronous operation that's unique within the platform for the operation's lifetime.

relation
CausalityRelation CausalityRelation CausalityRelation CausalityRelation

The relationship between the synchronous work item and asynchronous operation identified by operationId.

Remarks

Causality relations track ways that synchronous work items may interact with asynchronous operations.

See Also

TraceSynchronousWorkCompletion(CausalityTraceLevel, CausalitySource, CausalitySynchronousWork) TraceSynchronousWorkCompletion(CausalityTraceLevel, CausalitySource, CausalitySynchronousWork) TraceSynchronousWorkCompletion(CausalityTraceLevel, CausalitySource, CausalitySynchronousWork) TraceSynchronousWorkCompletion(CausalityTraceLevel, CausalitySource, CausalitySynchronousWork)

Indicates that the most recently created synchronous work item running on the thread that the TraceSynchronousWorkCompletion method is called on has completed.

public : static void TraceSynchronousWorkCompletion(CausalityTraceLevel traceLevel, CausalitySource source, CausalitySynchronousWork work)
public static void TraceSynchronousWorkCompletion(CausalityTraceLevel traceLevel, CausalitySource source, CausalitySynchronousWork work)
Public Static Function TraceSynchronousWorkCompletion(traceLevel As CausalityTraceLevel, source As CausalitySource, work As CausalitySynchronousWork) As void
Windows.Foundation.Diagnostics.AsyncCausalityTracer.traceSynchronousWorkCompletion(traceLevel, source, work);
Parameters
See Also

TraceSynchronousWorkStart(CausalityTraceLevel, CausalitySource, Guid, UInt64, CausalitySynchronousWork) TraceSynchronousWorkStart(CausalityTraceLevel, CausalitySource, Guid, UInt64, CausalitySynchronousWork) TraceSynchronousWorkStart(CausalityTraceLevel, CausalitySource, Guid, UInt64, CausalitySynchronousWork) TraceSynchronousWorkStart(CausalityTraceLevel, CausalitySource, Guid, UInt64, CausalitySynchronousWork)

Indicates that the specified asynchronous operation is scheduling synchronous work on the thread that the TraceSynchronousWorkStart method is called on.

public : static void TraceSynchronousWorkStart(CausalityTraceLevel traceLevel, CausalitySource source, Platform::Guid platformId, unsigned __int64 operationId, CausalitySynchronousWork work)
public static void TraceSynchronousWorkStart(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, UInt64 operationId, CausalitySynchronousWork work)
Public Static Function TraceSynchronousWorkStart(traceLevel As CausalityTraceLevel, source As CausalitySource, platformId As Guid, operationId As UInt64, work As CausalitySynchronousWork) As void
Windows.Foundation.Diagnostics.AsyncCausalityTracer.traceSynchronousWorkStart(traceLevel, source, platformId, operationId, work);
Parameters
platformId
Platform::Guid Guid Guid Guid

Identifier for the operation type.

operationId
unsigned __int64 UInt64 UInt64 UInt64

The identifier for the asynchronous operation that's unique within the platform for the operation's lifetime.

work
CausalitySynchronousWork CausalitySynchronousWork CausalitySynchronousWork CausalitySynchronousWork

The relationship between the work item and the asynchronous operation.

See Also

Events

TracingStatusChanged TracingStatusChanged TracingStatusChanged TracingStatusChanged

Raised when a client starts listening to the causality trace.

public : event EventHandler TracingStatusChanged<TracingStatusChangedEventArgs>
public event EventHandler TracingStatusChanged<TracingStatusChangedEventArgs>
Public Event EventHandler TracingStatusChanged( Of ( Of TracingStatusChangedEventArgs ))
function onTracingStatusChanged(eventArgs){/* Your code */}


asyncCausalityTracer.addEventListener("tracingStatusChanged", onTracingStatusChanged);
asyncCausalityTracer.removeEventListener("tracingStatusChanged", onTracingStatusChanged);

Remarks

The logging level and flags are passed to enable fine-grained decisions about which instrumentation points should be enabled.

The TracingStatusChanged event is raised when logging is disabled.

See Also

See Also