home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / winperf.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  31.4 KB  |  644 lines

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