PerfEnumerateCounterSetInstances function

Gets the names and identifiers of the active instances of a counter set on the specified system.

Syntax


ULONG WINAPI PerfEnumerateCounterSetInstances(
  _In_opt_  LPCWSTR               szMachine,
  _In_      LPCGUID               pCounterSetId,
  _Out_opt_ PPERF_INSTANCE_HEADER pInstances,
            DWORD                 cbInstances,
  _Out_     LPDWORD               pcbInstancesActual
);

Parameters

szMachine [in, optional]

The name of the machine for which to get the information about the active instances of the counter set that the pCounterSet parameter specifies. If NULL, the function retrieves information about the active instances of the specified counter set for the local machine.

pCounterSetId [in]

The counter set identifier of the counter set for which you want to get the information about of the active instances.

pInstances [out, optional]

Pointer to a buffer that is large enough to receive the amount of data that the cbInstances parameter specifies. May be NULL if cbInstances is 0.

cbInstances

The size of the buffer that the pInstances parameter specifies, in bytes.

pcbInstancesActual [out]

The size of the buffer actually required to get the information about of the active instances. The meaning depends on the value that the function returns.

Function Return ValueMeaning of pcbInstancesActual
ERROR_SUCCESSThe number of bytes of information about the active instances of the specified counter set that the function stored in the buffer that pInstances specified.
ERROR_NOT_ENOUGH_MEMORYThe size of the buffer required to store the information about the active instances of the counter set on the specified machine, in bytes. Enlarge the buffer to the required size and call the function again.
OtherThe value is undefined and should not be used.

 

Return value

Return codeDescription
ERROR_SUCCESS

The function successfully stored all of the information about the active instances of the counter set in the buffer that pInstances specified. The value that pcbInstancesActual points to indicates amount of information actually stored in the buffer, in bytes.

ERROR_NOT_ENOUGH_MEMORY

The buffer that pInstances specified was not large enough to store all of the information about the active instances of the counter set. The value that pcbInstancesActual points to indicates the size of the buffer required to store all of the information. Enlarge the buffer to the required size and call the function again.

 

For other types of failures, the return value is a system error code.

Remarks

The information about the active instances of the specified counter set is written to the buffer that pInstances specifies as a sequence of PERF_INSTANCE_HEADER blocks. The size in bytes of the sequence of blocks is written to pcbInstancesActual. Each PERF_INSTANCE_HEADER block consists of a PERF_INSTANCE_HEADER structure, immediately followed by a null-terminated UTF-16LE instance name, followed by padding so that the size of the PERF_INSTANCE_HEADER block is a multiple of 8 bytes.

Requirements

Minimum supported client

Windows 10, version 1607 [desktop apps only]

Minimum supported server

Windows Server 2016 [desktop apps only]

Header

Perflib.h

Library

AdvAPI32.lib

DLL

AdvAPI32.dll

See also

PerfEnumerateCounterSet
PERF_INSTANCE_HEADER

 

 

Show: