Performance Counters

Overview of the Performance Counters technology.

To develop Performance Counters, you need these headers:

For programming guidance for this technology, see:

Enumerations

 
PerfCounterDataType

Indicates the content type of a PERF_COUNTER_HEADER block that the PerfQueryCounterData function includes as part of the PERF_DATA_HEADER block that the function produces as output.
PerfRegInfoType

Indicates the types of information that you can request about a performance counter set by calling the PerfQueryCounterSetRegistrationInfo function.

Functions

 
CounterPathCallBack

Applications implement the CounterPathCallBack function to process the counter path strings returned by the Browse dialog box.
LoadPerfCounterTextStringsA

Loads onto the computer the performance objects and counters defined in the specified initialization file. (ANSI)
LoadPerfCounterTextStringsW

Loads onto the computer the performance objects and counters defined in the specified initialization file. (Unicode)
PdhAddCounterA

Adds the specified counter to the query. (ANSI)
PdhAddCounterW

Adds the specified counter to the query. (Unicode)
PdhAddEnglishCounterA

Adds the specified language-neutral counter to the query. (ANSI)
PdhAddEnglishCounterW

Adds the specified language-neutral counter to the query. (Unicode)
PdhBindInputDataSourceA

Binds one or more binary log files together for reading log data. (ANSI)
PdhBindInputDataSourceW

Binds one or more binary log files together for reading log data. (Unicode)
PdhBrowseCountersA

Displays a Browse Counters dialog box that the user can use to select one or more counters that they want to add to the query. To use handles to data sources, use the PdhBrowseCountersH function. (ANSI)
PdhBrowseCountersHA

Displays a Browse Counters dialog box that the user can use to select one or more counters that they want to add to the query. This function is identical to the PdhBrowseCounters function, except that it supports the use of handles to data sources. (ANSI)
PdhBrowseCountersHW

Displays a Browse Counters dialog box that the user can use to select one or more counters that they want to add to the query. This function is identical to the PdhBrowseCounters function, except that it supports the use of handles to data sources. (Unicode)
PdhBrowseCountersW

Displays a Browse Counters dialog box that the user can use to select one or more counters that they want to add to the query. To use handles to data sources, use the PdhBrowseCountersH function. (Unicode)
PdhCalculateCounterFromRawValue

Calculates the displayable value of two raw counter values.
PdhCloseLog

Closes the specified log file.
PdhCloseQuery

Closes all counters contained in the specified query, closes all handles related to the query, and frees all memory associated with the query.
PdhCollectQueryData

Collects the current raw data value for all counters in the specified query and updates the status code of each counter. (PdhCollectQueryData)
PdhCollectQueryDataEx

Uses a separate thread to collect the current raw data value for all counters in the specified query. The function then signals the application-defined event and waits the specified time interval before returning.
PdhCollectQueryDataWithTime

Collects the current raw data value for all counters in the specified query and updates the status code of each counter. (PdhCollectQueryDataWithTime)
PdhComputeCounterStatistics

Computes statistics for a counter from an array of raw values.
PdhConnectMachineA

Connects to the specified computer. (ANSI)
PdhConnectMachineW

Connects to the specified computer. (Unicode)
PdhEnumLogSetNamesA

Enumerates the names of the log sets within the DSN. (ANSI)
PdhEnumLogSetNamesW

Enumerates the names of the log sets within the DSN. (Unicode)
PdhEnumMachinesA

Returns a list of the computer names associated with counters in a log file. (PdhEnumMachinesA)
PdhEnumMachinesHA

Returns a list of the computer names associated with counters in a log file. (PdhEnumMachinesHA)
PdhEnumMachinesHW

Returns a list of the computer names associated with counters in a log file. (PdhEnumMachinesHW)
PdhEnumMachinesW

Returns a list of the computer names associated with counters in a log file. (PdhEnumMachinesW)
PdhEnumObjectItemsA

Returns the specified object's counter and instance names that exist on the specified computer or in the specified log file. To use handles to data sources, use the PdhEnumObjectItemsH function. (ANSI)
PdhEnumObjectItemsHA

Returns the specified object's counter and instance names that exist on the specified computer or in the specified log file. This function is identical to the PdhEnumObjectItems function, except that it supports the use of handles to data sources. (ANSI)
PdhEnumObjectItemsHW

