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