EventSource.WriteEventWithRelatedActivityIdCore(Int32, Guid*, Int32, EventSource+EventData*) Método

Definición

Importante

Esta API no es conforme a CLS.

Escribe un evento que indica que la actividad actual se relaciona con otra actividad.Writes an event that indicates that the current activity is related to another activity.

protected:
 void WriteEventWithRelatedActivityIdCore(int eventId, Guid* childActivityID, int eventDataCount, System::Diagnostics::Tracing::EventSource::EventData* data);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
protected void WriteEventWithRelatedActivityIdCore (int eventId, Guid* childActivityID, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data);
member this.WriteEventWithRelatedActivityIdCore : int * nativeptr<Guid> * int * nativeptr<System.Diagnostics.Tracing.EventSource.EventData> -> unit

Parámetros

eventId
Int32

Un identificador que identifica de forma única este evento dentro de EventSource.An identifier that uniquely identifies this event within the EventSource.

relatedActivityId
Guid*

Puntero al GUID del identificador de actividad relacionado.A pointer to the GUID of the related activity ID.

eventDataCount
Int32

El número de elementos en el campo data.The number of items in the data field.

data
EventSource.EventData

Un puntero al primer elemento del campo de datos de evento.A pointer to the first item in the event data field.

Atributos

Ejemplos

En el C# ejemplo de código siguiente se muestra cómo definir una sobrecarga de WriteEventWithRelatedActivityIdCoremétodo que llama a.The following C# code example shows how to define a method overload that calls WriteEventWithRelatedActivityIdCore.

[EventSource(Name = "Litware-ProductName-ComponentName")]
public sealed class LitwareComponentNameEventSource : EventSource
{
    [Event(1, Task = Tasks.Request, Opcode = EventOpcode.Send)]
    public void RequestStart(Guid relatedActivityId, int reqId, string url)
    {
        WriteEventWithRelatedActivityIdCore(1, relatedActivityId, reqId, url);
    }

}

<EventSource(Name:="Litware-ProductName-ComponentName")> _
Public NotInheritable Class LitwareComponentNameEventSource
    Inherits EventSource
    <[Event](1, Task:=Tasks.Request, Opcode:=EventOpcode.Send)> _
    Public Sub RequestStart(relatedActivityId As Guid, reqId As Integer, url As String)
        WriteEventWithRelatedActivityIdCore(1, relatedActivityId, reqId, url)
    End Sub

End Class

#region Keywords / Task / Opcodes
public static class Tasks
{
    public const EventTask Request = (EventTask)0x1;
}
#endregion
#Region "Keywords / Task / Opcodes"
    Public NotInheritable Class Tasks
        Private Sub New()
        End Sub
        Public Const Request As EventTask = DirectCast(&H1, EventTask)
    End Class
#End Region

Comentarios

WriteEventWithRelatedActivityIdCorees similar al WriteEventWithRelatedActivityId método pero ofrece un mejor rendimiento, bevcause no tiene que aplicar la conversión unboxing data a los childActivityID argumentos y.WriteEventWithRelatedActivityIdCore is similar to the WriteEventWithRelatedActivityId method but offers better performance, bevcause it does not have to unbox the childActivityID and data arguments.

El método de evento ETW que llama a esta función debe seguir estas instrucciones:Your ETW event method calling this function must follow these guidelines:

  1. Especifique el primer parámetro como un Guid con relatedActivityIdnombre.Specify the first parameter as a Guid named relatedActivityId.

  2. Send Especifique o Receive como laEventAttribute.Opcode propiedad.Specify either Send or Receive as the EventAttribute.Opcode property.

  3. Llamada WriteEventWithRelatedActivityIdCore que se pasa en el identificador de evento, seguido del GUID de identificador relacionado, seguido de todos los parámetros que se pasan al método de evento, en el mismo orden.Call WriteEventWithRelatedActivityIdCore passing in the event ID, followed by the related ID GUID, followed by all the parameters the event method is passed, in the same order.

Se aplica a