Returns the specified object's counter and instance names that exist on the specified computer or in the specified log file. This function is identical to the PdhEnumObjectItems function, except that it supports the use of handles to data sources. (Unicode)
PdhEnumObjectItemsW

Returns the specified object's counter and instance names that exist on the specified computer or in the specified log file. To use handles to data sources, use the PdhEnumObjectItemsH function. (Unicode)
PdhEnumObjectsA

Returns a list of objects available on the specified computer or in the specified log file. To use handles to data sources, use the PdhEnumObjectsH function. (ANSI)
PdhEnumObjectsHA

Returns a list of objects available on the specified computer or in the specified log file.This function is identical to PdhEnumObjects, except that it supports the use of handles to data sources. (ANSI)
PdhEnumObjectsHW

Returns a list of objects available on the specified computer or in the specified log file.This function is identical to PdhEnumObjects, except that it supports the use of handles to data sources. (Unicode)
PdhEnumObjectsW

Returns a list of objects available on the specified computer or in the specified log file. To use handles to data sources, use the PdhEnumObjectsH function. (Unicode)
PdhExpandCounterPathA

Examines the specified computer (or local computer if none is specified) for counters and instances of counters that match the wildcard strings in the counter path. (ANSI)
PdhExpandCounterPathW

Examines the specified computer (or local computer if none is specified) for counters and instances of counters that match the wildcard strings in the counter path. (Unicode)
PdhExpandWildCardPathA

Examines the specified computer or log file and returns those counter paths that match the given counter path which contains wildcard characters. To use handles to data sources, use the PdhExpandWildCardPathH function. (ANSI)
PdhExpandWildCardPathHA

Examines the specified computer or log file and returns those counter paths that match the given counter path which contains wildcard characters.This function is identical to the PdhExpandWildCardPath function, except that it supports the use of handles to data sources. (ANSI)
PdhExpandWildCardPathHW

Examines the specified computer or log file and returns those counter paths that match the given counter path which contains wildcard characters.This function is identical to the PdhExpandWildCardPath function, except that it supports the use of handles to data sources. (Unicode)
PdhExpandWildCardPathW

Examines the specified computer or log file and returns those counter paths that match the given counter path which contains wildcard characters. To use handles to data sources, use the PdhExpandWildCardPathH function. (Unicode)
PdhFormatFromRawValue

Computes a displayable value for the given raw counter values.
PdhGetCounterInfoA

Retrieves information about a counter, such as data size, counter type, path, and user-supplied data values. (ANSI)
PdhGetCounterInfoW

Retrieves information about a counter, such as data size, counter type, path, and user-supplied data values. (Unicode)
PdhGetCounterTimeBase

Returns the time base of the specified counter.
PdhGetDataSourceTimeRangeA

Determines the time range, number of entries and, if applicable, the size of the buffer containing the performance data from the specified input source. To use handles to data sources, use the PdhGetDataSourceTimeRangeH function. (ANSI)
PdhGetDataSourceTimeRangeH

Determines the time range, number of entries and, if applicable, the size of the buffer containing the performance data from the specified input source.This function is identical to the PdhGetDataSourceTimeRange function, except that it supports the use of handles to data sources.
PdhGetDataSourceTimeRangeW

Determines the time range, number of entries and, if applicable, the size of the buffer containing the performance data from the specified input source. To use handles to data sources, use the PdhGetDataSourceTimeRangeH function. (Unicode)
PdhGetDefaultPerfCounterA

Retrieves the name of the default counter for the specified object. This name can be used to set the initial counter selection in the Browse Counter dialog box. To use handles to data sources, use the PdhGetDefaultPerfCounterH function. (ANSI)
PdhGetDefaultPerfCounterHA

Retrieves the name of the default counter for the specified object. (ANSI)
PdhGetDefaultPerfCounterHW

Retrieves the name of the default counter for the specified object. (Unicode)
PdhGetDefaultPerfCounterW

Retrieves the name of the default counter for the specified object. This name can be used to set the initial counter selection in the Browse Counter dialog box. To use handles to data sources, use the PdhGetDefaultPerfCounterH function. (Unicode)
PdhGetDefaultPerfObjectA

Retrieves the name of the default object. This name can be used to set the initial object selection in the Browse Counter dialog box. To use handles to data sources, use the PdhGetDefaultPerfObjectH function. (ANSI)
PdhGetDefaultPerfObjectHA

Retrieves the name of the default object. (ANSI)
PdhGetDefaultPerfObjectHW

