Leaked source code of windows server 2003
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.

995 lines
29 KiB

  1. /*++
  2. Copyright (c) 1997-1998 Microsoft Corporation
  3. Module Name:
  4. datats.c
  5. Abstract:
  6. Constant data structures used by the Performance Monitor data for the
  7. Terminal Server User and WinStation performance data objects
  8. Created:
  9. Erik Mavrinac 25-Nov-1998
  10. Revision History:
  11. 30-Mar-1998 - Last revision of original Terminal Server 4.0
  12. counter code base.
  13. --*/
  14. #include <windows.h>
  15. #include <winperf.h>
  16. #include <ntprfctr.h>
  17. #include <perfutil.h>
  18. #include "datats.h"
  19. // Dummy variables for field sizing.
  20. static PROCESS_COUNTER_DATA pcd;
  21. static WINSTATION_COUNTER_DATA wsd;
  22. //
  23. // We need to define our own counter for ThinWire display.
  24. //
  25. #define PERF_COUNTER_TS_PERCENT \
  26. (PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL |\
  27. PERF_DISPLAY_NO_SUFFIX)
  28. // Default TS scaling factor for the raw counts.
  29. #define TS_SCALE_FACTOR (-10000)
  30. #define FIELDSIZE(type, field) (sizeof(((type *)1)->field))
  31. #define FIELDOFFSET(type, field) ((UINT_PTR)(&((type *)0)->field))
  32. // Note that we set the counter names and descriptions as the offset counters
  33. // from tslabels.h. Later when we load we will read the registry start offset
  34. // and add it into each of the slots below to create the resulting
  35. // real indices. See tslbl009.ini for descriptions.
  36. WINSTATION_DATA_DEFINITION WinStationDataDefinition =
  37. {
  38. { sizeof(WINSTATION_DATA_DEFINITION) + sizeof(WINSTATION_COUNTER_DATA),
  39. sizeof(WINSTATION_DATA_DEFINITION),
  40. sizeof(PERF_OBJECT_TYPE),
  41. WINSTATION_OBJECT,
  42. 0,
  43. WINSTATION_OBJECT + 1,
  44. 0,
  45. PERF_DETAIL_NOVICE,
  46. (sizeof(WINSTATION_DATA_DEFINITION) - sizeof(PERF_OBJECT_TYPE)) /
  47. sizeof(PERF_COUNTER_DEFINITION),
  48. 0,
  49. 0,
  50. UNICODE_CODE_PAGE,
  51. {0L,0L},
  52. {10000000L,0L}
  53. },
  54. // Process counters totaled on a per-WinStation basis.
  55. { sizeof(PERF_COUNTER_DEFINITION),
  56. 6,
  57. 0,
  58. 189,
  59. 0,
  60. 0,
  61. PERF_DETAIL_NOVICE,
  62. PERF_100NSEC_TIMER,
  63. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.ProcessorTime),
  64. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.ProcessorTime)
  65. },
  66. { sizeof(PERF_COUNTER_DEFINITION),
  67. 142,
  68. 0,
  69. 157,
  70. 0,
  71. 0,
  72. PERF_DETAIL_ADVANCED,
  73. PERF_100NSEC_TIMER,
  74. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.UserTime),
  75. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.UserTime)
  76. },
  77. { sizeof(PERF_COUNTER_DEFINITION),
  78. 144,
  79. 0,
  80. 159,
  81. 0,
  82. 0,
  83. PERF_DETAIL_ADVANCED,
  84. PERF_100NSEC_TIMER,
  85. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.KernelTime),
  86. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.KernelTime)
  87. },
  88. { sizeof(PERF_COUNTER_DEFINITION),
  89. 172,
  90. 0,
  91. 173,
  92. 0,
  93. -6,
  94. PERF_DETAIL_EXPERT,
  95. PERF_COUNTER_LARGE_RAWCOUNT,
  96. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.PeakVirtualSize),
  97. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.PeakVirtualSize)
  98. },
  99. { sizeof(PERF_COUNTER_DEFINITION),
  100. 174,
  101. 0,
  102. 175,
  103. 0,
  104. -6,
  105. PERF_DETAIL_EXPERT,
  106. PERF_COUNTER_LARGE_RAWCOUNT,
  107. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.VirtualSize),
  108. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.VirtualSize)
  109. },
  110. { sizeof(PERF_COUNTER_DEFINITION),
  111. 28,
  112. 0,
  113. 177,
  114. 0,
  115. -1,
  116. PERF_DETAIL_NOVICE,
  117. PERF_COUNTER_COUNTER,
  118. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.PageFaults),
  119. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.PageFaults)
  120. },
  121. { sizeof(PERF_COUNTER_DEFINITION),
  122. 178,
  123. 0,
  124. 179,
  125. 0,
  126. -5,
  127. PERF_DETAIL_ADVANCED,
  128. PERF_COUNTER_LARGE_RAWCOUNT,
  129. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.PeakWorkingSet),
  130. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.PeakWorkingSet)
  131. },
  132. { sizeof(PERF_COUNTER_DEFINITION),
  133. 180,
  134. 0,
  135. 181,
  136. 0,
  137. -5,
  138. PERF_DETAIL_NOVICE,
  139. PERF_COUNTER_LARGE_RAWCOUNT,
  140. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.TotalWorkingSet),
  141. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.TotalWorkingSet)
  142. },
  143. { sizeof(PERF_COUNTER_DEFINITION),
  144. 182,
  145. 0,
  146. 183,
  147. 0,
  148. -6,
  149. PERF_DETAIL_ADVANCED,
  150. PERF_COUNTER_LARGE_RAWCOUNT,
  151. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.PeakPageFile),
  152. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.PeakPageFile)
  153. },
  154. { sizeof(PERF_COUNTER_DEFINITION),
  155. 184,
  156. 0,
  157. 185,
  158. 0,
  159. -6,
  160. PERF_DETAIL_ADVANCED,
  161. PERF_COUNTER_LARGE_RAWCOUNT,
  162. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.PageFile),
  163. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.PageFile)
  164. },
  165. { sizeof(PERF_COUNTER_DEFINITION),
  166. 186,
  167. 0,
  168. 187,
  169. 0,
  170. -5,
  171. PERF_DETAIL_ADVANCED,
  172. PERF_COUNTER_LARGE_RAWCOUNT,
  173. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.PrivatePages),
  174. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.PrivatePages)
  175. },
  176. { sizeof(PERF_COUNTER_DEFINITION),
  177. 680,
  178. 0,
  179. 681,
  180. 0,
  181. 0,
  182. PERF_DETAIL_ADVANCED,
  183. PERF_COUNTER_RAWCOUNT,
  184. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.ThreadCount),
  185. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.ThreadCount)
  186. },
  187. { sizeof(PERF_COUNTER_DEFINITION),
  188. 56,
  189. 0,
  190. 57,
  191. 0,
  192. -5,
  193. PERF_DETAIL_ADVANCED,
  194. PERF_COUNTER_RAWCOUNT,
  195. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.PagedPool),
  196. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.PagedPool)
  197. },
  198. { sizeof(PERF_COUNTER_DEFINITION),
  199. 58,
  200. 0,
  201. 59,
  202. 0,
  203. -5,
  204. PERF_DETAIL_ADVANCED,
  205. PERF_COUNTER_RAWCOUNT,
  206. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.NonPagedPool),
  207. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.NonPagedPool)
  208. },
  209. { sizeof(PERF_COUNTER_DEFINITION),
  210. 952,
  211. 0,
  212. 953,
  213. 0,
  214. 0,
  215. PERF_DETAIL_ADVANCED,
  216. PERF_COUNTER_RAWCOUNT,
  217. FIELDSIZE(WINSTATION_COUNTER_DATA, pcd.HandleCount),
  218. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, pcd.HandleCount)
  219. },
  220. // Input counters for WinStation protocols
  221. { sizeof(PERF_COUNTER_DEFINITION),
  222. INWDBYTES,
  223. 0,
  224. INWDBYTES + 1,
  225. 0,
  226. -2, // scale
  227. PERF_DETAIL_NOVICE,
  228. PERF_COUNTER_COUNTER,
  229. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.WdBytes),
  230. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.WdBytes),
  231. },
  232. { sizeof(PERF_COUNTER_DEFINITION),
  233. INWDFRAMES,
  234. 0,
  235. INWDFRAMES + 1,
  236. 0,
  237. 0, // no scaling
  238. PERF_DETAIL_NOVICE,
  239. PERF_COUNTER_COUNTER,
  240. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.WdFrames),
  241. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.WdFrames),
  242. },
  243. { sizeof(PERF_COUNTER_DEFINITION),
  244. INWAITFOROUTBUF,
  245. 0,
  246. INWAITFOROUTBUF + 1,
  247. 0,
  248. 0, // No scaling
  249. PERF_DETAIL_NOVICE,
  250. PERF_COUNTER_RAWCOUNT,
  251. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.WaitForOutBuf),
  252. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.WaitForOutBuf),
  253. },
  254. { sizeof(PERF_COUNTER_DEFINITION),
  255. INFRAMES,
  256. 0,
  257. INFRAMES + 1,
  258. 0,
  259. 0, // no scaling
  260. PERF_DETAIL_NOVICE,
  261. PERF_COUNTER_COUNTER,
  262. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.Frames),
  263. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.Frames),
  264. },
  265. { sizeof(PERF_COUNTER_DEFINITION),
  266. INBYTES,
  267. 0,
  268. INBYTES + 1,
  269. 0,
  270. -2, // scale
  271. PERF_DETAIL_NOVICE,
  272. PERF_COUNTER_COUNTER,
  273. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.Bytes),
  274. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.Bytes),
  275. },
  276. { sizeof(PERF_COUNTER_DEFINITION),
  277. INCOMPBYTES,
  278. 0,
  279. INCOMPBYTES + 1,
  280. 0,
  281. -2,
  282. PERF_DETAIL_NOVICE,
  283. PERF_COUNTER_COUNTER,
  284. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.CompressedBytes),
  285. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA,
  286. Input.CompressedBytes),
  287. },
  288. { sizeof(PERF_COUNTER_DEFINITION),
  289. INCOMPFLUSHES,
  290. 0,
  291. INCOMPFLUSHES + 1,
  292. 0,
  293. -2,
  294. PERF_DETAIL_NOVICE,
  295. PERF_COUNTER_RAWCOUNT,
  296. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.CompressFlushes),
  297. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA,
  298. Input.CompressFlushes),
  299. },
  300. { sizeof(PERF_COUNTER_DEFINITION),
  301. INERRORS,
  302. 0,
  303. INERRORS + 1,
  304. 0,
  305. 0, // No scaling
  306. PERF_DETAIL_NOVICE,
  307. PERF_COUNTER_RAWCOUNT,
  308. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.Errors),
  309. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.Errors),
  310. },
  311. { sizeof(PERF_COUNTER_DEFINITION),
  312. INTIMEOUTS,
  313. 0,
  314. INTIMEOUTS + 1,
  315. 0,
  316. 0, // No scaling
  317. PERF_DETAIL_NOVICE,
  318. PERF_COUNTER_RAWCOUNT,
  319. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.Timeouts),
  320. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.Timeouts),
  321. },
  322. { sizeof(PERF_COUNTER_DEFINITION),
  323. INASYNCFRAMEERR,
  324. 0,
  325. INASYNCFRAMEERR + 1,
  326. 0,
  327. 0, // No scaling
  328. PERF_DETAIL_NOVICE,
  329. PERF_COUNTER_RAWCOUNT,
  330. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.AsyncFramingError),
  331. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.AsyncFramingError),
  332. },
  333. { sizeof(PERF_COUNTER_DEFINITION),
  334. INASYNCOVERRUN,
  335. 0,
  336. INASYNCOVERRUN + 1,
  337. 0,
  338. 0, // No scaling
  339. PERF_DETAIL_NOVICE,
  340. PERF_COUNTER_RAWCOUNT,
  341. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.AsyncOverrunError),
  342. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.AsyncOverrunError),
  343. },
  344. { sizeof(PERF_COUNTER_DEFINITION),
  345. INASYNCOVERFLOW,
  346. 0,
  347. INASYNCOVERFLOW + 1,
  348. 0,
  349. 0, // No scaling
  350. PERF_DETAIL_NOVICE,
  351. PERF_COUNTER_RAWCOUNT,
  352. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.AsyncOverflowError),
  353. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.AsyncOverflowError),
  354. },
  355. { sizeof(PERF_COUNTER_DEFINITION),
  356. INASYNCPARITY,
  357. 0,
  358. INASYNCPARITY + 1,
  359. 0,
  360. 0, // No scaling
  361. PERF_DETAIL_NOVICE,
  362. PERF_COUNTER_RAWCOUNT,
  363. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.AsyncParityError),
  364. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.AsyncParityError),
  365. },
  366. { sizeof(PERF_COUNTER_DEFINITION),
  367. INTDERRORS,
  368. 0,
  369. INTDERRORS + 1,
  370. 0,
  371. 0, // No scaling
  372. PERF_DETAIL_NOVICE,
  373. PERF_COUNTER_RAWCOUNT,
  374. FIELDSIZE(WINSTATION_COUNTER_DATA, Input.TdErrors),
  375. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Input.TdErrors),
  376. },
  377. // Output counters for WinStation protocols
  378. { sizeof(PERF_COUNTER_DEFINITION),
  379. OUTWDBYTES,
  380. 0,
  381. OUTWDBYTES + 1,
  382. 0,
  383. -2,
  384. PERF_DETAIL_NOVICE,
  385. PERF_COUNTER_COUNTER,
  386. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.WdBytes),
  387. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.WdBytes),
  388. },
  389. { sizeof(PERF_COUNTER_DEFINITION),
  390. OUTWDFRAMES,
  391. 0,
  392. OUTWDFRAMES + 1,
  393. 0,
  394. 0, // no scaling
  395. PERF_DETAIL_NOVICE,
  396. PERF_COUNTER_COUNTER,
  397. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.WdFrames),
  398. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.WdFrames),
  399. },
  400. { sizeof(PERF_COUNTER_DEFINITION),
  401. OUTWAITFOROUTBUF,
  402. 0,
  403. OUTWAITFOROUTBUF + 1,
  404. 0,
  405. 0, // No scaling
  406. PERF_DETAIL_NOVICE,
  407. PERF_COUNTER_RAWCOUNT,
  408. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.WaitForOutBuf),
  409. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.WaitForOutBuf),
  410. },
  411. { sizeof(PERF_COUNTER_DEFINITION),
  412. OUTFRAMES,
  413. 0,
  414. OUTFRAMES + 1,
  415. 0,
  416. 0, // no scaling
  417. PERF_DETAIL_NOVICE,
  418. PERF_COUNTER_COUNTER,
  419. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.Frames),
  420. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.Frames),
  421. },
  422. { sizeof(PERF_COUNTER_DEFINITION),
  423. OUTBYTES,
  424. 0,
  425. OUTBYTES + 1,
  426. 0,
  427. -2,
  428. PERF_DETAIL_NOVICE,
  429. PERF_COUNTER_COUNTER,
  430. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.Bytes),
  431. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.Bytes),
  432. },
  433. { sizeof(PERF_COUNTER_DEFINITION),
  434. OUTCOMPBYTES,
  435. 0,
  436. OUTCOMPBYTES + 1,
  437. 0,
  438. -2,
  439. PERF_DETAIL_NOVICE,
  440. PERF_COUNTER_COUNTER,
  441. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.CompressedBytes),
  442. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.CompressedBytes),
  443. },
  444. { sizeof(PERF_COUNTER_DEFINITION),
  445. OUTCOMPFLUSHES,
  446. 0,
  447. OUTCOMPFLUSHES + 1,
  448. 0,
  449. -2,
  450. PERF_DETAIL_NOVICE,
  451. PERF_COUNTER_RAWCOUNT,
  452. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.CompressFlushes),
  453. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.CompressFlushes),
  454. },
  455. { sizeof(PERF_COUNTER_DEFINITION),
  456. OUTERRORS,
  457. 0,
  458. OUTERRORS + 1,
  459. 0,
  460. -2,
  461. PERF_DETAIL_NOVICE,
  462. PERF_COUNTER_RAWCOUNT,
  463. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.Errors),
  464. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.Errors),
  465. },
  466. { sizeof(PERF_COUNTER_DEFINITION),
  467. OUTTIMEOUTS,
  468. 0,
  469. OUTTIMEOUTS + 1,
  470. 0,
  471. 0, // No scaling
  472. PERF_DETAIL_NOVICE,
  473. PERF_COUNTER_RAWCOUNT,
  474. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.Timeouts),
  475. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.Timeouts),
  476. },
  477. { sizeof(PERF_COUNTER_DEFINITION),
  478. OUTASYNCFRAMEERR,
  479. 0,
  480. OUTASYNCFRAMEERR + 1,
  481. 0,
  482. 0, // No scaling
  483. PERF_DETAIL_NOVICE,
  484. PERF_COUNTER_RAWCOUNT,
  485. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.AsyncFramingError),
  486. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.AsyncFramingError),
  487. },
  488. { sizeof(PERF_COUNTER_DEFINITION),
  489. OUTASYNCOVERRUN,
  490. 0,
  491. OUTASYNCOVERRUN + 1,
  492. 0,
  493. 0, // No scaling
  494. PERF_DETAIL_NOVICE,
  495. PERF_COUNTER_RAWCOUNT,
  496. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.AsyncOverrunError),
  497. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.AsyncOverrunError),
  498. },
  499. { sizeof(PERF_COUNTER_DEFINITION),
  500. OUTASYNCOVERFLOW,
  501. 0,
  502. OUTASYNCOVERFLOW + 1,
  503. 0,
  504. 0, // No scaling
  505. PERF_DETAIL_NOVICE,
  506. PERF_COUNTER_RAWCOUNT,
  507. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.AsyncOverflowError),
  508. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.AsyncOverflowError),
  509. },
  510. { sizeof(PERF_COUNTER_DEFINITION),
  511. OUTASYNCPARITY,
  512. 0,
  513. OUTASYNCPARITY + 1,
  514. 0,
  515. 0, // No scaling
  516. PERF_DETAIL_NOVICE,
  517. PERF_COUNTER_RAWCOUNT,
  518. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.AsyncParityError),
  519. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.AsyncParityError),
  520. },
  521. { sizeof(PERF_COUNTER_DEFINITION),
  522. OUTTDERRORS,
  523. 0,
  524. OUTTDERRORS + 1,
  525. 0,
  526. 0, // No scaling
  527. PERF_DETAIL_NOVICE,
  528. PERF_COUNTER_RAWCOUNT,
  529. FIELDSIZE(WINSTATION_COUNTER_DATA, Output.TdErrors),
  530. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Output.TdErrors),
  531. },
  532. // Totals counters
  533. { sizeof(PERF_COUNTER_DEFINITION),
  534. TOTALWDBYTES,
  535. 0,
  536. TOTALWDBYTES + 1,
  537. 0,
  538. -2,
  539. PERF_DETAIL_NOVICE,
  540. PERF_COUNTER_COUNTER,
  541. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.WdBytes),
  542. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.WdBytes),
  543. },
  544. { sizeof(PERF_COUNTER_DEFINITION),
  545. TOTALWDFRAMES,
  546. 0,
  547. TOTALWDFRAMES + 1,
  548. 0,
  549. 0, // no scaling
  550. PERF_DETAIL_NOVICE,
  551. PERF_COUNTER_COUNTER,
  552. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.WdFrames),
  553. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.WdFrames),
  554. },
  555. { sizeof(PERF_COUNTER_DEFINITION),
  556. TOTALWAITFOROUTBUF,
  557. 0,
  558. TOTALWAITFOROUTBUF + 1,
  559. 0,
  560. 0, // No scaling
  561. PERF_DETAIL_NOVICE,
  562. PERF_COUNTER_RAWCOUNT,
  563. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.WaitForOutBuf),
  564. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.WaitForOutBuf),
  565. },
  566. { sizeof(PERF_COUNTER_DEFINITION),
  567. TOTALFRAMES,
  568. 0,
  569. TOTALFRAMES + 1,
  570. 0,
  571. 0, // no scaling
  572. PERF_DETAIL_NOVICE,
  573. PERF_COUNTER_COUNTER,
  574. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.Frames),
  575. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.Frames),
  576. },
  577. { sizeof(PERF_COUNTER_DEFINITION),
  578. TOTALBYTES,
  579. 0,
  580. TOTALBYTES + 1,
  581. 0,
  582. -2,
  583. PERF_DETAIL_NOVICE,
  584. PERF_COUNTER_COUNTER,
  585. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.Bytes),
  586. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.Bytes),
  587. },
  588. { sizeof(PERF_COUNTER_DEFINITION),
  589. TOTALCOMPBYTES,
  590. 0,
  591. TOTALCOMPBYTES + 1,
  592. 0,
  593. -2,
  594. PERF_DETAIL_NOVICE,
  595. PERF_COUNTER_COUNTER,
  596. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.CompressedBytes),
  597. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.CompressedBytes),
  598. },
  599. { sizeof(PERF_COUNTER_DEFINITION),
  600. TOTALCOMPFLUSHES,
  601. 0,
  602. TOTALCOMPFLUSHES + 1,
  603. 0,
  604. -2,
  605. PERF_DETAIL_NOVICE,
  606. PERF_COUNTER_RAWCOUNT,
  607. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.CompressFlushes),
  608. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.CompressFlushes),
  609. },
  610. { sizeof(PERF_COUNTER_DEFINITION),
  611. TOTALERRORS,
  612. 0,
  613. TOTALERRORS + 1,
  614. 0,
  615. 0, // No scaling
  616. PERF_DETAIL_NOVICE,
  617. PERF_COUNTER_RAWCOUNT,
  618. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.Errors),
  619. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.Errors),
  620. },
  621. { sizeof(PERF_COUNTER_DEFINITION),
  622. TOTALTIMEOUTS,
  623. 0,
  624. TOTALTIMEOUTS + 1,
  625. 0,
  626. 0, // No scaling
  627. PERF_DETAIL_NOVICE,
  628. PERF_COUNTER_RAWCOUNT,
  629. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.Timeouts),
  630. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.Timeouts),
  631. },
  632. { sizeof(PERF_COUNTER_DEFINITION),
  633. TOTALASYNCFRAMEERR,
  634. 0,
  635. TOTALASYNCFRAMEERR + 1,
  636. 0,
  637. 0, // No scaling
  638. PERF_DETAIL_NOVICE,
  639. PERF_COUNTER_RAWCOUNT,
  640. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.AsyncFramingError),
  641. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.AsyncFramingError),
  642. },
  643. { sizeof(PERF_COUNTER_DEFINITION),
  644. TOTALASYNCOVERRUN,
  645. 0,
  646. TOTALASYNCOVERRUN + 1,
  647. 0,
  648. 0, // No scaling
  649. PERF_DETAIL_NOVICE,
  650. PERF_COUNTER_RAWCOUNT,
  651. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.AsyncOverrunError),
  652. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.AsyncOverrunError),
  653. },
  654. { sizeof(PERF_COUNTER_DEFINITION),
  655. TOTALASYNCOVERFLOW,
  656. 0,
  657. TOTALASYNCOVERFLOW + 1,
  658. 0,
  659. 0, // No scaling
  660. PERF_DETAIL_NOVICE,
  661. PERF_COUNTER_RAWCOUNT,
  662. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.AsyncOverflowError),
  663. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.AsyncOverflowError),
  664. },
  665. { sizeof(PERF_COUNTER_DEFINITION),
  666. TOTALASYNCPARITY,
  667. 0,
  668. TOTALASYNCPARITY + 1,
  669. 0,
  670. 0, // No scaling
  671. PERF_DETAIL_NOVICE,
  672. PERF_COUNTER_RAWCOUNT,
  673. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.AsyncParityError),
  674. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.AsyncParityError),
  675. },
  676. { sizeof(PERF_COUNTER_DEFINITION),
  677. TOTALTDERRORS,
  678. 0,
  679. TOTALTDERRORS + 1,
  680. 0,
  681. 0, // No scaling
  682. PERF_DETAIL_NOVICE,
  683. PERF_COUNTER_RAWCOUNT,
  684. FIELDSIZE(WINSTATION_COUNTER_DATA, Total.TdErrors),
  685. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, Total.TdErrors),
  686. },
  687. // Display driver statistics -- these are set up the same way for
  688. // both ICA and RDP.
  689. { sizeof(PERF_COUNTER_DEFINITION),
  690. DDCACHEREAD,
  691. 0,
  692. DDCACHEREAD + 1,
  693. 0,
  694. TS_SCALE_FACTOR,
  695. PERF_DETAIL_NOVICE,
  696. PERF_COUNTER_RAWCOUNT,
  697. FIELDSIZE(WINSTATION_COUNTER_DATA, DDTotal.CacheReads),
  698. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDTotal.CacheReads),
  699. },
  700. { sizeof(PERF_COUNTER_DEFINITION),
  701. DDCACHEHIT,
  702. 0,
  703. DDCACHEHIT + 1,
  704. 0,
  705. TS_SCALE_FACTOR,
  706. PERF_DETAIL_NOVICE,
  707. PERF_COUNTER_RAWCOUNT,
  708. FIELDSIZE(WINSTATION_COUNTER_DATA, DDTotal.CacheHits),
  709. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDTotal.CacheHits),
  710. },
  711. { sizeof(PERF_COUNTER_DEFINITION),
  712. DDCACHEPERCENT,
  713. 0,
  714. DDCACHEPERCENT + 1,
  715. 0,
  716. 0, // No scaling
  717. PERF_DETAIL_NOVICE,
  718. PERF_COUNTER_TS_PERCENT,
  719. FIELDSIZE(WINSTATION_COUNTER_DATA, DDTotal.HitRatio),
  720. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDTotal.HitRatio),
  721. },
  722. // Bitmap cache
  723. { sizeof(PERF_COUNTER_DEFINITION),
  724. DDBITMAPCACHEREAD,
  725. 0,
  726. DDBITMAPCACHEREAD + 1,
  727. 0,
  728. TS_SCALE_FACTOR,
  729. PERF_DETAIL_NOVICE,
  730. PERF_COUNTER_RAWCOUNT,
  731. FIELDSIZE(WINSTATION_COUNTER_DATA, DDBitmap.CacheReads),
  732. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDBitmap.CacheReads),
  733. },
  734. { sizeof(PERF_COUNTER_DEFINITION),
  735. DDBITMAPCACHEHIT,
  736. 0,
  737. DDBITMAPCACHEHIT + 1,
  738. 0,
  739. TS_SCALE_FACTOR,
  740. PERF_DETAIL_NOVICE,
  741. PERF_COUNTER_RAWCOUNT,
  742. FIELDSIZE(WINSTATION_COUNTER_DATA, DDBitmap.CacheHits),
  743. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDBitmap.CacheHits),
  744. },
  745. { sizeof(PERF_COUNTER_DEFINITION),
  746. DDBITMAPCACHEPERCENT,
  747. 0,
  748. DDBITMAPCACHEPERCENT + 1,
  749. 0,
  750. 0, // No scaling
  751. PERF_DETAIL_NOVICE,
  752. PERF_COUNTER_TS_PERCENT,
  753. FIELDSIZE(WINSTATION_COUNTER_DATA, DDBitmap.HitRatio),
  754. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDBitmap.HitRatio),
  755. },
  756. // Glyph cache
  757. { sizeof(PERF_COUNTER_DEFINITION),
  758. DDGLYPHCACHEREAD,
  759. 0,
  760. DDGLYPHCACHEREAD + 1,
  761. 0,
  762. TS_SCALE_FACTOR,
  763. PERF_DETAIL_NOVICE,
  764. PERF_COUNTER_RAWCOUNT,
  765. FIELDSIZE(WINSTATION_COUNTER_DATA, DDGlyph.CacheReads),
  766. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDGlyph.CacheReads),
  767. },
  768. { sizeof(PERF_COUNTER_DEFINITION),
  769. DDGLYPHCACHEHIT,
  770. 0,
  771. DDGLYPHCACHEHIT + 1,
  772. 0,
  773. TS_SCALE_FACTOR,
  774. PERF_DETAIL_NOVICE,
  775. PERF_COUNTER_RAWCOUNT,
  776. FIELDSIZE(WINSTATION_COUNTER_DATA, DDGlyph.CacheHits),
  777. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDGlyph.CacheHits),
  778. },
  779. { sizeof(PERF_COUNTER_DEFINITION),
  780. DDGLYPHCACHEPERCENT,
  781. 0,
  782. DDGLYPHCACHEPERCENT + 1,
  783. 0,
  784. 0, // No scaling
  785. PERF_DETAIL_NOVICE,
  786. PERF_COUNTER_TS_PERCENT,
  787. FIELDSIZE(WINSTATION_COUNTER_DATA, DDGlyph.HitRatio),
  788. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDGlyph.HitRatio),
  789. },
  790. // Brush cache
  791. { sizeof(PERF_COUNTER_DEFINITION),
  792. DDBRUSHCACHEREAD,
  793. 0,
  794. DDBRUSHCACHEREAD + 1,
  795. 0,
  796. TS_SCALE_FACTOR,
  797. PERF_DETAIL_NOVICE,
  798. PERF_COUNTER_RAWCOUNT,
  799. FIELDSIZE(WINSTATION_COUNTER_DATA, DDBrush.CacheReads),
  800. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDBrush.CacheReads),
  801. },
  802. { sizeof(PERF_COUNTER_DEFINITION),
  803. DDBRUSHCACHEHIT,
  804. 0,
  805. DDBRUSHCACHEHIT + 1,
  806. 0,
  807. TS_SCALE_FACTOR,
  808. PERF_DETAIL_NOVICE,
  809. PERF_COUNTER_RAWCOUNT,
  810. FIELDSIZE(WINSTATION_COUNTER_DATA, DDBrush.CacheHits),
  811. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDBrush.CacheHits),
  812. },
  813. { sizeof(PERF_COUNTER_DEFINITION),
  814. DDBRUSHCACHEPERCENT,
  815. 0,
  816. DDBRUSHCACHEPERCENT + 1,
  817. 0,
  818. 0, // No scaling
  819. PERF_DETAIL_NOVICE,
  820. PERF_COUNTER_TS_PERCENT,
  821. FIELDSIZE(WINSTATION_COUNTER_DATA, DDBrush.HitRatio),
  822. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDBrush.HitRatio),
  823. },
  824. // Save screen bitmap cache
  825. { sizeof(PERF_COUNTER_DEFINITION),
  826. DDSAVESCRCACHEREAD,
  827. 0,
  828. DDSAVESCRCACHEREAD + 1,
  829. 0,
  830. TS_SCALE_FACTOR,
  831. PERF_DETAIL_NOVICE,
  832. PERF_COUNTER_RAWCOUNT,
  833. FIELDSIZE(WINSTATION_COUNTER_DATA, DDSaveScr.CacheReads),
  834. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDSaveScr.CacheReads),
  835. },
  836. { sizeof(PERF_COUNTER_DEFINITION),
  837. DDSAVESCRCACHEHIT,
  838. 0,
  839. DDSAVESCRCACHEHIT + 1,
  840. 0,
  841. TS_SCALE_FACTOR,
  842. PERF_DETAIL_NOVICE,
  843. PERF_COUNTER_RAWCOUNT,
  844. FIELDSIZE(WINSTATION_COUNTER_DATA, DDSaveScr.CacheHits),
  845. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDSaveScr.CacheHits),
  846. },
  847. { sizeof(PERF_COUNTER_DEFINITION),
  848. DDSAVESCRCACHEPERCENT,
  849. 0,
  850. DDSAVESCRCACHEPERCENT + 1,
  851. 0,
  852. 0, // No scaling
  853. PERF_DETAIL_NOVICE,
  854. PERF_COUNTER_TS_PERCENT,
  855. FIELDSIZE(WINSTATION_COUNTER_DATA, DDSaveScr.HitRatio),
  856. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, DDSaveScr.HitRatio),
  857. },
  858. // Compression ratios
  859. { sizeof(PERF_COUNTER_DEFINITION),
  860. INCOMPRESS_PERCENT,
  861. 0,
  862. INCOMPRESS_PERCENT + 1,
  863. 0,
  864. 0, // No scaling
  865. PERF_DETAIL_NOVICE,
  866. PERF_COUNTER_TS_PERCENT,
  867. FIELDSIZE(WINSTATION_COUNTER_DATA, InputCompressionRatio),
  868. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, InputCompressionRatio),
  869. },
  870. { sizeof(PERF_COUNTER_DEFINITION),
  871. OUTCOMPRESS_PERCENT,
  872. 0,
  873. OUTCOMPRESS_PERCENT + 1,
  874. 0,
  875. 0, // No scaling
  876. PERF_DETAIL_NOVICE,
  877. PERF_COUNTER_TS_PERCENT,
  878. FIELDSIZE(WINSTATION_COUNTER_DATA, OutputCompressionRatio),
  879. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, OutputCompressionRatio),
  880. },
  881. { sizeof(PERF_COUNTER_DEFINITION),
  882. TOTALCOMPRESS_PERCENT,
  883. 0,
  884. TOTALCOMPRESS_PERCENT + 1,
  885. 0,
  886. 0, // No scaling
  887. PERF_DETAIL_NOVICE,
  888. PERF_COUNTER_TS_PERCENT,
  889. FIELDSIZE(WINSTATION_COUNTER_DATA, TotalCompressionRatio),
  890. (DWORD)FIELDOFFSET(WINSTATION_COUNTER_DATA, TotalCompressionRatio),
  891. },
  892. };
  893. // Counter descriptions for overall data.
  894. TERMSERVER_DATA_DEFINITION TermServerDataDefinition =
  895. {
  896. { sizeof(TERMSERVER_DATA_DEFINITION) + sizeof(TERMSERVER_COUNTER_DATA),
  897. sizeof(TERMSERVER_DATA_DEFINITION),
  898. sizeof(PERF_OBJECT_TYPE),
  899. TERMSERVER_OBJECT,
  900. 0,
  901. TERMSERVER_OBJECT + 1,
  902. 0,
  903. PERF_DETAIL_NOVICE,
  904. (sizeof(TERMSERVER_DATA_DEFINITION) - sizeof(PERF_OBJECT_TYPE)) /
  905. sizeof(PERF_COUNTER_DEFINITION),
  906. 0,
  907. -1, // No instances
  908. UNICODE_CODE_PAGE,
  909. {0L,0L},
  910. {10000000L,0L}
  911. },
  912. { sizeof(PERF_COUNTER_DEFINITION),
  913. NUMSESSIONS,
  914. 0,
  915. NUMSESSIONS + 1,
  916. 0,
  917. 0, // No scaling
  918. PERF_DETAIL_NOVICE,
  919. PERF_COUNTER_RAWCOUNT,
  920. FIELDSIZE(TERMSERVER_COUNTER_DATA, NumSessions),
  921. (DWORD)FIELDOFFSET(TERMSERVER_COUNTER_DATA, NumSessions),
  922. },
  923. { sizeof(PERF_COUNTER_DEFINITION),
  924. NUMACTIVESESSIONS,
  925. 0,
  926. NUMACTIVESESSIONS + 1,
  927. 0,
  928. 0, // No scaling
  929. PERF_DETAIL_NOVICE,
  930. PERF_COUNTER_RAWCOUNT,
  931. FIELDSIZE(TERMSERVER_COUNTER_DATA, NumActiveSessions),
  932. (DWORD)FIELDOFFSET(TERMSERVER_COUNTER_DATA, NumActiveSessions),
  933. },
  934. { sizeof(PERF_COUNTER_DEFINITION),
  935. NUMINACTIVESESSIONS,
  936. 0,
  937. NUMINACTIVESESSIONS + 1,
  938. 0,
  939. 0, // No scaling
  940. PERF_DETAIL_NOVICE,
  941. PERF_COUNTER_RAWCOUNT,
  942. FIELDSIZE(TERMSERVER_COUNTER_DATA, NumInactiveSessions),
  943. (DWORD)FIELDOFFSET(TERMSERVER_COUNTER_DATA, NumInactiveSessions),
  944. },
  945. };