Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

657 lines
31 KiB

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