网站首页  词典首页

请输入您要查询的函数:

 

术语 traceevent
释义 TraceEvent
语法:
C++
ULONG TraceEvent(
__in TRACEHANDLE SessionHandle,
__in PEVENT_TRACE_HEADER EventTrace
);
TraceEvent功能
该TraceEvent函数将事件发送到一个事件跟踪会话。
参数
SessionHandle [in]
句柄事件跟踪会话记录事件。提供者获得的处理要求时,在其ControlCallback执行GetTraceLoggerHandle功能。
EventTrace [in]
指针的EVENT_TRACE_HEADER结构。事件的具体数据是选择附加到结构。最大的一次活动就可以登录是64K。您必须指定为EVENT_TRACE_HEADER结构的下列成员的值。
大小
GUID或GuidPtr

取决于您的信息提供者提供的复杂性,您也应该考虑,指定以下成员的值。
Class.Type
Class.Level
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是系统错误代码之一。下表列出了一些常见的错误及其原因。
返回codeDescription
ERROR_INVALID_FLAG_NUMBERThe旗帜的EVENT_TRACE_HEADER结构成员是不正确的。
ERROR_INVALID_HANDLESessionHandle是无效的,或者指定的NT内核记录器会处理。
ERROR_NOT_ENOUGH_MEMORYThe会议跑出可用缓冲区进行写入。这期间发生的事件发生率高,因为磁盘子系统超载或缓冲区的数目太少。而不是阻塞直到更多的缓冲区变得可用,TraceEvent丢弃事件。
考虑增加数量,并为会议或减少书面事件或事件的数目大小缓冲区的大小。
Windows 2000中:不支持。
ERROR_OUTOFMEMORYThe事件被丢弃,因为,虽然缓冲池并没有达到其最大大小,没有足够的可用内存分配一个额外的缓冲,也没有提供接收缓冲区的事件。
以下ERROR_INVALID_PARAMETEROne是正确的:
SessionHandle为NULL。
EventTrace为NULL。
该EVENT_TRACE_HEADER成员结构的大小是不正确的。
从一个单一的事件ERROR_MORE_DATAData不能跨越多个缓冲区。阿跟踪事件仅限于事件的规模跟踪会话的减去EVENT_TRACE_HEADER结构大小的缓冲区。
备注
供应商调用这个函数。
之前提供者可以调用此函数,提供程序
必须调用RegisterTraceGuids函数登记本身和事件跟踪类。
必须启用。阿控制器调用EnableTrace功能,使供应商。
这次活动是可以写入日志文件,发送到事件跟踪,实时,或两者消费者。该EVENT_TRACE_PROPERTIES结构LogFileMode成员传递给StartTrace定义了事件发送。
跟踪中的顺序写的事件发生。
要跟踪有关活动设置,使用TraceEventInstance功能。
在Windows Vista,您应该使用EventWrite函数记录事件。
实例
举一个例子,它使用TraceEvent,见跟踪事件。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderEvntrace.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
参见
EnableTrace
EVENT_TRACE_HEADER
RegisterTraceGuids
TraceEventInstance
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==TraceEvent Function
The TraceEvent function sends an event to an event tracing session.
Syntax
C++
ULONG TraceEvent(
__in TRACEHANDLE SessionHandle,
__in PEVENT_TRACE_HEADER EventTrace
);
Parameters
SessionHandle [in]
Handle to the event tracing session that records the event. The provider obtains the handle when it calls the GetTraceLoggerHandle function in its ControlCallback implementation.
EventTrace [in]
Pointer to an EVENT_TRACE_HEADER structure. Event-specific data is optionally appended to the structure. The largest event you can log is 64K. You must specify values for the following members of the EVENT_TRACE_HEADER structure.
Size
Guid or GuidPtr
Flags
Depending on the complexity of the information your provider provides, you should also consider specifying values for the following members.
Class.Type
Class.Level
Return Value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is one of the system error codes . The following table includes some common errors and their causes.
Return codeDescription
ERROR_INVALID_FLAG_NUMBERThe Flags member of the EVENT_TRACE_HEADER structure is incorrect.
ERROR_INVALID_HANDLESessionHandle is not valid or specifies the NT Kernel Logger session handle.
ERROR_NOT_ENOUGH_MEMORYThe session ran out of free buffers to write to. This can occur during high event rates because the disk subsystem is overloaded or the number of buffers is too small. Rather than blocking until more buffers become available, TraceEvent discards the event.
Consider increasing the number and size of the buffers for the session, or reducing the number of events written or the size of the events.
Windows 2000: Not supported.
ERROR_OUTOFMEMORYThe event is discarded because, although the buffer pool has not reached its maximum size, there is insufficient available memory to allocate an additional buffer and there is no buffer available to receive the event.
ERROR_INVALID_PARAMETEROne of the following is true:
SessionHandle is NULL.
EventTrace is NULL.
The Size member of the EVENT_TRACE_HEADER structure is incorrect.
ERROR_MORE_DATAData from a single event cannot span multiple buffers. A trace event is limited to the size of the event tracing session's buffer minus the size of the EVENT_TRACE_HEADER structure.

Remarks
Providers call this function.
Before the provider can call this function, the provider
Must call the RegisterTraceGuids function to register itself and the event trace class.
Must be enabled. A controller calls the EnableTrace function to enable a provider.
The event is either written to a log file, sent to event trace consumers in real time, or both. The LogFileMode member of the EVENT_TRACE_PROPERTIES structure passed to the StartTrace defines where the event is sent.
The trace events are written in the order in which they occur.
To trace a set of related events, use the TraceEventInstance function.
On Windows Vista, you should use the EventWrite function to log events.
Examples
For an example that uses TraceEvent, see Tracing Events .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderEvntrace.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
See Also
EnableTrace
EVENT_TRACE_HEADER
RegisterTraceGuids
TraceEventInstance
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa364137(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2025/1/9 4:05:21