EventProvider EventProvider EventProvider EventProvider Class

定義

使用此類別 (Class) 來寫入事件。Use this class to write events.

public ref class EventProvider : IDisposable
public class EventProvider : IDisposable
type EventProvider = class
    interface IDisposable
Public Class EventProvider
Implements IDisposable
繼承
EventProviderEventProviderEventProviderEventProvider
實作

備註

要取用事件使用撰寫WriteEventWriteTransferEvent事件的方法必須定義資訊清單; 中的事件寫入使用WriteMessageEvent方法不需要資訊清單。To consume events written using the WriteEvent and WriteTransferEvent methods, the events must be defined in a manifest; events written using the WriteMessageEvent method do not require a manifest.

事件可以包含下列的 managed 的資料類型:Events can contain the following managed data types:

  • boolbool

  • BooleanBoolean

  • bytebyte

  • charchar

  • decimaldecimal

  • doubledouble

  • floatfloat

  • GuidGuid

  • intint

  • IntPtrIntPtr

  • longlong

  • sbytesbyte

  • shortshort

  • 字串string

  • uintuint

  • UInt64UInt64

如果您的資訊清單中的事件會使用Boolean的類型,您無法寫入資料的項目使用Booleanmanaged 程式碼中的資料類型。If an event in your manifest uses the Boolean in-type, you cannot write the data element using a Boolean data type in your managed code. Boolean中輸入您的資訊清單中所預期的 4 位元組值,和Booleanmanaged 程式碼中的資料類型是 1 個位元組。The Boolean in-type in your manifest expects a 4-byte value, and a Boolean data type in managed code is 1-byte. 相反地,您必須使用int寫入值的資料類型。Instead, you must use an int data type to write the value. 如果您想要記錄Boolean值,請使用 UInt8 中輸入您的資訊清單中。If you want to log a Boolean value, use the UInt8 in-type in your manifest.

建構函式

EventProvider(Guid) EventProvider(Guid) EventProvider(Guid) EventProvider(Guid)

初始化 EventProvider 類別的新執行個體。Initializes a new instance of the EventProvider class.

方法

Close() Close() Close() Close()

從 ETW 子系統移除提供者的註冊,並釋放所有的 Unmanaged 資源。Removes the provider's registration from the ETW subsystem and releases all unmanaged resources.

CreateActivityId() CreateActivityId() CreateActivityId() CreateActivityId()

建立提供者的唯一活動識別項。Creates a unique activity identifier for the provider.

Dispose() Dispose() Dispose() Dispose()

釋放這個 EventProvider 物件所使用的資源。Releases the resources used by this EventProvider object.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放這個 EventProvider 物件所使用的資源。Releases the resources used by this EventProvider object.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

釋出資源並執行內部清除後,記憶體回收才能回收執行個體。Frees resources and performs internal cleanup before the instance is reclaimed by garbage collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetLastWriteEventError() GetLastWriteEventError() GetLastWriteEventError() GetLastWriteEventError()

取得與事件寫入失敗相關的最後一項錯誤。Gets the last error associated with an event write failure.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
IsEnabled() IsEnabled() IsEnabled() IsEnabled()

判斷是否有任何工作階段已啟用提供者 (不論用來啟用提供者的層級和關鍵字值為何)。Determines whether any session enabled the provider, regardless of the level and keyword values used to enable the provider.

IsEnabled(Byte, Int64) IsEnabled(Byte, Int64) IsEnabled(Byte, Int64) IsEnabled(Byte, Int64)

判斷是否有任何工作階段正在向提供者要求指定的事件。Determines whether any session is requesting the specified event from the provider.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
SetActivityId(Guid) SetActivityId(Guid) SetActivityId(Guid) SetActivityId(Guid)

設定 WriteEvent 方法使用的目前活動識別項。Sets the current activity identifier used by the WriteEvent methods.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
WriteEvent(EventDescriptor, Int32, IntPtr) WriteEvent(EventDescriptor, Int32, IntPtr) WriteEvent(EventDescriptor, Int32, IntPtr) WriteEvent(EventDescriptor, Int32, IntPtr)

寫入事件。Writes an event. 事件資料會指定為記憶體區塊。The event data is specified as a block of memory.

WriteEvent(EventDescriptor, Object[]) WriteEvent(EventDescriptor, Object[]) WriteEvent(EventDescriptor, Object[]) WriteEvent(EventDescriptor, Object[])

寫入事件。Writes an event. 事件資料會指定為物件陣列。The event data is specified as an array of objects.

WriteEvent(EventDescriptor, String) WriteEvent(EventDescriptor, String) WriteEvent(EventDescriptor, String) WriteEvent(EventDescriptor, String)

寫入事件。Writes an event. 事件資料會指定為字串。The event data is specified as a string.

WriteMessageEvent(String) WriteMessageEvent(String) WriteMessageEvent(String) WriteMessageEvent(String)

寫入內含字串做為資料的事件。Writes an event that contains a string as its data.

WriteMessageEvent(String, Byte, Int64) WriteMessageEvent(String, Byte, Int64) WriteMessageEvent(String, Byte, Int64) WriteMessageEvent(String, Byte, Int64)

如果層級和關鍵字值符合工作階段所要求的事件,便會寫入包含字串資料的事件。Writes an event that contains a string as its data if the level and keyword value match the events requested by the session.

WriteTransferEvent(EventDescriptor, Guid, Int32, IntPtr) WriteTransferEvent(EventDescriptor, Guid, Int32, IntPtr) WriteTransferEvent(EventDescriptor, Guid, Int32, IntPtr) WriteTransferEvent(EventDescriptor, Guid, Int32, IntPtr)

在端對端案例中追蹤事件時,將事件連結在一起。Links events together when tracing events in an end-to-end scenario. 事件資料會指定為記憶體區塊。The event data is specified as a block of memory.

WriteTransferEvent(EventDescriptor, Guid, Object[]) WriteTransferEvent(EventDescriptor, Guid, Object[]) WriteTransferEvent(EventDescriptor, Guid, Object[]) WriteTransferEvent(EventDescriptor, Guid, Object[])

在端對端案例中追蹤事件時,將事件連結在一起。Links events together when tracing events in an end-to-end scenario. 事件資料會指定為物件陣列。The event data is specified as an array of objects.

適用於