Retrieves the name of the default object. (Unicode)
PdhGetDefaultPerfObjectW

Retrieves the name of the default object. This name can be used to set the initial object selection in the Browse Counter dialog box. To use handles to data sources, use the PdhGetDefaultPerfObjectH function. (Unicode)
PdhGetDllVersion

Returns the version of the currently installed Pdh.dll file.
PdhGetFormattedCounterArrayA

Returns an array of formatted counter values. Use this function when you want to format the counter values of a counter that contains a wildcard character for the instance name. (ANSI)
PdhGetFormattedCounterArrayW

Returns an array of formatted counter values. Use this function when you want to format the counter values of a counter that contains a wildcard character for the instance name. (Unicode)
PdhGetFormattedCounterValue

Computes a displayable value for the specified counter.
PdhGetLogFileSize

Returns the size of the specified log file.
PdhGetRawCounterArrayA

Returns an array of raw values from the specified counter. Use this function when you want to retrieve the raw counter values of a counter that contains a wildcard character for the instance name. (ANSI)
PdhGetRawCounterArrayW

Returns an array of raw values from the specified counter. Use this function when you want to retrieve the raw counter values of a counter that contains a wildcard character for the instance name. (Unicode)
PdhGetRawCounterValue

Returns the current raw value of the counter.
PdhIsRealTimeQuery

Determines if the specified query is a real-time query.
PdhLookupPerfIndexByNameA

Returns the counter index corresponding to the specified counter name. (ANSI)
PdhLookupPerfIndexByNameW

Returns the counter index corresponding to the specified counter name. (Unicode)
PdhLookupPerfNameByIndexA

Returns the performance object name or counter name corresponding to the specified index. (ANSI)
PdhLookupPerfNameByIndexW

Returns the performance object name or counter name corresponding to the specified index. (Unicode)
PdhMakeCounterPathA

Creates a full counter path using the members specified in the PDH_COUNTER_PATH_ELEMENTS structure. (ANSI)
PdhMakeCounterPathW

Creates a full counter path using the members specified in the PDH_COUNTER_PATH_ELEMENTS structure. (Unicode)
PdhOpenLogA

Opens the specified log file for reading or writing. (ANSI)
PdhOpenLogW

Opens the specified log file for reading or writing. (Unicode)
PdhOpenQueryA

Creates a new query that is used to manage the collection of performance data. To use handles to data sources, use the PdhOpenQueryH function. (ANSI)
PdhOpenQueryH

Creates a new query that is used to manage the collection of performance data. This function is identical to the PdhOpenQuery function, except that it supports the use of handles to data sources.
PdhOpenQueryW

Creates a new query that is used to manage the collection of performance data. To use handles to data sources, use the PdhOpenQueryH function. (Unicode)
PdhParseCounterPathA

Parses the elements of the counter path and stores the results in the PDH_COUNTER_PATH_ELEMENTS structure. (ANSI)
PdhParseCounterPathW

Parses the elements of the counter path and stores the results in the PDH_COUNTER_PATH_ELEMENTS structure. (Unicode)
PdhParseInstanceNameA

Parses the elements of an instance string. (ANSI)
PdhParseInstanceNameW

Parses the elements of an instance string. (Unicode)
PdhReadRawLogRecord

Reads the information in the specified binary trace log file.
PdhRemoveCounter

Removes a counter from a query.
PdhSelectDataSourceA

Displays a dialog window that prompts the user to specify the source of the performance data. (ANSI)
PdhSelectDataSourceW

Displays a dialog window that prompts the user to specify the source of the performance data. (Unicode)
PdhSetCounterScaleFactor

Sets the scale factor that is applied to the calculated value of the specified counter when you request the formatted counter value. If the PDH_FMT_NOSCALE flag is set, then this scale factor is ignored.
PdhSetDefaultRealTimeDataSource

Specifies the source of the real-time data.
PdhSetQueryTimeRange

Limits the samples that you can read from a log file to those within the specified time range, inclusively.
PdhUpdateLogA

Collects counter data for the current query and writes the data to the log file. (ANSI)
PdhUpdateLogFileCatalog

Synchronizes the information in the log file catalog with the performance data in the log file.
PdhUpdateLogW

Collects counter data for the current query and writes the data to the log file. (Unicode)
PdhValidatePathA

Validates that the counter is present on the computer specified in the counter path. (ANSI)
PdhValidatePathExA

Validates that the specified counter is present on the computer or in the log file. (ANSI)
PdhValidatePathExW

Validates that the specified counter is present on the computer or in the log file. (Unicode)
PdhValidatePathW

Validates that the counter is present on the computer specified in the counter path. (Unicode)
PERF_MEM_ALLOC

Providers implement this function to provide custom memory management for PERFLIB.A
PERF_MEM_FREE

Providers implement this function to provide custom memory management for PERFLIB.F
PerfAddCounters

Adds performance counter specifications to the specified query.
PerfCloseQueryHandle

Closes a query handle that you opened by calling PerfOpenQueryHandle.
PerfCreateInstance

Creates an instance of the specified counter set.
PerfDecrementULongCounterValue

Decrements the value of a counter whose value is a 4-byte unsigned integer. Providers use this function.
PerfDecrementULongLongCounterValue

Decrements the value of a counter whose value is an 8-byte unsigned integer. Providers use this function.
PerfDeleteCounters

Removes the specified performance counter specifications from the specified query.
PerfDeleteInstance

Deletes an instance of the counter set created by the PerfCreateInstance function.
PerfEnumerateCounterSet

Gets the counter set identifiers of the counter sets that are registered on the specified system. Counter set identifiers are globally unique identifiers (GUIDs).
PerfEnumerateCounterSetInstances

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

Increments the value of a counter whose value is a 4-byte unsigned integer. Providers use this function.
PerfIncrementULongLongCounterValue

Increments the value of a counter whose value is an 8-byte unsigned integer. Providers use this function.
PERFLIBREQUEST

Providers can implement this function to receive notification when consumers perform certain actions, such as adding or removing counters from a query.
PerfOpenQueryHandle

Creates a handle that references a query on the specified system. A query is a list of counter specifications.
PerfQueryCounterData

Gets the values of the performance counters that match the counter specifications in the specified query.
PerfQueryCounterInfo

Gets the counter specifications in the specified query.
PerfQueryCounterSetRegistrationInfo

Gets information about a counter set on the specified system.
PerfQueryInstance

Retrieves a pointer to the specified counter set instance. Providers use this function.
PerfSetCounterRefValue

Updates the value of a counter whose value is a pointer to the actual data. Providers use this function.
PerfSetCounterSetInfo

Specifies the layout of a particular counter set.
PerfSetULongCounterValue

Updates the value of a counter whose value is a 4-byte unsigned integer. Providers use this function.
PerfSetULongLongCounterValue

Updates the value of a counter whose value is an 8-byte unsigned integer. Providers use this function.
PerfStartProvider

Registers the provider. (PerfStartProvider)
PerfStartProviderEx

Registers the provider. (PerfStartProviderEx)
PerfStopProvider

Removes the provider's registration from the list of registered providers and frees all resources associated with the provider.
PM_CLOSE_PROC

Performs the cleanup required by your performance DLL.
PM_COLLECT_PROC

Collects the performance data and returns it to the consumer.
UnloadPerfCounterTextStringsA

Unloads performance objects and counters from the computer for the specified application. (ANSI)
UnloadPerfCounterTextStringsW

Unloads performance objects and counters from the computer for the specified application. (Unicode)

Structures

 
PDH_BROWSE_DLG_CONFIG_A

The PDH_BROWSE_DLG_CONFIG structure is used by the PdhBrowseCounters function to configure the Browse Performance Counters dialog box. (ANSI)
PDH_BROWSE_DLG_CONFIG_HA

The PDH_BROWSE_DLG_CONFIG_H structure is used by the PdhBrowseCountersH function to configure the Browse Performance Counters dialog box. (ANSI)
PDH_BROWSE_DLG_CONFIG_HW

The PDH_BROWSE_DLG_CONFIG_H structure is used by the PdhBrowseCountersH function to configure the Browse Performance Counters dialog box. (Unicode)
PDH_BROWSE_DLG_CONFIG_W

The PDH_BROWSE_DLG_CONFIG structure is used by the PdhBrowseCounters function to configure the Browse Performance Counters dialog box. (Unicode)
PDH_COUNTER_INFO_A

The PDH_COUNTER_INFO structure contains information describing the properties of a counter. This information also includes the counter path. (ANSI)
PDH_COUNTER_INFO_W

The PDH_COUNTER_INFO structure contains information describing the properties of a counter. This information also includes the counter path. (Unicode)
PDH_COUNTER_PATH_ELEMENTS_A

