EventSource.WriteEventWithRelatedActivityIdCore Méthode

Définition

Important

Cette API n’est pas conforme CLS.

Écrit un événement qui indique que l'activité actuelle est liée à une autre activité.

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

Paramètres

eventId
Int32

Identificateur qui identifie de manière unique cet événement au sein de l'objet EventSource.

relatedActivityIdchildActivityID
Guid*

Pointeur vers le GUID de l'ID d'activité associé.

eventDataCount
Int32

Nombre d'éléments dans le champ data.

data
EventSource.EventData

Pointeur vers le premier élément dans le champ de données de l'événement.

Attributs

Exemples

L’exemple de code C# suivant montre comment définir une surcharge de méthode qui appelle 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

Remarques

WriteEventWithRelatedActivityIdCore est similaire à la WriteEventWithRelatedActivityId méthode, mais offre de meilleures performances, car elle n’a pas besoin d’unboxer les childActivityID arguments et data .

Votre méthode d’événement ETW appelant cette fonction doit suivre ces instructions :

  1. Spécifiez le premier paramètre en tant que Guid nommé relatedActivityId.

  2. Send Spécifiez ou Receive comme EventAttribute.Opcode propriété .

  3. Appel WriteEventWithRelatedActivityIdCore passant dans l’ID d’événement, suivi du GUID d’ID associé, suivi de tous les paramètres que la méthode d’événement est passée, dans le même ordre.

Cette méthode utilise les mêmes règles que WriteEventCore pour le args paramètre . Pour plus d’informations, consultez la documentation WriteEventCore.

S’applique à