|
|
Microsoft Windows NT Build 297 06-28-1992
#ifndef _WINPERF_INCLUDED_
#define _WINPERF_INCLUDED_
//
// winperf.h - Header file for the Performance Monitor data
//
//
//
//
//
// This file contains the definitions of the data structures returned
// by the Configuration Registry in response to a request for
// performance data. This file is used by both the Configuration
// Registry and the Performance Monitor to define their interface.
// The complete interface is described here, except for the name
// of the node to query in the registry. It is
//
// HKEY_PERFORMANCE_DATA.
//
// By querying that node with a subkey of "GLOBAL" the caller will
// retrieve the structures described here.
//
// There is no need to RegOpenKey the reserved handle HKEY_PERFORMANCE_DATA,
// but the caller should RegCloseKey the handle so that network transports
// and drivers can be removed or installed (which cannot happen while
// they are open for monitoring.)
//
//
/*****************************************************************************\
The basic layout of the data block returned is a header followed by a
data area for each type of object under measurement. Typical object
types are processor, disk, and memory. The system being observed
defines what objects are under measurement. Naturally, different
systems may measure different types of objects.
+-----------------------------------------+
| |
| PERF_DATA_BLOCK |
| - - - - - - - - - - - - - - - - - - - - |
| NumObjectTypes |
| - - - - - - - - - - - - - - - - - - - - |
|-----------------------------------------|
| |
| |
| PERF_OBJECT_TYPE 0 |
| |
| |
|-----------------------------------------|
| |
| |
| PERF_OBJECT_TYPE 1 |
| |
| |
|-----------------------------------------|
| |
| |
| PERF_OBJECT_TYPE 2 |
| |
| |
|-----------------------------------------|
| . |
| . |
| . |
|-----------------------------------------|
| |
| |
| PERF_OBJECT_TYPE NumObjectTypes-1 |
| |
| |
+-----------------------------------------+
Note that from one call to the next, there may be different object types
defined, meaning that PERF_DATA_BLOCK.NumObjectTypes will vary. As will
become clear shortly, the size of the area for each object type may also
vary. You cannot count on the locations of the object type areas from
one call to the system to the next. To help to accomodate this, offsets
have been included to help naviagte the structure. Such offsets are
!always! relative to the !beginning! of the structure which contains them.
+-----------------------------------------+
| PERF_DATA_BLOCK |
| - - - - - - - - - - - - - - - - - - - - |
| TotalByteLength *--------*
| - - - - - - - - - - - - - - - - - - - - | |
| HeaderLength *----* |
| - - - - - - - - - - - - - - - - - - - - | | |
| | | |
| | | |
|-----------------------------------------| | |
| PERF_OBJECT_TYPE 0 |<---* |
| - - - - - - - - - - - - - - - - - - - - | |
| TotalByteLength *----* |
| - - - - - - - - - - - - - - - - - - - - | | |
| | | |
| | | |
|-----------------------------------------| | |
| PERF_OBJECT_TYPE 1 |<---* |
| - - - - - - - - - - - - - - - - - - - - | |
| TotalByteLength *----* |
| - - - - - - - - - - - - - - - - - - - - | | |
| | | |
| | | |
| | | |
| | | |
|-----------------------------------------| | |
| PERF_OBJECT_TYPE 2 |<---* |
| - - - - - - - - - - - - - - - - - - - - | |
| TotalByteLength *----* |
| - - - - - - - - - - - - - - - - - - - - | | |
| | | |
| | | |
|-----------------------------------------| | |
| . |<---* |
| . | .
| . |. . . .
|-----------------------------------------| . .
| PERF_OBJECT_TYPE NumObjectTypes-1 |<---* |
| | |
| | |
| | |
| | |
+-----------------------------------------+<-------*
Each PERF_OBJECT_TYPE definition is followed by the definitions of all the
counters which are defined for that object. Typical counters for the
object of type processor are Processor Time, Interrupts, and Page Faults.
+-----------------------------------------+
| PERF_OBJECT_TYPE i |
| |
| - - - - - - - - - - - - - - - - - - - - |
| DefinitionLength *----------*
| - - - - - - - - - - - - - - - - - - - - | |
| HeaderLength *-----* |
| - - - - - - - - - - - - - - - - - - - - | | |
| NumCounters | | |
| - - - - - - - - - - - - - - - - - - - - | | |
| | | |
| | | |
|-----------------------------------------| | |
| PERF_COUNTER_DEFINITION 0 |<----* |
| | |
| | |
|-----------------------------------------| |
| PERF_COUNTER_DEFINITION 1 | |
| | |
| | |
|-----------------------------------------| |
| PERF_COUNTER_DEFINITION 2 | |
| | |
| | |
|-----------------------------------------| |
| . | |
| . | |
| . | |
|-----------------------------------------| |
| PERF_COUNTER_DEFINITION NumCounters-1 | |
| | |
| | |
|-----------------------------------------| |
| . |<---------*
| . |
| . |
+-----------------------------------------+
Following the counter definitions for the object type are the Instances for
that object type. In a multiprocessor system, for example, there are by
definition multiple instances of the object type processor. The number
of instances for an object type like threads may not be the same from
one call to get data to the next.
+-----------------------------------------+
| PERF_OBJECT_TYPE i |
| |
| - - - - - - - - - - - - - - - - - - - - |
| TotalByteLength *---------------*
| - - - - - - - - - - - - - - - - - - - - | |
| DefinitionLength *----------* |
| - - - - - - - - - - - - - - - - - - - - | | |
| HeaderLength *-----* | |
| - - - - - - - - - - - - - - - - - - - - | | | |
| NumCounters | | | |
| - - - - - - - - - - - - - - - - - - - - | | | |
| NumInstances | | | |
| - - - - - - - - - - - - - - - - - - - - | | | |
| | | | |
| | | | |
|-----------------------------------------| | | |
| PERF_COUNTER_DEFINITION 0 |<----* | |
| | | |
| | | |
|-----------------------------------------| | |
| PERF_COUNTER_DEFINITION 1 | | |
| | | |
| | | |
|-----------------------------------------| | |
| . | | |
| . | | |
| . | | |
|-----------------------------------------| | |
| PERF_COUNTER_DEFINITION NumCounters-1 | | |
| | | |
| | | |
|-----------------------------------------| | |
| PERF_INSTANCE_DEFINITION 0 |<---------* |
| | |
| | |
|-----------------------------------------| |
| PERF_INSTANCE_DEFINITION 1 | |
| | |
| | |
|-----------------------------------------| |
| PERF_INSTANCE_DEFINITION 2 | |
| | |
| | |
|-----------------------------------------| |
| . | |
| . | |
| . | |
|-----------------------------------------| |
| PERF_INSTANCE_DEFINITION NumInstances-1 | |
| | |
| | |
+-----------------------------------------+<--------------*
Each instance definition is followed by the counter data for that instance.
This is the actual data for each counter defined for the object type of
which the instance is a member. There are PERF_OBJECT_TYPE.NumCounters
such counters for !each! instance.
The size of the various instance definitions is not constant, since each
instance definition structure is followed by the null-terminated name of
the instance. Therefore the instance definition contains an offset to
its first counter data item, and also to its name.
+-----------------------------------------+
| PERF_INSTANCE_DEFINITION j |
| |
| - - - - - - - - - - - - - - - - - - - - |
| ByteLength *-----------*
| - - - - - - - - - - - - - - - - - - - - | |
| | |
| | |
| - - - - - - - - - - - - - - - - - - - - | |
| NameOffset *-----* |
| - - - - - - - - - - - - - - - - - - - - | | |
| | | |
| | | |
| - - - - - - - - - - - - - - - - - - - - | | |
| Name of PERF_INSTANCE_DEFINITION j |<----* |
| | |
| | |
| | |
| ...padded to 4 byte boundary| |
|-----------------------------------------| |
| PERF_COUNTER_BLOCK |<----------*
| - - - - - - - - - - - - - - - - - - - - |
| ByteLength *-----*
| - - - - - - - - - - - - - - - - - - - - | |
| Data for Counter 0 | |
| - - - - - - - - - - - - - - - - - - - - | |
| Data for Counter 1 | |
| - - - - - - - - - - - - - - - - - - - - | |
| Data for Counter 2 | |
| | |
| - - - - - - - - - - - - - - - - - - - - | |
| . | |
| . | |
| . | |
| - - - - - - - - - - - - - - - - - - - - | |
| Data for Counter NumCounters-1 | |
| | |
+-----------------------------------------+<----*
\*****************************************************************************/
// Data structure definitions.
// In order for data to be returned through the Configuration Registry
// in a system-independent fashion, it must be self-describing.
// In the following, all offsets are in bytes.
//
// Data is returned through the Configuration Registry in a
// a data block which begins with a _PERF_DATA_BLOCK structure.
//
#define PERF_DATA_VERSION 1
#define PERF_DATA_REVISION 0
typedef struct _PERF_DATA_BLOCK {
WCHAR Signature[4]; // Signature: Unicode "PERF"
DWORD LittleEndian; // 0 = Big Endian, 1 = Little Endian
DWORD Version; // Version of these data structures
// starting at 1
DWORD Revision; // Revision of these data structures
// starting at 0 for each Version
DWORD TotalByteLength; // Total length of data block
DWORD HeaderLength; // Length of this structure
DWORD NumObjectTypes; // Number of types of objects
// being reported
DWORD DefaultObject; // Index starting at 0 of default
// object to display when data from
// this system is retireved (-1 =
// none, but this is not expected to
// be used)
SYSTEMTIME SystemTime; // Time at the system under
// measurement
LARGE_INTEGER PerfTime; // Performance counter value
// at the system under measurement
LARGE_INTEGER PerfFreq; // Performance counter frequency
// at the system under measurement
LARGE_INTEGER PerfTime100nSec; // Performance counter time in 100 nsec
// units at the system under measurement
DWORD SystemNameLength; // Length of the system name
DWORD SystemNameOffset; // Offset, from beginning of this
// structure, to name of system
// being measured
} PERF_DATA_BLOCK, *PPERF_DATA_BLOCK;
//
// The _PERF_DATA_BLOCK structure is followed by NumObjectTypes of
// data sections, one for each type of object measured. Each object
// type section begins with a _PERF_OBJECT_TYPE structure.
//
typedef struct _PERF_OBJECT_TYPE {
DWORD TotalByteLength; // Length of this object definition
// including this structure, the
// counter defintions, and the
// instance definitions and the
// counter blocks for each instance:
// This is the offset from this
// structure to the next object, if
// any
DWORD DefinitionLength; // Length of object definition,
// which includes this structure
// and the counter definition
// structures for this object: this
// is the offset of the first
// instance or of the counters
// for this object if there is
// no instance
DWORD HeaderLength; // Length of this structure: this
// is the offset to the first
// counter definition for this
// object
DWORD ObjectNameTitleIndex;
// Index to name in Title Database
LPWSTR ObjectNameTitle; // Initially NULL, for use by
// analysis program to point to
// retrieved title string
DWORD ObjectHelpTitleIndex;
// Index to Help in Title Database
LPWSTR ObjectHelpTitle; // Initially NULL, for use by
// analysis program to point to
// retrieved title string
DWORD DetailLevel; // Object level of detail (for
// controlling display complexity);
// will be min of detail levels
// for all this object's counters
DWORD NumCounters; // Number of counters in each
// counter block (one counter
// block per instance)
DWORD DefaultCounter; // Default counter to display when
// this object is selected, index
// starting at 0 (-1 = none, but
// this is not expected to be used)
DWORD NumInstances; // Number of object instances
// for which counters are being
// returned from the system under
// measurement
DWORD CodePage; // 0 if instance strings are in
// UNICODE, else the Code Page of
// the instance names
} PERF_OBJECT_TYPE, *PPERF_OBJECT_TYPE;
//
// The following types of counters are currently defined.
//
#define PERF_COUNTER_COUNTER 1 // 32-bit Counter. Divide delta
// by delta time.
// Display suffix: "/sec"
#define PERF_COUNTER_TIMER 2 // 64-bit Timer. Divide delta by
// delta time.
// Display suffix: "%"
#define PERF_COUNTER_QUEUELEN 3 // Queue Length Space-Time Product.
// Divide delta by delta time.
// No Display Suffix.
#define PERF_COUNTER_BULK_COUNT 4 // 64-bit Counter. Divide delta by
// delta time.
// Display Suffix: "/sec"
#define PERF_COUNTER_TEXT 5 // Indicates the counter is not a
// counter but rather Unicode text
// Display as text.
#define PERF_COUNTER_RAWCOUNT 6 // Indicates the data is a
// counter which should not be
// time averaged on display (such as
// an error counter on a serial line)
// Display as is. No Display Suffix.
#define PERF_SAMPLE_FRACTION 7 // A count which is either 1 or 0 on
// each sampling interrupt (% busy)
// Divide delta by delta base.
// Display Suffix: "%"
#define PERF_SAMPLE_COUNTER 8 // A count which is sampled on each
// sampling interrupt (queue length)
// Divide delta by delta time.
// No Display Suffix.
#define PERF_COUNTER_NODATA 9 // A label: no data is associated
// with this counter (it has 0 length)
// Do not display.
#define PERF_COUNTER_TIMER_INV 10 // 64-bit Timer inverse (e.g., idle
// is measured, but display busy %)
// Display 100 - delta divided by
// delta time. Display suffix: "%"
#define PERF_SAMPLE_BASE 11 // The divisor for a sample, used with
// the previous counter to form a
// sampled %. You must check for >0
// before dividing by this! This
// counter will directly follow the
// numerator counter. It should not
// be displayed to the user.
#define PERF_AVERAGE_TIMER 12 // A timer which, when divided by
// an average base, produces a time
// in seconds which is the average
// time of some operation. This
// timer times total operations, and
// the base is the number of opera-
// tions. Display Suffix: "sec"
#define PERF_AVERAGE_BASE 13 // Used as the denominator in the
// computation of time or count
// averages. Must directly follow
// the numerator counter. Not dis-
// played to the user.
#define PERF_AVERAGE_BULK 14 // A bulk count which, when divided
// (typically) by the number of
// operations, gives (typically) the
// number of bytes per operation.
// No Display Suffix.
#define PERF_100NSEC_TIMER 15 // 64-bit Timer in 100 nsec units.
// Display delta divided by
// delta time. Display suffix: "%"
#define PERF_100NSEC_TIMER_INV 16 // 64-bit Timer inverse (e.g., idle
// is measured, but display busy %)
// Display 100 - delta divided by
// delta time. Display suffix: "%"
#define PERF_COUNTER_MULTI_TIMER 17 // 64-bit Timer. Divide delta by
// delta time. Display suffix: "%"
// Timer for multiple instances, so
// result can exceed 100%.
#define PERF_COUNTER_MULTI_TIMER_INV \
18 // 64-bit Timer inverse (e.g., idle
// is measured, but display busy %)
// Display 100 * _MULTI_BASE -
// delta divided by delta time.
// Display suffix: "%" Timer for
// multiple instances, so result
// can exceed 100%. Followed by
// a counter of type _MULTI_BASE.
#define PERF_COUNTER_MULTI_BASE 19 // Number of instances to which the
// preceeding _MULTI_..._INV counter
// applies. Used as a factor to get
// the percentage.
#define PERF_100NSEC_MULTI_TIMER 20 // 64-bit Timer in 100 nsec units.
// Display delta divided by
// delta time. Display suffix: "%"
// Timer for multiple instances, so
// result can exceed 100%.
#define PERF_100NSEC_MULTI_TIMER_INV \
21 // 64-bit Timer inverse (e.g., idle
// is measured, but display busy %)
// Display 100 * _MULTI_BASE -
// delta divided by delta time.
// Display suffix: "%" Timer for
// multiple instances, so result
// can exceed 100%. Followed by
// a counter of type _MULTI_BASE.
//
// The following counter type can be used with the preceeding types to
// define a reange of values to be displayed in a histogram.
//
#define PERF_COUNTER_HISTOGRAM 0x80000000
// Counter begins or ends a histogram
//
// The following are used to determine the level of detail associated
// with the counter. The user will be setting the level of detail
// that should be displayed at any given time.
//
#define PERF_DETAIL_NOVICE 100 // The uninformed can understand it
#define PERF_DETAIL_ADVANCED 200 // For the advanced user
#define PERF_DETAIL_EXPERT 300 // For the expert user
#define PERF_DETAIL_WIZARD 400 // For the system designer
//
// There is one of the following for each of the
// PERF_OBJECT_TYPE.NumCounters. The Unicode names in this structure MUST
// come from a message file.
//
typedef struct _PERF_COUNTER_DEFINITION {
DWORD ByteLength; // Length in bytes of this structure
DWORD CounterNameTitleIndex;
// Index of Counter name into
// Title Database
LPWSTR CounterNameTitle; // Initially NULL, for use by
// analysis program to point to
// retrieved title string
DWORD CounterHelpTitleIndex;
// Index of Counter Help into
// Title Database
LPWSTR CounterHelpTitle; // Initially NULL, for use by
// analysis program to point to
// retrieved title string
DWORD DefaultScale; // Power of 10 by which to scale
// chart line if vertical axis is 100
// 0 ==> 1, 1 ==> 10, -1 ==>1/10, etc.
DWORD DetailLevel; // Counter level of detail (for
// controlling display complexity)
DWORD CounterType; // Type of counter
DWORD CounterSize; // Size of counter in bytes
DWORD CounterOffset; // Offset from the start of the
// PERF_COUNTER_BLOCK to the first
// byte of this counter
} PERF_COUNTER_DEFINITION, *PPERF_COUNTER_DEFINITION;
//
// There is one of the following for each of the
// PERF_DATA_BLOCK.NumInstances.
//
#define PERF_NO_UNIQUE_ID -1
typedef struct _PERF_INSTANCE_DEFINITION {
DWORD ByteLength; // Length in bytes of this structure,
// including the subsequent name
DWORD ParentObjectTitleIndex;
// Title Index to name of "parent"
// object (e.g., if thread, then
// process is parent object type);
// if logical drive, the physical
// drive is parent object type
DWORD ParentObjectInstance;
// Index to instance of parent object
// type which is the parent of this
// instance.
DWORD UniqueID; // A unique ID used instead of
// matching the name to identify
// this instance, -1 = none
DWORD NameOffset; // Offset from beginning of
// this struct to the Unicode name
// of this instance
DWORD NameLength; // Length in bytes of name; 0 = none
} PERF_INSTANCE_DEFINITION, *PPERF_INSTANCE_DEFINITION;
//
// If .ParentObjectName is 0, there
// is no parent-child hierarcy for this object type. Otherwise,
// the .ParentObjectInstance is an index, starting at 0, into the
// instances reported for the parent object type. It is only
// meaningful if .ParentObjectName is not 0. The purpose of all this
// is to permit reporting/summation of object instances like threads
// within processes, and logical drives within physical drives.
//
//
// The PERF_INSTANCE_DEFINITION will be followed by a PERF_COUNTER_BLOCK.
//
typedef struct _PERF_COUNTER_BLOCK {
DWORD ByteLength; // Length in bytes of this structure,
// including the following counters
} PERF_COUNTER_BLOCK, *PPERF_COUNTER_BLOCK;
//
// The PERF_COUNTER_BLOCK is followed by PERF_OBJECT_TYPE.NumCounters
// number of counters.
//
#endif // _WINPERF_INCLUDED_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.