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