Platform SDK: Performance Monitoring

PERF_COUNTER_DEFINITION

The PERF_COUNTER_DEFINITION structure describes a performance counter. The Unicode names in this structure must appear in a message file.

typedef struct _PERF_COUNTER_DEFINITION { 
  DWORD  ByteLength; 
  DWORD  CounterNameTitleIndex; 
  LPWSTR CounterNameTitle; 
  DWORD  CounterHelpTitleIndex; 
  LPWSTR CounterHelpTitle; 
  DWORD  DefaultScale; 
  DWORD  DetailLevel; 
  DWORD  CounterType; 
  DWORD  CounterSize; 
  DWORD  CounterOffset; 
} PERF_COUNTER_DEFINITION; 

Members

ByteLength
Contains the length, in bytes, of this structure.
CounterNameTitleIndex
Contains the index of the counter name in the title database of the registry.
CounterNameTitle
A pointer to a null-terminated string containing the name of the counter. This member contains NULL, initially, but it can contain a pointer to the actual string once the string is located.
CounterHelpTitleIndex
Contains the index to the counter's Help title in the title database of the registry.
CounterHelpTitle
A pointer to a null-terminated string containing the title of Help. This member contains NULL, initially, but it can contain a pointer to the actual string once the string is located.
DefaultScale
Specifies the power of 10 by which to scale a chart line, assuming the vertical axis is 100. If this value is zero, the scale value is 1; if this value is 1, the scale value is 10; if this value is –1, the scale value is .10; and so on.
DetailLevel
Specifies the level of detail for the counter. Applications use this value to control display complexity. This member can be one of the following values.
Value Meaning
PERF_DETAIL_NOVICE The data can be understood by the uninformed user.
PERF_DETAIL_ADVANCED The data is designed for the advanced user.
PERF_DETAIL_EXPERT The data is designed for the expert user.
PERF_DETAIL_WIZARD The data is designed for the system designer.

CounterType
Specifies the type of counter. For a list of predefined counter types, see Calculations for Raw Counter Data. Each of the predefined counter types is a combination of the values from the following tables.

These values indicate the counter's data size.
Value Meaning
PERF_SIZE_DWORD The counter data is a DWORD.
PERF_SIZE_LARGE The counter data is a large integer.
PERF_SIZE_ZERO The counter data is a zero-length field.
PERF_SIZE_VARIABLE_LEN The size of the counter data is in the CounterSize member.

These values indicate the additional contents of this member.
Value Meaning
PERF_TYPE_NUMBER The counter data is a number value but not a counter.
PERF_TYPE_COUNTER The counter data is an increasing numeric value.
PERF_TYPE_TEXT The counter data is a text field.
PERF_TYPE_ZERO The counter data is always zero.

If PERF_TYPE_NUMBER is specified, one of these values is also specified to indicate the format of the number.
Value Meaning
PERF_NUMBER_HEX The counter data should be displayed as a hexadecimal value.
PERF_NUMBER_DECIMAL The counter data should be displayed as a decimal value.
PERF_NUMBER_DEC_1000 The counter data should be divided by 1000 and displayed as a decimal value.

If PERF_TYPE_COUNTER is specified, one of these values is also specified to indicate the type of counter.
Value Meaning
PERF_COUNTER_VALUE The counter value is valid without additional calculation; that is, it should be displayed as is.
PERF_COUNTER_RATE The counter value should be divided by the elapsed time.
PERF_COUNTER_FRACTION The counter value should be divided by the base value indicated by the next counter if it is of type PERF_COUNTER_BASE or by the value of the counter subtype.
PERF_COUNTER_BASE The counter value is the base value to use in fractions.
PERF_COUNTER_ELAPSED The counter value is a start time to be subtracted from the current time.
PERF_COUNTER_QUEUELEN The performance application should use the Queuelen counter — that is, the Queue Length Space-Time Product formula. The next counter is the number currently in the queue. Multiply it by the current time (units specified by this counter's subtype). Add the product to the original value of the counter. To obtain the average queue length, divide the result of the addition by the delta time.
PERF_COUNTER_HISTOGRAM The counter value begins or ends a histogram.

If PERF_TYPE_COUNTER is specified, one of these values is also specified to indicate the subtype of counter.
Value Meaning
PERF_TIMER_TICK The frequency of the high-resolution performance counter should be used as the base.
PERF_TIMER_100NS The time base units of the 100-nanosecond timer should be used as the base.
PERF_OBJECT_TIMER The object-timer frequency should be used as the base unit. This value is system-defined in this counter's PERF_OBJECT_TYPE definition.

If PERF_TYPE_TEXT is specified, one of these values is also specified to indicate the type of text.
Value Meaning
PERF_TEXT_UNICODE The counter data contains Unicode text.
PERF_TEXT_ASCII The counter data contains ASCII text.

These values indicate how to use the counter data in a calculation.
Value Meaning
PERF_DELTA_COUNTER The difference between the previous counter value and the current counter value is computed before proceeding.
PERF_DELTA_BASE The difference between the previous base value and the current base value is computed before proceeding.
PERF_INVERSE_COUNTER After other calculations, the counter should be inverted before displaying or converting to a percentage.
PERF_MULTI_COUNTER This value is a sum of counters from several sources, the number of which is indicated by the next counter.

These values indicate the display suffix of the counter data.
Value Meaning
PERF_DISPLAY_NO_SUFFIX There is no display suffix.
PERF_DISPLAY_PER_SEC The display suffix is '/sec'.
PERF_DISPLAY_PERCENT The display suffix is '%'.
PERF_DISPLAY_SECONDS The display suffix is 'secs'.
PERF_DISPLAY_NOSHOW The counter value should not be displayed.

CounterSize
Specifies the counter size, in bytes.
CounterOffset
Specifies the offset from the start of the PERF_COUNTER_BLOCK structure to the first byte of this counter.

Remarks

This structure is part of the performance data provided by the RegQueryValueEx function when the HKEY_PERFORMANCE_DATA key is used.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Header: Declared in Winperf.h; include Windows.h.

See Also

RegQueryValueEx