Click to Rate and Give Feedback
MSDN
MSDN Library
Diagnostics
 PerfSetCounterRefValue Function

  Switch on low bandwidth view
PerfSetCounterRefValue Function

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

Syntax

C++
ULONG PerfSetCounterRefValue(
  __in  HANDLE hProvider,
  __in  PPERF_COUNTERSET_INSTANCE pInstance,
  __in  ULONG CounterId,
  __in  PVOID lpAddr
);

Parameters

hProvider [in]

The handle of the provider. Use the handle variable that the CTRPP tool generated for you. For the name of the variable, see the symbol attribute of the <provider> element.

Windows Vista:  The PerfStartProvider function returns the handle.
pInstance [in]

A PERF_COUNTERSET_INSTANCE structure that contains the counter set instance. The PerfCreateInstance function returns this pointer.

CounterId [in]

Identifier that uniquely identifies the counter to update in the instance block. The identifier is defined in the id attribute of the <counter> element and must match the CounterId member of one of the PERF_COUNTER_INFO structures in the instance block. Use the counter ID constant that the CTRPP tool generated for you. For the name of the constant, see the symbol attribute of the <counter> element.

Windows Vista:  The counter ID constant is not available.
lpAddr [in]

Pointer to the actual counter data.

If NULL, the consumer receives ERROR_NO_DATA.

To indicate that the counter data is accessed by reference, the counter declaration in the manifest must include a <counterAttribute> element whose name attribute is set to "reference".

Return Value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code.

Remarks

This is a convenience function for specifying a reference to the raw counter data. To update the reference to the raw counter data yourself, use the Offset member of the PERF_COUNTER_INFO structure to access the counter value for a specific counter. The Attrib member must include the PERF_ATTRIB_BY_REFERENCE flag. The PERF_COUNTERSET_INSTANCE structure block contains one or more counter information structures.

Depending on the counter type, the pointer must reference a 4-byte or 8-byte unsigned integer. When collecting the counter data, PERFLIB dereferences the pointer and returns the actual data.

Requirements

Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
HeaderPerflib.h
LibraryAdvapi32.lib
DLLAdvapi32.dll

See Also

PerfSetULongLongCounterValue
PerfSetULongCounterValue

Send comments about this topic to Microsoft

Build date: 6/18/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker