TraceLoggingThreadActivityIdSetter class (traceloggingactivity.h)

Tags a thread with an activity id so ETW marks all events in that thread with the activity id.

TraceLoggingThreadActivityIdSetter has these types of members:

Constructors

The TraceLoggingThreadActivityIdSetter class has these constructors.

Constructor Description
TraceLoggingThreadActivityIdSetter Constructor Creates a new TraceLoggingThreadActivityIdSetter object.
TraceLoggingThreadActivityIdSetter Constructor Saves the original activity ID and sets a new activity on the thread.
TraceLoggingThreadActivityIdSetter Destructor Restores the original activity ID to the thread.

Methods

The TraceLoggingThreadActivityIdSetter class has these methods.

 
TraceLoggingThreadActivityIdSetter::~TraceLoggingThreadActivityIdSetter

Restores the original activity ID to the thread.
TraceLoggingThreadActivityIdSetter::TraceLoggingThreadActivityIdSetter

Creates a new TraceLoggingThreadActivityIdSetter object. (overload 2/2)
TraceLoggingThreadActivityIdSetter::TraceLoggingThreadActivityIdSetter

Creates a new TraceLoggingThreadActivityIdSetter object. (overload 1/2)

Remarks

All activity that occurs in a thread will be tagged with the associated activity id for the life of this object or until a new activity is nested in the thread. That new nested id will take precedence over the TraceLoggingThreadActivityIdSetter object.

Important

Only use this class when you can guarantee that all activities for this thread are fully nested. In DEBUG builds, the class will raise an assertion during its Stop event, if it detects incorrect activity nesting, or if the Stop event occurs on a thread other than the thread used to start it.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2012 R2 [desktop apps only]
Target Platform Windows
Header traceloggingactivity.h