home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / WINPERF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  26.4 KB  |  554 lines

  1. /*++
  2.  
  3. Copyright (c) 1993 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     winperf.h
  8.  
  9. Abstract:
  10.  
  11.     Header file for the Performance Monitor data
  12.  
  13.     This file contains the definitions of the data structures returned
  14.     by the Configuration Registry in response to a request for
  15.     performance data.  This file is used by both the Configuration
  16.     Registry and the Performance Monitor to define their interface.
  17.     The complete interface is described here, except for the name
  18.     of the node to query in the registry.  It is
  19.  
  20.                    HKEY_PERFORMANCE_DATA.
  21.  
  22.     By querying that node with a subkey of "GLOBAL" the caller will
  23.     retrieve the structures described here.
  24.  
  25.     There is no need to RegOpenKey the reserved handle HKEY_PERFORMANCE_DATA,
  26.     but the caller should RegCloseKey the handle so that network transports
  27.     and drivers can be removed or installed (which cannot happen while
  28.     they are open for monitoring.)
  29.  
  30.  
  31. Author:
  32.  
  33.     Russ Blake  (russbl) 11/15/91
  34.  
  35. Revision History:
  36.  
  37.     russbl  -   1/22/92     - Add diagrams of data structures
  38.  
  39.     russbl  -   4/14/92     - Add version/revision, signature,
  40.                                 and pointer fields for titles
  41.                                 strings reserved for analysis
  42.                                 program usage
  43.  
  44.     russbl  -   5/29/92     - Add default scale to counter
  45.                                 definition, *Pstruct types to
  46.                                 all structure defs, and counter
  47.                                 types ..._MULTI_
  48.  
  49.     a-robw  -   10/23/92    - Moved descriptive text and diagrams
  50.                                 to spec. Added extensible object
  51.                                 routine function typedefs. Changed
  52.                                 type of NumInstances from DWORD to LONG.
  53.                                 Corrected some of the remaining comments.
  54.                                 Changed variables using -1 from, Unsigned
  55.                                 to signed types
  56.  
  57.  
  58.     a-robw  -   11/16/92    - added PERF_ELAPSED_TIME counter type
  59.     a-robw  -   11/17/92    - added Object Timer fields
  60.     a-robw  -   12/4/92     - changed counter type defines (VER 1, REV 1)
  61.  
  62.  
  63. --*/
  64.  
  65. #ifndef __WINPERF_H
  66. #define __WINPERF_H
  67.  
  68. #ifndef __WINBASE_H
  69. #include <winbase.h>
  70. #endif
  71.  
  72.  
  73. //  Data structure definitions.
  74.  
  75. //  In order for data to be returned through the Configuration Registry
  76. //  in a system-independent fashion, it must be self-describing.
  77.  
  78. //  In the following, all offsets are in bytes.
  79.  
  80. //
  81. //  Data is returned through the Configuration Registry in a
  82. //  a data block which begins with a _PERF_DATA_BLOCK structure.
  83. //
  84.  
  85. #define PERF_DATA_VERSION   1
  86. #define PERF_DATA_REVISION  1
  87.  
  88.  
  89. typedef struct _PERF_DATA_BLOCK {
  90.     WCHAR           Signature[4];       // Signature: Unicode "PERF"
  91.     DWORD           LittleEndian;       // 0 = Big Endian, 1 = Little Endian
  92.     DWORD           Version;            // Version of these data structures
  93.                                         // starting at 1
  94.     DWORD           Revision;           // Revision of these data structures
  95.                                         // starting at 0 for each Version
  96.     DWORD           TotalByteLength;    // Total length of data block
  97.     DWORD           HeaderLength;       // Length of this structure
  98.     DWORD           NumObjectTypes;     // Number of types of objects
  99.                                         // being reported
  100.     LONG            DefaultObject;      // Object Title Index of default
  101.                                         // object to display when data from
  102.                                         // this system is retireved (-1 =
  103.                                         // none, but this is not expected to
  104.                                         // be used)
  105.     SYSTEMTIME      SystemTime;         // Time at the system under
  106.                                         // measurement
  107.     LARGE_INTEGER   PerfTime;           // Performance counter value
  108.                                         // at the system under measurement
  109.     LARGE_INTEGER   PerfFreq;           // Performance counter frequency
  110.                                         // at the system under measurement
  111.     LARGE_INTEGER   PerfTime100nSec;    // Performance counter time in 100 nsec
  112.                                         // units at the system under measurement
  113.     DWORD           SystemNameLength;   // Length of the system name
  114.     DWORD           SystemNameOffset;   // Offset, from beginning of this
  115.                                         // structure, to name of system
  116.                                         // being measured
  117. } PERF_DATA_BLOCK, *PPERF_DATA_BLOCK;
  118.  
  119.  
  120. //
  121. //  The _PERF_DATA_BLOCK structure is followed by NumObjectTypes of
  122. //  data sections, one for each type of object measured.  Each object
  123. //  type section begins with a _PERF_OBJECT_TYPE structure.
  124. //
  125.  
  126.  
  127. typedef struct _PERF_OBJECT_TYPE {
  128.     DWORD           TotalByteLength;    // Length of this object definition
  129.                                         // including this structure, the
  130.                                         // counter defintions, and the
  131.                                         // instance definitions and the
  132.                                         // counter blocks for each instance:
  133.                                         // This is the offset from this
  134.                                         // structure to the next object, if
  135.                                         // any
  136.     DWORD           DefinitionLength;   // Length of object definition,
  137.                                         // which includes this structure
  138.                                         // and the counter definition
  139.                                         // structures for this object: this
  140.                                         // is the offset of the first
  141.                                         // instance or of the counters
  142.                                         // for this object if there is
  143.                                         // no instance
  144.     DWORD           HeaderLength;       // Length of this structure: this
  145.                                         // is the offset to the first
  146.                                         // counter definition for this
  147.                                         // object
  148.     DWORD           ObjectNameTitleIndex;
  149.                                         // Index to name in Title Database
  150.     LPWSTR          ObjectNameTitle;    // Initially NULL, for use by
  151.                                         // analysis program to point to
  152.                                         // retrieved title string
  153.     DWORD           ObjectHelpTitleIndex;
  154.                                         // Index to Help in Title Database
  155.     LPWSTR          ObjectHelpTitle;    // Initially NULL, for use by
  156.                                         // analysis program to point to
  157.                                         // retrieved title string
  158.     DWORD           DetailLevel;        // Object level of detail (for
  159.                                         // controlling display complexity);
  160.                                         // will be min of detail levels
  161.                                         // for all this object's counters
  162.     DWORD           NumCounters;        // Number of counters in each
  163.                                         // counter block (one counter
  164.                                         // block per instance)
  165.     LONG            DefaultCounter;     // Default counter to display when
  166.                                         // this object is selected, index
  167.                                         // starting at 0 (-1 = none, but
  168.                                         // this is not expected to be used)
  169.     LONG            NumInstances;       // Number of object instances
  170.                                         // for which counters are being
  171.                                         // returned from the system under
  172.                                         // measurement. If the object defined
  173.                                         // will never have any instance data
  174.                                         // structures (PERF_INSTANCE_DEFINITION)
  175.                                         // then this value should be -1, if the
  176.                                         // object can have 0 or more instances,
  177.                                         // but has none present, then this
  178.                                         // should be 0, otherwise this field
  179.                                         // contains the number of instances of
  180.                                         // this counter.
  181.     DWORD           CodePage;           // 0 if instance strings are in
  182.                                         // UNICODE, else the Code Page of
  183.                                         // the instance names
  184.     LARGE_INTEGER   PerfTime;           // Sample Time in "Object" units
  185.                                         //
  186.     LARGE_INTEGER   PerfFreq;           // Frequency of "Object" units in
  187.                                         // counts per second.
  188. } PERF_OBJECT_TYPE, *PPERF_OBJECT_TYPE;
  189.  
  190. #define PERF_NO_INSTANCES           -1  // no instances (see NumInstances above)
  191. //
  192. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  193. //
  194. //  PERF_COUNTER_DEFINITION.CounterType field values
  195. //
  196. //
  197. //        Counter ID Field Definition:
  198. //
  199. //   3      2        2    2    2        1        1    1
  200. //   1      8        4    2    0        6        2    0    8                0
  201. //  +--------+--------+----+----+--------+--------+----+----+----------------+
  202. //  |Display |Calculation  |Time|Counter |        |Ctr |Size|                |
  203. //  |Flags   |Modifiers    |Base|SubType |Reserved|Type|Fld |   Reserved     |
  204. //  +--------+--------+----+----+--------+--------+----+----+----------------+
  205. //
  206. //
  207. //  The counter type is the "or" of the following values as described below
  208. //
  209. //  select one of the following to indicate the counter's data size
  210. //
  211. #define PERF_SIZE_DWORD         0x00000000
  212. #define PERF_SIZE_LARGE         0x00000100
  213. #define PERF_SIZE_ZERO          0x00000200  // for Zero Length fields
  214. #define PERF_SIZE_VARIABLE_LEN  0x00000300  // length is in CounterLength field
  215.                                             //  of Counter Definition struct
  216. //
  217. //  select one of the following values to indicate the counter field usage
  218. //
  219. #define PERF_TYPE_NUMBER        0x00000000  // a number (not a counter)
  220. #define PERF_TYPE_COUNTER       0x00000400  // an increasing numeric value
  221. #define PERF_TYPE_TEXT          0x00000800  // a text field
  222. #define PERF_TYPE_ZERO          0x00000C00  // displays a zero
  223. //
  224. //  If the PERF_TYPE_NUMBER field was selected, then select one of the
  225. //  following to describe the Number
  226. //
  227. #define PERF_NUMBER_HEX         0x00000000  // display as HEX value
  228. #define PERF_NUMBER_DECIMAL     0x00010000  // display as a decimal integer
  229. #define PERF_NUMBER_DEC_1000    0x00020000  // display as a decimal/1000
  230. //
  231. //  If the PERF_TYPE_COUNTER value was selected then select one of the
  232. //  following to indicate the type of counter
  233. //
  234. #define PERF_COUNTER_VALUE      0x00000000  // display counter value
  235. #define PERF_COUNTER_RATE       0x00010000  // divide ctr / delta time
  236. #define PERF_COUNTER_FRACTION   0x00020000  // divide ctr / base
  237. #define PERF_COUNTER_BASE       0x00030000  // base value used in fractions
  238. #define PERF_COUNTER_ELAPSED    0x00040000  // subtract counter from current time
  239. #define PERF_COUNTER_QUEUELEN   0x00050000  // Use Queuelen processing func.
  240. #define PERF_COUNTER_HISTOGRAM  0x00060000  // Counter begins or ends a histogram
  241. //
  242. //  If the PERF_TYPE_TEXT value was selected, then select one of the
  243. //  following to indicat the type of TEXT data.
  244. //
  245. #define PERF_TEXT_UNICODE       0x00000000  // type of text in text field
  246. #define PERF_TEXT_ASCII         0x00010000  // ASCII using the CodePage field
  247. //
  248. //  Timer SubTypes
  249. //
  250. #define PERF_TIMER_TICK         0x00000000  // use system perf. freq for base
  251. #define PERF_TIMER_100NS        0x00100000  // use 100 NS timer time base units
  252. #define PERF_OBJECT_TIMER       0x00200000  // use the object timer freq
  253. //
  254. //  Any types that have calculations performed can use one or more of
  255. //  the following calculation modification flags listed here
  256. //
  257. #define PERF_DELTA_COUNTER      0x00400000  // compute difference first
  258. #define PERF_DELTA_BASE         0x00800000  // compute base diff as well
  259. #define PERF_INVERSE_COUNTER    0x01000000  // show as 1.00-value (assumes:
  260. #define PERF_MULTI_COUNTER      0x02000000  // sum of multiple instances
  261. //
  262. //  Select one of the following values to indicate the display suffix (if any)
  263. //
  264. #define PERF_DISPLAY_NO_SUFFIX  0x00000000  // no suffix
  265. #define PERF_DISPLAY_PER_SEC    0x10000000  // "/sec"
  266. #define PERF_DISPLAY_PERCENT    0x20000000  // "%"
  267. #define PERF_DISPLAY_SECONDS    0x30000000  // "secs"
  268. #define PERF_DISPLAY_NOSHOW     0x40000000  // value is not displayed
  269. //
  270. //  Predefined counter types
  271. //
  272.  
  273. // 32-bit Counter.  Divide delta by delta time.  Display suffix: "/sec"
  274. #define PERF_COUNTER_COUNTER        \
  275.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  276.             PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PER_SEC)
  277.  
  278.  
  279. // 64-bit Timer.  Divide delta by delta time.  Display suffix: "%"
  280. #define PERF_COUNTER_TIMER          \
  281.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  282.             PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT)
  283.  
  284. // Queue Length Space-Time Product. Divide delta by delta time. No Display Suffix.
  285. #define PERF_COUNTER_QUEUELEN_TYPE  \
  286.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_QUEUELEN |\
  287.             PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX)
  288.  
  289. // 64-bit Counter.  Divide delta by delta time. Display Suffix: "/sec"
  290. #define PERF_COUNTER_BULK_COUNT     \
  291.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  292.             PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PER_SEC)
  293.  
  294. // Indicates the counter is not a  counter but rather Unicode text Display as text.
  295. #define PERF_COUNTER_TEXT           \
  296.             (PERF_SIZE_VARIABLE_LEN | PERF_TYPE_TEXT | PERF_TEXT_UNICODE |\
  297.             PERF_DISPLAY_NO_SUFFIX)
  298.  
  299. // Indicates the data is a counter  which should not be
  300. // time averaged on display (such as an error counter on a serial line)
  301. // Display as is.  No Display Suffix.
  302. #define PERF_COUNTER_RAWCOUNT       \
  303.             (PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL |\
  304.             PERF_DISPLAY_NO_SUFFIX)
  305.  
  306. // A count which is either 1 or 0 on each sampling interrupt (% busy)
  307. // Divide delta by delta base. Display Suffix: "%"
  308. #define PERF_SAMPLE_FRACTION        \
  309.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION |\
  310.             PERF_DELTA_COUNTER | PERF_DELTA_BASE | PERF_DISPLAY_PERCENT)
  311.  
  312. // A count which is sampled on each sampling interrupt (queue length)
  313. // Divide delta by delta time. No Display Suffix.
  314. #define PERF_SAMPLE_COUNTER         \
  315.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  316.             PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX)
  317.  
  318. // A label: no data is associated with this counter (it has 0 length)
  319. // Do not display.
  320. #define PERF_COUNTER_NODATA         \
  321.             (PERF_SIZE_ZERO | PERF_DISPLAY_NOSHOW)
  322.  
  323. // 64-bit Timer inverse (e.g., idle is measured, but display busy %)
  324. // Display 100 - delta divided by delta time.  Display suffix: "%"
  325. #define PERF_COUNTER_TIMER_INV      \
  326.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  327.             PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_INVERSE_COUNTER | \
  328.             PERF_DISPLAY_PERCENT)
  329.  
  330. // The divisor for a sample, used with the previous counter to form a
  331. // sampled %.  You must check for >0 before dividing by this!  This
  332. // counter will directly follow the  numerator counter.  It should not
  333. // be displayed to the user.
  334. #define PERF_SAMPLE_BASE            \
  335.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE |\
  336.             PERF_DISPLAY_NOSHOW |\
  337.             0x00000001)  // for compatibility with pre-beta versions
  338.  
  339. // A timer which, when divided by an average base, produces a time
  340. // in seconds which is the average time of some operation.  This
  341. // timer times total operations, and  the base is the number of opera-
  342. // tions.  Display Suffix: "sec"
  343. #define PERF_AVERAGE_TIMER          \
  344.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION |\
  345.             PERF_DISPLAY_SECONDS)
  346.  
  347. // Used as the denominator in the computation of time or count
  348. // averages.  Must directly follow the numerator counter.  Not dis-
  349. // played to the user.
  350. #define PERF_AVERAGE_BASE           \
  351.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE |\
  352.             PERF_DISPLAY_NOSHOW |\
  353.             0x00000002)  // for compatibility with pre-beta versions
  354.  
  355.  
  356. // A bulk count which, when divided (typically) by the number of
  357. // operations, gives (typically) the number of bytes per operation.
  358. // No Display Suffix.
  359. #define PERF_AVERAGE_BULK           \
  360.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION  |\
  361.             PERF_DISPLAY_NOSHOW)
  362.  
  363. // 64-bit Timer in 100 nsec units. Display delta divided by
  364. // delta time.  Display suffix: "%"
  365. #define PERF_100NSEC_TIMER          \
  366.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  367.             PERF_TIMER_100NS | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT)
  368.  
  369. // 64-bit Timer inverse (e.g., idle is measured, but display busy %)
  370. // Display 100 - delta divided by delta time.  Display suffix: "%"
  371. #define PERF_100NSEC_TIMER_INV      \
  372.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  373.             PERF_TIMER_100NS | PERF_DELTA_COUNTER | PERF_INVERSE_COUNTER  |\
  374.             PERF_DISPLAY_PERCENT)
  375.  
  376. // 64-bit Timer.  Divide delta by delta time.  Display suffix: "%"
  377. // Timer for multiple instances, so result can exceed 100%.
  378. #define PERF_COUNTER_MULTI_TIMER    \
  379.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  380.             PERF_DELTA_COUNTER | PERF_TIMER_TICK | PERF_MULTI_COUNTER |\
  381.             PERF_DISPLAY_PERCENT)
  382.  
  383. // 64-bit Timer inverse (e.g., idle is measured, but display busy %)
  384. // Display 100 * _MULTI_BASE - delta divided by delta time.
  385. // Display suffix: "%" Timer for multiple instances, so result
  386. // can exceed 100%.  Followed by a counter of type _MULTI_BASE.
  387. #define PERF_COUNTER_MULTI_TIMER_INV \
  388.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE |\
  389.             PERF_DELTA_COUNTER | PERF_MULTI_COUNTER | PERF_TIMER_TICK |\
  390.             PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT)
  391.  
  392. // Number of instances to which the preceeding _MULTI_..._INV counter
  393. // applies.  Used as a factor to get the percentage.
  394. #define PERF_COUNTER_MULTI_BASE     \
  395.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_BASE |\
  396.             PERF_MULTI_COUNTER | PERF_DISPLAY_NOSHOW)
  397.  
  398. // 64-bit Timer in 100 nsec units. Display delta divided by delta time.
  399. // Display suffix: "%" Timer for multiple instances, so result can exceed 100%.
  400. #define PERF_100NSEC_MULTI_TIMER   \
  401.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_DELTA_COUNTER  |\
  402.             PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_MULTI_COUNTER |\
  403.             PERF_DISPLAY_PERCENT)
  404.  
  405. // 64-bit Timer inverse (e.g., idle is measured, but display busy %)
  406. // Display 100 * _MULTI_BASE - delta divided by delta time.
  407. // Display suffix: "%" Timer for multiple instances, so result
  408. // can exceed 100%.  Followed by a counter of type _MULTI_BASE.
  409. #define PERF_100NSEC_MULTI_TIMER_INV \
  410.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_DELTA_COUNTER  |\
  411.             PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_MULTI_COUNTER |\
  412.             PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT)
  413.  
  414. // Indicates the data is a fraction of the following counter  which
  415. // should not be time averaged on display (such as free space over
  416. // total space.) Display as is.  Display the quotient as "%".
  417. #define PERF_RAW_FRACTION           \
  418.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION |\
  419.             PERF_DISPLAY_PERCENT)
  420.  
  421. // Indicates the data is a base for the preceeding counter  which should
  422. // not be time averaged on display (such as free space over total space.)
  423. #define PERF_RAW_BASE               \
  424.             (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE |\
  425.             PERF_DISPLAY_NOSHOW |\
  426.             0x00000003)  // for compatibility with pre-beta versions
  427.  
  428.  
  429. // the data collected is the difference between the current (i.e. sample)
  430. // time and the start time (i.e. the counter value) counter data is a
  431. // LARGE_INTEGER in 100NS units and is displayed as seconds
  432. #define PERF_ELAPSED_TIME           \
  433.             (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_ELAPSED |\
  434.             PERF_OBJECT_TIMER | PERF_DISPLAY_SECONDS)
  435.  
  436. //
  437. //  The following counter type can be used with the preceeding types to
  438. //  define a reange of values to be displayed in a histogram.
  439. //
  440.  
  441. #define PERF_COUNTER_HISTOGRAM_TYPE   0x80000000
  442.                                         // Counter begins or ends a histogram
  443.  
  444. //
  445. //  The following are used to determine the level of detail associated
  446. //  with the counter.  The user will be setting the level of detail
  447. //  that should be displayed at any given time.
  448. //
  449.  
  450. #define PERF_DETAIL_NOVICE          100 // The uninformed can understand it
  451. #define PERF_DETAIL_ADVANCED        200 // For the advanced user
  452. #define PERF_DETAIL_EXPERT          300 // For the expert user
  453. #define PERF_DETAIL_WIZARD          400 // For the system designer
  454.  
  455.  
  456. //
  457. //  There is one of the following for each of the
  458. //  PERF_OBJECT_TYPE.NumCounters.  The Unicode names in this structure MUST
  459. //  come from a message file.
  460. //
  461.  
  462. typedef struct _PERF_COUNTER_DEFINITION {
  463.     DWORD           ByteLength;         // Length in bytes of this structure
  464.     DWORD           CounterNameTitleIndex;
  465.                                         // Index of Counter name into
  466.                                         // Title Database
  467.     LPWSTR          CounterNameTitle;   // Initially NULL, for use by
  468.                                         // analysis program to point to
  469.                                         // retrieved title string
  470.     DWORD           CounterHelpTitleIndex;
  471.                                         // Index of Counter Help into
  472.                                         // Title Database
  473.     LPWSTR          CounterHelpTitle;   // Initially NULL, for use by
  474.                                         // analysis program to point to
  475.                                         // retrieved title string
  476.     LONG            DefaultScale;       // Power of 10 by which to scale
  477.                                         // chart line if vertical axis is 100
  478.                                         // 0 ==> 1, 1 ==> 10, -1 ==>1/10, etc.
  479.     DWORD           DetailLevel;        // Counter level of detail (for
  480.                                         // controlling display complexity)
  481.     DWORD           CounterType;        // Type of counter
  482.     DWORD           CounterSize;        // Size of counter in bytes
  483.     DWORD           CounterOffset;      // Offset from the start of the
  484.                                         // PERF_COUNTER_BLOCK to the first
  485.                                         // byte of this counter
  486. } PERF_COUNTER_DEFINITION, *PPERF_COUNTER_DEFINITION;
  487.  
  488. //
  489. //  If (PERF_DATA_BLOCK.NumInstances >= 0) then there will be
  490. //  PERF_DATA_BLOCK.NumInstances of a (PERF_INSTANCE_DEFINITION
  491. //  followed by a PERF_COUNTER_BLOCK followed by the counter data fields)
  492. //  for each instance.
  493. //
  494. //  If (PERF_DATA_BLOCK.NumInstances < 0) then the counter definition
  495. //  strucutre above will be followed by only a PERF_COUNTER_BLOCK and the
  496. //  counter data for that COUNTER.
  497. //
  498.  
  499. #define PERF_NO_UNIQUE_ID -1
  500.  
  501. typedef struct _PERF_INSTANCE_DEFINITION {
  502.     DWORD           ByteLength;         // Length in bytes of this structure,
  503.                                         // including the subsequent name
  504.     DWORD           ParentObjectTitleIndex;
  505.                                         // Title Index to name of "parent"
  506.                                         // object (e.g., if thread, then
  507.                                         // process is parent object type);
  508.                                         // if logical drive, the physical
  509.                                         // drive is parent object type
  510.     DWORD           ParentObjectInstance;
  511.                                         // Index to instance of parent object
  512.                                         // type which is the parent of this
  513.                                         // instance.
  514.     LONG            UniqueID;           // A unique ID used instead of
  515.                                         // matching the name to identify
  516.                                         // this instance, -1 = none
  517.     DWORD           NameOffset;         // Offset from beginning of
  518.                                         // this struct to the Unicode name
  519.                                         // of this instance
  520.     DWORD           NameLength;         // Length in bytes of name; 0 = none
  521.  
  522. } PERF_INSTANCE_DEFINITION, *PPERF_INSTANCE_DEFINITION;
  523. //
  524. //  If .ParentObjectName is 0, there
  525. //  is no parent-child hierarcy for this object type.  Otherwise,
  526. //   the .ParentObjectInstance is an index, starting at 0, into the
  527. //  instances reported for the parent object type.  It is only
  528. //  meaningful if .ParentObjectName is not 0.  The purpose of all this
  529. //  is to permit reporting/summation of object instances like threads
  530. //  within processes, and logical drives within physical drives.
  531. //
  532. //
  533. //  The PERF_INSTANCE_DEFINITION will be followed by a PERF_COUNTER_BLOCK.
  534. //
  535.  
  536. typedef struct _PERF_COUNTER_BLOCK {
  537.     DWORD           ByteLength;         // Length in bytes of this structure,
  538.                                         // including the following counters
  539. } PERF_COUNTER_BLOCK, *PPERF_COUNTER_BLOCK;
  540.  
  541. //
  542. //  The PERF_COUNTER_BLOCK is followed by PERF_OBJECT_TYPE.NumCounters
  543. //  number of counters.
  544. //
  545.  
  546. //
  547. //  function typedefs for extensible counter function prototypes
  548. //
  549. typedef DWORD (PM_OPEN_PROC) (LPWSTR);
  550. typedef DWORD (PM_COLLECT_PROC) (LPWSTR, LPVOID *, LPDWORD, LPDWORD);
  551. typedef DWORD (PM_CLOSE_PROC) ();
  552.  
  553. #endif // _WINPERF_
  554.