Skip to content

Latest commit

 

History

History
93 lines (67 loc) · 3.48 KB

nf-winbase-enablethreadprofiling.md

File metadata and controls

93 lines (67 loc) · 3.48 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winbase.EnableThreadProfiling
EnableThreadProfiling function (winbase.h)
Enables thread profiling on the specified thread.
EnableThreadProfiling
EnableThreadProfiling function [Hardware Counter Profiling]
hcp.enablethreadprofiling
winbase/EnableThreadProfiling
hcp\enablethreadprofiling.htm
hcp
dbbe5b01-cabf-42cb-9ed9-c2c143f9923b
12/05/2018
EnableThreadProfiling, EnableThreadProfiling function [Hardware Counter Profiling], hcp.enablethreadprofiling, winbase/EnableThreadProfiling
winbase.h
Windows.h
Windows
Windows 7 [desktop apps only]
Windows Server 2008 R2 [desktop apps only]
Kernel32.lib
Kernel32.dll
Windows
19H1
EnableThreadProfiling
winbase/EnableThreadProfiling
c++
APIRef
kbSyntax
DllExport
Kernel32.dll
EnableThreadProfiling

EnableThreadProfiling function

-description

Enables thread profiling on the specified thread.

-parameters

-param ThreadHandle [in]

The handle to the thread on which you want to enable profiling. This must be the current thread.

-param Flags [in]

To receive thread profiling data such as context switch count, set this parameter to THREAD_PROFILING_FLAG_DISPATCH; otherwise, set to 0.

-param HardwareCounters [in]

To receive hardware performance counter data, set this parameter to a bitmask that identifies the hardware counters to collect. You can specify up to 16 performance counters. Each bit relates directly to the zero-based hardware counter index for the hardware performance counters that you configured. Set to zero if you are not collecting hardware counter data. If you set a bit for a hardware counter that has not been configured, the counter value that is read for that counter is zero.

-param PerformanceDataHandle [out]

An opaque handle that you use when calling the ReadThreadProfilingData and DisableThreadProfiling functions.

-returns

Returns ERROR_SUCCESS if the call is successful; otherwise, a system error code (see Winerror.h).

-remarks

You must call the DisableThreadProfiling function before exiting the thread.

To profile hardware performance counters, you need a driver to configure the counters. The performance counters are configured globally for the system, so every thread has access to the same hardware counter data. The counters must be configured before you enable profiling. For information on configuring hardware performance counters, see the KeSetHardwareCounterConfiguration function in the Windows Driver Kit (WDK).

-see-also

DisableThreadProfiling

QueryThreadProfiling

ReadThreadProfilingData