|
|
1.1 root 1: #ifndef _WINPERF_INCLUDED_
2: #define _WINPERF_INCLUDED_
3: //
4: // winperf.h - Header file for the Performance Monitor data
5: //
6: //
7: //
8: //
9:
10:
11: //
12: // This file contains the definitions of the data structures returned
13: // by the Configuration Registry in response to a request for
14: // performance data. This file is used by both the Configuration
15: // Registry and the Performance Monitor to define their interface.
16: // The complete interface is described here, except for the name
17: // of the node to query in the registry. It is
18: //
19: // HKEY_PERFORMANCE_DATA.
20: //
21: // By querying that node with a subkey of "GLOBAL" the caller will
22: // retrieve the structures described here.
23: //
24: // There is no need to RegOpenKey the reserved handle HKEY_PERFORMANCE_DATA,
25: // but the caller should RegCloseKey the handle so that network transports
26: // and drivers can be removed or installed (which cannot happen while
27: // they are open for monitoring.)
28: //
29: //
30:
31:
32: /*****************************************************************************\
33:
34: The basic layout of the data block returned is a header followed by a
35: data area for each type of object under measurement. Typical object
36: types are processor, disk, and memory. The system being observed
37: defines what objects are under measurement. Naturally, different
38: systems may measure different types of objects.
39:
40:
41: +-----------------------------------------+
42: | |
43: | PERF_DATA_BLOCK |
44: | - - - - - - - - - - - - - - - - - - - - |
45: | NumObjectTypes |
46: | - - - - - - - - - - - - - - - - - - - - |
47: |-----------------------------------------|
48: | |
49: | |
50: | PERF_OBJECT_TYPE 0 |
51: | |
52: | |
53: |-----------------------------------------|
54: | |
55: | |
56: | PERF_OBJECT_TYPE 1 |
57: | |
58: | |
59: |-----------------------------------------|
60: | |
61: | |
62: | PERF_OBJECT_TYPE 2 |
63: | |
64: | |
65: |-----------------------------------------|
66: | . |
67: | . |
68: | . |
69: |-----------------------------------------|
70: | |
71: | |
72: | PERF_OBJECT_TYPE NumObjectTypes-1 |
73: | |
74: | |
75: +-----------------------------------------+
76: Note that from one call to the next, there may be different object types
77: defined, meaning that PERF_DATA_BLOCK.NumObjectTypes will vary. As will
78: become clear shortly, the size of the area for each object type may also
79: vary. You cannot count on the locations of the object type areas from
80: one call to the system to the next. To help to accomodate this, offsets
81: have been included to help naviagte the structure. Such offsets are
82: !always! relative to the !beginning! of the structure which contains them.
83:
84: +-----------------------------------------+
85: | PERF_DATA_BLOCK |
86: | - - - - - - - - - - - - - - - - - - - - |
87: | TotalByteLength *--------*
88: | - - - - - - - - - - - - - - - - - - - - | |
89: | HeaderLength *----* |
90: | - - - - - - - - - - - - - - - - - - - - | | |
91: | | | |
92: | | | |
93: |-----------------------------------------| | |
94: | PERF_OBJECT_TYPE 0 |<---* |
95: | - - - - - - - - - - - - - - - - - - - - | |
96: | TotalByteLength *----* |
97: | - - - - - - - - - - - - - - - - - - - - | | |
98: | | | |
99: | | | |
100: |-----------------------------------------| | |
101: | PERF_OBJECT_TYPE 1 |<---* |
102: | - - - - - - - - - - - - - - - - - - - - | |
103: | TotalByteLength *----* |
104: | - - - - - - - - - - - - - - - - - - - - | | |
105: | | | |
106: | | | |
107: | | | |
108: | | | |
109: |-----------------------------------------| | |
110: | PERF_OBJECT_TYPE 2 |<---* |
111: | - - - - - - - - - - - - - - - - - - - - | |
112: | TotalByteLength *----* |
113: | - - - - - - - - - - - - - - - - - - - - | | |
114: | | | |
115: | | | |
116: |-----------------------------------------| | |
117: | . |<---* |
118: | . | .
119: | . |. . . .
120: |-----------------------------------------| . .
121: | PERF_OBJECT_TYPE NumObjectTypes-1 |<---* |
122: | | |
123: | | |
124: | | |
125: | | |
126: +-----------------------------------------+<-------*
127:
128: Each PERF_OBJECT_TYPE definition is followed by the definitions of all the
129: counters which are defined for that object. Typical counters for the
130: object of type processor are Processor Time, Interrupts, and Page Faults.
131:
132: +-----------------------------------------+
133: | PERF_OBJECT_TYPE i |
134: | |
135: | - - - - - - - - - - - - - - - - - - - - |
136: | DefinitionLength *----------*
137: | - - - - - - - - - - - - - - - - - - - - | |
138: | HeaderLength *-----* |
139: | - - - - - - - - - - - - - - - - - - - - | | |
140: | NumCounters | | |
141: | - - - - - - - - - - - - - - - - - - - - | | |
142: | | | |
143: | | | |
144: |-----------------------------------------| | |
145: | PERF_COUNTER_DEFINITION 0 |<----* |
146: | | |
147: | | |
148: |-----------------------------------------| |
149: | PERF_COUNTER_DEFINITION 1 | |
150: | | |
151: | | |
152: |-----------------------------------------| |
153: | PERF_COUNTER_DEFINITION 2 | |
154: | | |
155: | | |
156: |-----------------------------------------| |
157: | . | |
158: | . | |
159: | . | |
160: |-----------------------------------------| |
161: | PERF_COUNTER_DEFINITION NumCounters-1 | |
162: | | |
163: | | |
164: |-----------------------------------------| |
165: | . |<---------*
166: | . |
167: | . |
168: +-----------------------------------------+
169:
170: Following the counter definitions for the object type are the Instances for
171: that object type. In a multiprocessor system, for example, there are by
172: definition multiple instances of the object type processor. The number
173: of instances for an object type like threads may not be the same from
174: one call to get data to the next.
175:
176: +-----------------------------------------+
177: | PERF_OBJECT_TYPE i |
178: | |
179: | - - - - - - - - - - - - - - - - - - - - |
180: | TotalByteLength *---------------*
181: | - - - - - - - - - - - - - - - - - - - - | |
182: | DefinitionLength *----------* |
183: | - - - - - - - - - - - - - - - - - - - - | | |
184: | HeaderLength *-----* | |
185: | - - - - - - - - - - - - - - - - - - - - | | | |
186: | NumCounters | | | |
187: | - - - - - - - - - - - - - - - - - - - - | | | |
188: | NumInstances | | | |
189: | - - - - - - - - - - - - - - - - - - - - | | | |
190: | | | | |
191: | | | | |
192: |-----------------------------------------| | | |
193: | PERF_COUNTER_DEFINITION 0 |<----* | |
194: | | | |
195: | | | |
196: |-----------------------------------------| | |
197: | PERF_COUNTER_DEFINITION 1 | | |
198: | | | |
199: | | | |
200: |-----------------------------------------| | |
201: | . | | |
202: | . | | |
203: | . | | |
204: |-----------------------------------------| | |
205: | PERF_COUNTER_DEFINITION NumCounters-1 | | |
206: | | | |
207: | | | |
208: |-----------------------------------------| | |
209: | PERF_INSTANCE_DEFINITION 0 |<---------* |
210: | | |
211: | | |
212: |-----------------------------------------| |
213: | PERF_INSTANCE_DEFINITION 1 | |
214: | | |
215: | | |
216: |-----------------------------------------| |
217: | PERF_INSTANCE_DEFINITION 2 | |
218: | | |
219: | | |
220: |-----------------------------------------| |
221: | . | |
222: | . | |
223: | . | |
224: |-----------------------------------------| |
225: | PERF_INSTANCE_DEFINITION NumInstances-1 | |
226: | | |
227: | | |
228: +-----------------------------------------+<--------------*
229: Each instance definition is followed by the counter data for that instance.
230: This is the actual data for each counter defined for the object type of
231: which the instance is a member. There are PERF_OBJECT_TYPE.NumCounters
232: such counters for !each! instance.
233:
234: The size of the various instance definitions is not constant, since each
235: instance definition structure is followed by the null-terminated name of
236: the instance. Therefore the instance definition contains an offset to
237: its first counter data item, and also to its name.
238:
239: +-----------------------------------------+
240: | PERF_INSTANCE_DEFINITION j |
241: | |
242: | - - - - - - - - - - - - - - - - - - - - |
243: | ByteLength *-----------*
244: | - - - - - - - - - - - - - - - - - - - - | |
245: | | |
246: | | |
247: | - - - - - - - - - - - - - - - - - - - - | |
248: | NameOffset *-----* |
249: | - - - - - - - - - - - - - - - - - - - - | | |
250: | | | |
251: | | | |
252: | - - - - - - - - - - - - - - - - - - - - | | |
253: | Name of PERF_INSTANCE_DEFINITION j |<----* |
254: | | |
255: | | |
256: | | |
257: | ...padded to 4 byte boundary| |
258: |-----------------------------------------| |
259: | PERF_COUNTER_BLOCK |<----------*
260: | - - - - - - - - - - - - - - - - - - - - |
261: | ByteLength *-----*
262: | - - - - - - - - - - - - - - - - - - - - | |
263: | Data for Counter 0 | |
264: | - - - - - - - - - - - - - - - - - - - - | |
265: | Data for Counter 1 | |
266: | - - - - - - - - - - - - - - - - - - - - | |
267: | Data for Counter 2 | |
268: | | |
269: | - - - - - - - - - - - - - - - - - - - - | |
270: | . | |
271: | . | |
272: | . | |
273: | - - - - - - - - - - - - - - - - - - - - | |
274: | Data for Counter NumCounters-1 | |
275: | | |
276: +-----------------------------------------+<----*
277:
278: \*****************************************************************************/
279:
280: // Data structure definitions.
281:
282: // In order for data to be returned through the Configuration Registry
283: // in a system-independent fashion, it must be self-describing.
284:
285: // In the following, all offsets are in bytes.
286:
287: //
288: // Data is returned through the Configuration Registry in a
289: // a data block which begins with a _PERF_DATA_BLOCK structure.
290: //
291:
292: #define PERF_DATA_VERSION 1
293: #define PERF_DATA_REVISION 0
294:
295:
296: typedef struct _PERF_DATA_BLOCK {
297: WCHAR Signature[4]; // Signature: Unicode "PERF"
298: DWORD LittleEndian; // 0 = Big Endian, 1 = Little Endian
299: DWORD Version; // Version of these data structures
300: // starting at 1
301: DWORD Revision; // Revision of these data structures
302: // starting at 0 for each Version
303: DWORD TotalByteLength; // Total length of data block
304: DWORD HeaderLength; // Length of this structure
305: DWORD NumObjectTypes; // Number of types of objects
306: // being reported
307: DWORD DefaultObject; // Index starting at 0 of default
308: // object to display when data from
309: // this system is retireved (-1 =
310: // none, but this is not expected to
311: // be used)
312: SYSTEMTIME SystemTime; // Time at the system under
313: // measurement
314: LARGE_INTEGER PerfTime; // Performance counter value
315: // at the system under measurement
316: LARGE_INTEGER PerfFreq; // Performance counter frequency
317: // at the system under measurement
318: LARGE_INTEGER PerfTime100nSec; // Performance counter time in 100 nsec
319: // units at the system under measurement
320: DWORD SystemNameLength; // Length of the system name
321: DWORD SystemNameOffset; // Offset, from beginning of this
322: // structure, to name of system
323: // being measured
324: } PERF_DATA_BLOCK, *PPERF_DATA_BLOCK;
325:
326:
327: //
328: // The _PERF_DATA_BLOCK structure is followed by NumObjectTypes of
329: // data sections, one for each type of object measured. Each object
330: // type section begins with a _PERF_OBJECT_TYPE structure.
331: //
332:
333:
334: typedef struct _PERF_OBJECT_TYPE {
335: DWORD TotalByteLength; // Length of this object definition
336: // including this structure, the
337: // counter defintions, and the
338: // instance definitions and the
339: // counter blocks for each instance:
340: // This is the offset from this
341: // structure to the next object, if
342: // any
343: DWORD DefinitionLength; // Length of object definition,
344: // which includes this structure
345: // and the counter definition
346: // structures for this object: this
347: // is the offset of the first
348: // instance or of the counters
349: // for this object if there is
350: // no instance
351: DWORD HeaderLength; // Length of this structure: this
352: // is the offset to the first
353: // counter definition for this
354: // object
355: DWORD ObjectNameTitleIndex;
356: // Index to name in Title Database
357: LPWSTR ObjectNameTitle; // Initially NULL, for use by
358: // analysis program to point to
359: // retrieved title string
360: DWORD ObjectHelpTitleIndex;
361: // Index to Help in Title Database
362: LPWSTR ObjectHelpTitle; // Initially NULL, for use by
363: // analysis program to point to
364: // retrieved title string
365: DWORD DetailLevel; // Object level of detail (for
366: // controlling display complexity);
367: // will be min of detail levels
368: // for all this object's counters
369: DWORD NumCounters; // Number of counters in each
370: // counter block (one counter
371: // block per instance)
372: DWORD DefaultCounter; // Default counter to display when
373: // this object is selected, index
374: // starting at 0 (-1 = none, but
375: // this is not expected to be used)
376: DWORD NumInstances; // Number of object instances
377: // for which counters are being
378: // returned from the system under
379: // measurement
380: DWORD CodePage; // 0 if instance strings are in
381: // UNICODE, else the Code Page of
382: // the instance names
383: } PERF_OBJECT_TYPE, *PPERF_OBJECT_TYPE;
384:
385: //
386: // The following types of counters are currently defined.
387: //
388:
389: #define PERF_COUNTER_COUNTER 1 // 32-bit Counter. Divide delta
390: // by delta time.
391:
392: // Display suffix: "/sec"
393: #define PERF_COUNTER_TIMER 2 // 64-bit Timer. Divide delta by
394: // delta time.
395: // Display suffix: "%"
396:
397: #define PERF_COUNTER_QUEUELEN 3 // Queue Length Space-Time Product.
398: // Divide delta by delta time.
399: // No Display Suffix.
400:
401: #define PERF_COUNTER_BULK_COUNT 4 // 64-bit Counter. Divide delta by
402: // delta time.
403: // Display Suffix: "/sec"
404:
405: #define PERF_COUNTER_TEXT 5 // Indicates the counter is not a
406: // counter but rather Unicode text
407: // Display as text.
408:
409: #define PERF_COUNTER_RAWCOUNT 6 // Indicates the data is a
410: // counter which should not be
411: // time averaged on display (such as
412: // an error counter on a serial line)
413: // Display as is. No Display Suffix.
414:
415: #define PERF_SAMPLE_FRACTION 7 // A count which is either 1 or 0 on
416: // each sampling interrupt (% busy)
417: // Divide delta by delta base.
418: // Display Suffix: "%"
419:
420: #define PERF_SAMPLE_COUNTER 8 // A count which is sampled on each
421: // sampling interrupt (queue length)
422: // Divide delta by delta time.
423: // No Display Suffix.
424:
425: #define PERF_COUNTER_NODATA 9 // A label: no data is associated
426: // with this counter (it has 0 length)
427: // Do not display.
428:
429: #define PERF_COUNTER_TIMER_INV 10 // 64-bit Timer inverse (e.g., idle
430: // is measured, but display busy %)
431: // Display 100 - delta divided by
432: // delta time. Display suffix: "%"
433:
434: #define PERF_SAMPLE_BASE 11 // The divisor for a sample, used with
435: // the previous counter to form a
436: // sampled %. You must check for >0
437: // before dividing by this! This
438: // counter will directly follow the
439: // numerator counter. It should not
440: // be displayed to the user.
441:
442: #define PERF_AVERAGE_TIMER 12 // A timer which, when divided by
443: // an average base, produces a time
444: // in seconds which is the average
445: // time of some operation. This
446: // timer times total operations, and
447: // the base is the number of opera-
448: // tions. Display Suffix: "sec"
449:
450: #define PERF_AVERAGE_BASE 13 // Used as the denominator in the
451: // computation of time or count
452: // averages. Must directly follow
453: // the numerator counter. Not dis-
454: // played to the user.
455:
456: #define PERF_AVERAGE_BULK 14 // A bulk count which, when divided
457: // (typically) by the number of
458: // operations, gives (typically) the
459: // number of bytes per operation.
460: // No Display Suffix.
461:
462: #define PERF_100NSEC_TIMER 15 // 64-bit Timer in 100 nsec units.
463: // Display delta divided by
464: // delta time. Display suffix: "%"
465:
466: #define PERF_100NSEC_TIMER_INV 16 // 64-bit Timer inverse (e.g., idle
467: // is measured, but display busy %)
468: // Display 100 - delta divided by
469: // delta time. Display suffix: "%"
470:
471: #define PERF_COUNTER_MULTI_TIMER 17 // 64-bit Timer. Divide delta by
472: // delta time. Display suffix: "%"
473: // Timer for multiple instances, so
474: // result can exceed 100%.
475:
476: #define PERF_COUNTER_MULTI_TIMER_INV \
477: 18 // 64-bit Timer inverse (e.g., idle
478: // is measured, but display busy %)
479: // Display 100 * _MULTI_BASE -
480: // delta divided by delta time.
481: // Display suffix: "%" Timer for
482: // multiple instances, so result
483: // can exceed 100%. Followed by
484: // a counter of type _MULTI_BASE.
485:
486: #define PERF_COUNTER_MULTI_BASE 19 // Number of instances to which the
487: // preceeding _MULTI_..._INV counter
488: // applies. Used as a factor to get
489: // the percentage.
490:
491: #define PERF_100NSEC_MULTI_TIMER 20 // 64-bit Timer in 100 nsec units.
492: // Display delta divided by
493: // delta time. Display suffix: "%"
494: // Timer for multiple instances, so
495: // result can exceed 100%.
496:
497: #define PERF_100NSEC_MULTI_TIMER_INV \
498: 21 // 64-bit Timer inverse (e.g., idle
499: // is measured, but display busy %)
500: // Display 100 * _MULTI_BASE -
501: // delta divided by delta time.
502: // Display suffix: "%" Timer for
503: // multiple instances, so result
504: // can exceed 100%. Followed by
505: // a counter of type _MULTI_BASE.
506:
507: //
508: // The following counter type can be used with the preceeding types to
509: // define a reange of values to be displayed in a histogram.
510: //
511:
512: #define PERF_COUNTER_HISTOGRAM 0x80000000
513: // Counter begins or ends a histogram
514:
515: //
516: // The following are used to determine the level of detail associated
517: // with the counter. The user will be setting the level of detail
518: // that should be displayed at any given time.
519: //
520:
521: #define PERF_DETAIL_NOVICE 100 // The uninformed can understand it
522: #define PERF_DETAIL_ADVANCED 200 // For the advanced user
523: #define PERF_DETAIL_EXPERT 300 // For the expert user
524: #define PERF_DETAIL_WIZARD 400 // For the system designer
525:
526:
527: //
528: // There is one of the following for each of the
529: // PERF_OBJECT_TYPE.NumCounters. The Unicode names in this structure MUST
530: // come from a message file.
531: //
532:
533: typedef struct _PERF_COUNTER_DEFINITION {
534: DWORD ByteLength; // Length in bytes of this structure
535: DWORD CounterNameTitleIndex;
536: // Index of Counter name into
537: // Title Database
538: LPWSTR CounterNameTitle; // Initially NULL, for use by
539: // analysis program to point to
540: // retrieved title string
541: DWORD CounterHelpTitleIndex;
542: // Index of Counter Help into
543: // Title Database
544: LPWSTR CounterHelpTitle; // Initially NULL, for use by
545: // analysis program to point to
546: // retrieved title string
547: DWORD DefaultScale; // Power of 10 by which to scale
548: // chart line if vertical axis is 100
549: // 0 ==> 1, 1 ==> 10, -1 ==>1/10, etc.
550: DWORD DetailLevel; // Counter level of detail (for
551: // controlling display complexity)
552: DWORD CounterType; // Type of counter
553: DWORD CounterSize; // Size of counter in bytes
554: DWORD CounterOffset; // Offset from the start of the
555: // PERF_COUNTER_BLOCK to the first
556: // byte of this counter
557: } PERF_COUNTER_DEFINITION, *PPERF_COUNTER_DEFINITION;
558:
559:
560: //
561: // There is one of the following for each of the
562: // PERF_DATA_BLOCK.NumInstances.
563: //
564:
565: #define PERF_NO_UNIQUE_ID -1
566:
567: typedef struct _PERF_INSTANCE_DEFINITION {
568: DWORD ByteLength; // Length in bytes of this structure,
569: // including the subsequent name
570: DWORD ParentObjectTitleIndex;
571: // Title Index to name of "parent"
572: // object (e.g., if thread, then
573: // process is parent object type);
574: // if logical drive, the physical
575: // drive is parent object type
576: DWORD ParentObjectInstance;
577: // Index to instance of parent object
578: // type which is the parent of this
579: // instance.
580: DWORD UniqueID; // A unique ID used instead of
581: // matching the name to identify
582: // this instance, -1 = none
583: DWORD NameOffset; // Offset from beginning of
584: // this struct to the Unicode name
585: // of this instance
586: DWORD NameLength; // Length in bytes of name; 0 = none
587:
588: } PERF_INSTANCE_DEFINITION, *PPERF_INSTANCE_DEFINITION;
589:
590:
591: //
592: // If .ParentObjectName is 0, there
593: // is no parent-child hierarcy for this object type. Otherwise,
594: // the .ParentObjectInstance is an index, starting at 0, into the
595: // instances reported for the parent object type. It is only
596: // meaningful if .ParentObjectName is not 0. The purpose of all this
597: // is to permit reporting/summation of object instances like threads
598: // within processes, and logical drives within physical drives.
599: //
600: //
601: // The PERF_INSTANCE_DEFINITION will be followed by a PERF_COUNTER_BLOCK.
602: //
603:
604: typedef struct _PERF_COUNTER_BLOCK {
605: DWORD ByteLength; // Length in bytes of this structure,
606: // including the following counters
607: } PERF_COUNTER_BLOCK, *PPERF_COUNTER_BLOCK;
608:
609: //
610: // The PERF_COUNTER_BLOCK is followed by PERF_OBJECT_TYPE.NumCounters
611: // number of counters.
612: //
613:
614: #endif // _WINPERF_INCLUDED_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.