Writing Related Events in a Classic Provider

Classic providers use the TraceEventInstance function to trace events that are part of a single transaction. You can also use this function to trace parent/child events.

Before calling the TraceEventInstance function, you must first call the CreateTraceInstanceId function to obtain a transaction identifier. This function generates a unique transaction identifier, and maps it to a registered class GUID handle. The handles for registered class GUIDs are available in the RegHandle members of TRACE_GUID_REGISTRATION structures, after calling the RegisterTraceGuids function. The transaction identifier is placed in the InstanceId member of an EVENT_INSTANCE_INFO structure that you pass to the CreateTraceInstanceId function.

The EVENT_INSTANCE_HEADER structure that is passed to the TraceEventInstance function is similar to the EVENT_TRACE_HEADER structure (see Tracing Events), except that it contains additional information relating to instances, and does not contain a Guid member.

Event instances can be used to establish a hierarchical relationship between events. The TraceEventInstance function accepts instance-specific information from two event instances. The pInstInfo parameter points to the EVENT_INSTANCE_INFO structure of the event instance, and the pParentInstInfo parameter points to the EVENT_INSTANCE_INFO structure of a parent event instance. The definition of a "parent" event instance is application-defined; the parent can be any instance that has already been generated.

 

 

Show: