EventSource.WriteEventWithRelatedActivityIdCore Metode

Definisi

Penting

API ini bukan kompatibel CLS.

Menulis peristiwa yang menunjukkan bahwa aktivitas saat ini terkait dengan aktivitas lain.

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

Parameter

eventId
Int32

Pengidentifikasi yang secara unik mengidentifikasi peristiwa ini dalam EventSource.

relatedActivityIdchildActivityID
Guid*

Penunjuk ke GUID ID aktivitas terkait.

eventDataCount
Int32

Jumlah item di data bidang .

data
EventSource.EventData

Penunjuk ke item pertama di bidang data peristiwa.

Atribut

Contoh

Contoh kode C# berikut menunjukkan cara menentukan kelebihan beban metode yang memanggil 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

Keterangan

WriteEventWithRelatedActivityIdCore mirip WriteEventWithRelatedActivityId dengan metode tetapi menawarkan performa yang lebih baik, karena tidak harus membuka kotak childActivityID argumen dan data .

Metode peristiwa ETW Anda yang memanggil fungsi ini harus mengikuti panduan berikut:

  1. Tentukan parameter pertama sebagai bernama GuidrelatedActivityId.

  2. Tentukan salah satu Send atau Receive sebagai EventAttribute.Opcode properti .

  3. Panggilan WriteEventWithRelatedActivityIdCore yang diteruskan dalam ID peristiwa, diikuti oleh ID GUID terkait, diikuti oleh semua parameter metode peristiwa diteruskan, dalam urutan yang sama.

Metode ini menggunakan aturan yang sama seperti WriteEventCore untuk args parameter . Lihat dokumentasi WriteEventCore untuk detail selengkapnya.

Berlaku untuk