检索虚拟处理器的性能计数器。
Syntax
HRESULT
WINAPI
WHvGetVirtualProcessorCounters(
_In_ WHV_PARTITION_HANDLE Partition,
_In_ UINT32 VpIndex,
_In_ WHV_PROCESSOR_COUNTER_SET CounterSet,
_Out_writes_bytes_to_(BufferSizeInBytes, *BytesWritten) VOID* Buffer,
_In_ UINT32 BufferSizeInBytes,
_Out_opt_ UINT32* BytesWritten
);
typedef enum WHV_PROCESSOR_COUNTER_SET
{
WHvProcessorCounterSetRuntime,
WHvProcessorCounterSetIntercepts,
WHvProcessorCounterSetEvents,
WHvProcessorCounterSetApic,
} WHV_PROCESSOR_COUNTER_SET;
typedef struct WHV_PROCESSOR_RUNTIME_COUNTERS
{
UINT64 TotalRuntime100ns;
UINT64 HypervisorRuntime100ns;
} WHV_PROCESSOR_RUNTIME_COUNTERS;
typedef struct WHV_PROCESSOR_INTERCEPT_COUNTER
{
UINT64 Count;
UINT64 Time100ns;
} WHV_PROCESSOR_INTERCEPT_COUNTER;
typedef struct WHV_PROCESSOR_INTERCEPT_COUNTERS
{
WHV_PROCESSOR_INTERCEPT_COUNTER PageInvalidations;
WHV_PROCESSOR_INTERCEPT_COUNTER ControlRegisterAccesses;
WHV_PROCESSOR_INTERCEPT_COUNTER IoInstructions;
WHV_PROCESSOR_INTERCEPT_COUNTER HaltInstructions;
WHV_PROCESSOR_INTERCEPT_COUNTER CpuidInstructions;
WHV_PROCESSOR_INTERCEPT_COUNTER MsrAccesses;
WHV_PROCESSOR_INTERCEPT_COUNTER OtherIntercepts;
WHV_PROCESSOR_INTERCEPT_COUNTER PendingInterrupts;
WHV_PROCESSOR_INTERCEPT_COUNTER EmulatedInstructions;
WHV_PROCESSOR_INTERCEPT_COUNTER DebugRegisterAccesses;
WHV_PROCESSOR_INTERCEPT_COUNTER PageFaultIntercepts;
} WHV_PROCESSOR_ACTIVITY_COUNTERS;
typedef struct WHV_PROCESSOR_EVENT_COUNTERS
{
UINT64 PageFaultCount;
UINT64 ExceptionCount;
UINT64 InterruptCount;
} WHV_PROCESSOR_GUEST_EVENT_COUNTERS;
typedef struct WHV_PROCESSOR_APIC_COUNTERS
{
UINT64 MmioAccessCount;
UINT64 EoiAccessCount;
UINT64 TprAccessCount;
UINT64 SentIpiCount;
UINT64 SelfIpiCount;
} WHV_PROCESSOR_APIC_COUNTERS;
参数
Partition
指定要查询的分区。
VpIndex
指定要查询的处理器的虚拟处理器索引。
CounterSet
指定要查询的计数器集。
Buffer
指定要将计数器写入其中的缓冲区。
BufferSizeInBytes
指定 Buffer'大小(以字节为单位)。
BytesWritten
如果为非 NULL,则接收以字节为单位设置的计数器的大小。
返回值
如果函数成功,则返回值为 S_OK.
如果传递了 CounterSet无法识别的值,则返回值为 WHV_E_UNKNOWN_PROPERTY。
Remarks
该 WHvGetVirtualProcessorCounters 函数将指定的虚拟处理器请求的性能计数器集检索到提供的缓冲区中。
要求
| 要求 | 价值 |
|---|---|
| 支持的最低Windows | Windows 10版本 1809(x64):Windows 11版本 24H2 内部版本 26100.3915 (Arm64) |
| Header | WinHvPlatform.h |
| 图书馆 | WinHvPlatform.lib |
| DLL | WinHvPlatform.dll |
| Architecture | x64、Arm64 |