home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / winperf.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  29KB  |  572 lines

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