home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / RTLWIN32.PAK / WINPERF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  27.7 KB  |  566 lines

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