The PDH_COUNTER_PATH_ELEMENTS structure contains the components of a counter path. (ANSI)
PDH_COUNTER_PATH_ELEMENTS_W

The PDH_COUNTER_PATH_ELEMENTS structure contains the components of a counter path. (Unicode)
PDH_DATA_ITEM_PATH_ELEMENTS_A

The PDH_DATA_ITEM_PATH_ELEMENTS structure contains the path elements of a specific data item. (ANSI)
PDH_DATA_ITEM_PATH_ELEMENTS_W

The PDH_DATA_ITEM_PATH_ELEMENTS structure contains the path elements of a specific data item. (Unicode)
PDH_FMT_COUNTERVALUE

The PDH_FMT_COUNTERVALUE structure contains the computed value of the counter and its status.
PDH_FMT_COUNTERVALUE_ITEM_A

The PDH_FMT_COUNTERVALUE_ITEM structure contains the instance name and formatted value of a counter. (ANSI)
PDH_FMT_COUNTERVALUE_ITEM_W

The PDH_FMT_COUNTERVALUE_ITEM structure contains the instance name and formatted value of a counter. (Unicode)
PDH_RAW_COUNTER

The PDH_RAW_COUNTER structure returns the data as it was collected from the counter provider. No translation, formatting, or other interpretation is performed on the data.
PDH_RAW_COUNTER_ITEM_A

The PDH_RAW_COUNTER_ITEM structure contains the instance name and raw value of a counter. (ANSI)
PDH_RAW_COUNTER_ITEM_W

The PDH_RAW_COUNTER_ITEM structure contains the instance name and raw value of a counter. (Unicode)
PDH_RAW_LOG_RECORD

The PDH_RAW_LOG_RECORD structure contains information about a binary trace log file record.
PDH_STATISTICS

The PDH_STATISTICS structure contains the minimum, maximum, and mean values for an array of raw counters values.
PDH_TIME_INFO

The PDH_TIME_INFO structure contains information on time intervals as applied to the sampling of performance data.
PERF_COUNTER_BLOCK

Describes the block of memory that contains the raw performance counter data for an object's counters.
PERF_COUNTER_DATA

Contains information about the PERF_COUNTER_DATA block that contains the structure.
PERF_COUNTER_DEFINITION

Describes a performance counter.
PERF_COUNTER_HEADER

Contains information about the PERF_COUNTER_HEADER block that contains the structure.
PERF_COUNTER_IDENTIFIER

Contains information about the PERF_COUNTER_IDENTIFIER block that contains the structure.
PERF_COUNTER_IDENTITY

Defines the counter that is sent to a provider's callback when the consumer adds or removes a counter from the query.
PERF_COUNTER_INFO

Defines information about a counter that a provider uses. The CTRPP tool automatically generates this structure based on the schema you specify.
PERF_COUNTER_REG_INFO

Provides registration information about a performance counter.
PERF_COUNTERSET_INFO

Defines information about a counter set that a provider uses. The CTRPP tool automatically generates this structure based on the schema you specify.
PERF_COUNTERSET_INSTANCE

Defines an instance of a counter set.
PERF_COUNTERSET_REG_INFO

Contains information about the PERF_COUNTERSET_REG_INFO block that contains the structure.
PERF_DATA_BLOCK

Describes the performance data block that you queried, for example, the number of performance objects returned by the provider and the time-based values that you use when calculating performance values.
PERF_DATA_HEADER

Provides information about the PERF_DATA_HEADER block that contains the structure.
PERF_INSTANCE_DEFINITION

Describes an instance of a performance object.
PERF_INSTANCE_HEADER

Provides information about the PERF_INSTANCE_HEADER block that contains the structure.
PERF_MULTI_COUNTERS

Provides information about the PERF_MULTI_COUNTERS block that contains the structure.
PERF_MULTI_INSTANCES

Provides information about the PERF_MULTI_INSTANCES block that contains the structure.
PERF_OBJECT_TYPE

Describes object-specific performance information, for example, the number of instances of the object and the number of counters that the object defines.
PERF_PROVIDER_CONTEXT

Defines provider context information.
PERF_STRING_BUFFER_HEADER

Provides information about the PERF_STRING_BUFFER_HEADER block that contains the structure.
PERF_STRING_COUNTER_HEADER

Indicates where in the PERF_STRING_BUFFER_HEADER block that the string that contains the name or help string for the indicated performance counter starts.