大网数据广告活动
性能与资源

Configuring and Starting a SystemTraceProvider Session

· 52CE 我爱测

The SystemTraceProvider is a kernel provider with a predefined sets of kernel events supported on Windows 7, Windows Server 2008 R2, and later.

The SystemTraceProvider is a kernel provider with a predefined sets of kernel events supported on Windows 7, Windows Server 2008 R2, and later. On Windows 7 and Windows Server 2008 R2, the SystemTraceProvider could only be used for the NT Kernel Logger session.

On Windows 8, Windows Server 2012, and later, the SystemTraceProvider can be multiplexed for up to 8 logger sessions. The first two slots for logger sessions are reserved for the NT Kernel Logger and the Circular Kernel Context Logger .

For more information on using the NT Kernel Logger session as a trace provider, see Configuring and Starting the NT Kernel Logger Session.

On Windows 10 SDK build 20348 and later, the SystemTraceProvider can be configured via separate System Providers, which can be controlled with EnableTraceEx2 like standard Event Tracing for Windows event providers. For a full list of system providers, keywords, and corresponding legacy flags and groups, see System Providers

Enable a SystemTraceProvider session

To enable the SystemTraceProvider to start a session other than the NT Kernel Logger, execute the following command:

tracelog -start MySession -f c:\Kernel1.etl -eflag PROC_THREAD+LOADER+CSWITCH

To programmatically enable the SystemTraceProvider to start a session other than the NT Kernel Logger, use the following steps.

  • Define a private logger name.

    #define PRIVATE_LOGGER_NAME L"Some Private Trace Session"

  • At the controller, set the following members of the EVENT_TRACE_PROPERTIES structure.

    Set LogFileMode to EVENT_TRACE_SYSTEM_LOGGER_MODE.

    Set LoggerName to private logger, instead of KERNEL_LOGGER_NAME.

    Make sure the Wnode.Guid member of the EVENT_TRACE_PROPERTIES structure is not set to SystemTraceControlGuid. You must assign a new GUID to this member.

  • At the consumer, set the LoggerName member of the EVENT_TRACE_LOGFILE structure to this private logger.

Note:
If you want a non-administrators or a non-TCP control block (TCB) process to be able to start a profiling trace session using the SystemTraceProvider on behalf of third party applications, then you need to grant the user profile privilege and then add this user to both the session GUID (created for the logger session) and the system trace provider GUID to enable the system trace provider. For more information, see the EventAccessControl function.

Related topics

Configuring and Starting a Private Logger Session

Configuring and Starting an AutoLogger Session

Configuring and Starting an Event Tracing Session

Configuring and Starting the NT Kernel Logger Session

System Providers

Updating an Event Tracing Session

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 06/02/2021
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。