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.

374 lines
8.1 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. stats.c
  5. Abstract:
  6. Implements the stats command.
  7. Author:
  8. Keith Moore (keithmo) 06-May-1996
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "afdkdp.h"
  14. #pragma hdrstop
  15. //
  16. // Public functions.
  17. //
  18. DECLARE_API( stats )
  19. /*++
  20. Routine Description:
  21. Dumps the debug-only AFD statistic counters.
  22. Arguments:
  23. None.
  24. Return Value:
  25. None.
  26. --*/
  27. {
  28. AFD_QUOTA_STATS quotaStats;
  29. AFD_HANDLE_STATS handleStats;
  30. AFD_QUEUE_STATS queueStats;
  31. AFD_CONNECTION_STATS connectionStats;
  32. ULONG64 address;
  33. ULONG result;
  34. gClient = pClient;
  35. if (!CheckKmGlobals ()) {
  36. return E_INVALIDARG;
  37. }
  38. //
  39. // Dump the quota statistics.
  40. //
  41. address = GetExpression( "afd!AfdQuotaStats" );
  42. if( address == 0 ) {
  43. dprintf( "\nstats: Could not find afd!AfdQuotaStats\n" );
  44. } else {
  45. if( ReadMemory(
  46. address,
  47. &quotaStats,
  48. sizeof(quotaStats),
  49. &result
  50. ) ) {
  51. dprintf(
  52. "AfdQuotaStats:\n"
  53. );
  54. dprintf(
  55. " Charged = %I64x\n",
  56. quotaStats.Charged.QuadPart
  57. );
  58. dprintf(
  59. " Returned = %I64x\n",
  60. quotaStats.Returned.QuadPart
  61. );
  62. dprintf( "\n" );
  63. } else {
  64. dprintf(
  65. "\nstats: Could not read afd!AfdQuotaStats @ %p\n",
  66. address
  67. );
  68. }
  69. }
  70. //
  71. // Dump the handle statistics.
  72. //
  73. address = GetExpression( "afd!AfdHandleStats" );
  74. if( address == 0 ) {
  75. dprintf( "stats: Could not find afd!AfdHandleStats\n" );
  76. } else {
  77. if( ReadMemory(
  78. address,
  79. &handleStats,
  80. sizeof(handleStats),
  81. &result
  82. ) ) {
  83. dprintf(
  84. "AfdHandleStats:\n"
  85. );
  86. dprintf(
  87. " AddrOpened = %lu\n",
  88. handleStats.AddrOpened
  89. );
  90. dprintf(
  91. " AddrClosed = %lu\n",
  92. handleStats.AddrClosed
  93. );
  94. dprintf(
  95. " AddrRef = %lu\n",
  96. handleStats.AddrRef
  97. );
  98. dprintf(
  99. " AddrDeref = %lu\n",
  100. handleStats.AddrDeref
  101. );
  102. dprintf(
  103. " ConnOpened = %lu\n",
  104. handleStats.ConnOpened
  105. );
  106. dprintf(
  107. " ConnClosed = %lu\n",
  108. handleStats.ConnClosed
  109. );
  110. dprintf(
  111. " ConnRef = %lu\n",
  112. handleStats.ConnRef
  113. );
  114. dprintf(
  115. " ConnDeref = %lu\n",
  116. handleStats.ConnDeref
  117. );
  118. dprintf(
  119. " FileRef = %lu\n",
  120. handleStats.FileRef
  121. );
  122. dprintf(
  123. " FileDeref = %lu\n",
  124. handleStats.FileDeref
  125. );
  126. dprintf( "\n" );
  127. } else {
  128. dprintf(
  129. "\nstats: Could not read afd!AfdHandleStats @ %p\n",
  130. address
  131. );
  132. }
  133. }
  134. //
  135. // Dump the queue statistics.
  136. //
  137. address = GetExpression( "afd!AfdQueueStats" );
  138. if( address == 0 ) {
  139. dprintf( "stats: Could not find afd!AfdQueueStats\n" );
  140. } else {
  141. if( ReadMemory(
  142. address,
  143. &queueStats,
  144. sizeof(queueStats),
  145. &result
  146. ) ) {
  147. dprintf(
  148. "AfdQueueStats:\n"
  149. );
  150. dprintf(
  151. " AfdWorkItemsQueued = %lu\n",
  152. queueStats.AfdWorkItemsQueued
  153. );
  154. dprintf(
  155. " ExWorkItemsQueued = %lu\n",
  156. queueStats.ExWorkItemsQueued
  157. );
  158. dprintf(
  159. " WorkerEnter = %lu\n",
  160. queueStats.WorkerEnter
  161. );
  162. dprintf(
  163. " WorkerLeave = %lu\n",
  164. queueStats.WorkerLeave
  165. );
  166. dprintf(
  167. " AfdWorkItemsProcessed = %lu\n",
  168. queueStats.AfdWorkItemsProcessed
  169. );
  170. dprintf(
  171. " AfdWorkerThread = %p\n",
  172. (ULONG64)queueStats.AfdWorkerThread
  173. );
  174. dprintf( "\n" );
  175. } else {
  176. dprintf(
  177. "\nstats: Could not read afd!AfdQueueStats @ %p\n",
  178. address
  179. );
  180. }
  181. }
  182. //
  183. // Dump the queue statistics.
  184. //
  185. address = GetExpression( "afd!AfdConnectionStats" );
  186. if( address == 0 ) {
  187. dprintf( "\nstats: Could not find afd!AfdConnectionStats\n" );
  188. } else {
  189. if( ReadMemory(
  190. address,
  191. &connectionStats,
  192. sizeof(connectionStats),
  193. &result
  194. ) ) {
  195. dprintf(
  196. "AfdConnectionStats:\n"
  197. );
  198. dprintf(
  199. " ConnectedReferencesAdded = %lu\n",
  200. connectionStats.ConnectedReferencesAdded
  201. );
  202. dprintf(
  203. " ConnectedReferencesDeleted = %lu\n",
  204. connectionStats.ConnectedReferencesDeleted
  205. );
  206. dprintf(
  207. " GracefulDisconnectsInitiated = %lu\n",
  208. connectionStats.GracefulDisconnectsInitiated
  209. );
  210. dprintf(
  211. " GracefulDisconnectsCompleted = %lu\n",
  212. connectionStats.GracefulDisconnectsCompleted
  213. );
  214. dprintf(
  215. " GracefulDisconnectIndications = %lu\n",
  216. connectionStats.GracefulDisconnectIndications
  217. );
  218. dprintf(
  219. " AbortiveDisconnectsInitiated = %lu\n",
  220. connectionStats.AbortiveDisconnectsInitiated
  221. );
  222. dprintf(
  223. " AbortiveDisconnectsCompleted = %lu\n",
  224. connectionStats.AbortiveDisconnectsCompleted
  225. );
  226. dprintf(
  227. " AbortiveDisconnectIndications = %lu\n",
  228. connectionStats.AbortiveDisconnectIndications
  229. );
  230. dprintf(
  231. " ConnectionIndications = %lu\n",
  232. connectionStats.ConnectionIndications
  233. );
  234. dprintf(
  235. " ConnectionsDropped = %lu\n",
  236. connectionStats.ConnectionsDropped
  237. );
  238. dprintf(
  239. " ConnectionsAccepted = %lu\n",
  240. connectionStats.ConnectionsAccepted
  241. );
  242. dprintf(
  243. " ConnectionsPreaccepted = %lu\n",
  244. connectionStats.ConnectionsPreaccepted
  245. );
  246. dprintf(
  247. " ConnectionsReused = %lu\n",
  248. connectionStats.ConnectionsReused
  249. );
  250. dprintf(
  251. " EndpointsReused = %lu\n",
  252. connectionStats.EndpointsReused
  253. );
  254. dprintf( "\n" );
  255. } else {
  256. dprintf(
  257. "\nstats: Could not read afd!AfdConnectionStats @ %p\n",
  258. address
  259. );
  260. }
  261. }
  262. return S_OK;
  263. } // stats