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.

140 lines
4.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. stats.c
  7. This module implements the "stats" command of the W3 Server
  8. debugger extension DLL.
  9. FILE HISTORY:
  10. KeithMo 13-Jun-1993 Created.
  11. */
  12. #include "w3dbg.h"
  13. #include <time.h>
  14. /*******************************************************************
  15. NAME: stats
  16. SYNOPSIS: Displays the server statistics.
  17. ENTRY: hCurrentProcess - Handle to the current process.
  18. hCurrentThread - Handle to the current thread.
  19. dwCurrentPc - The current program counter
  20. (EIP for x86, FIR for MIPS).
  21. lpExtensionApis - Points to a structure containing
  22. pointers to the debugger functions
  23. that the command may invoke.
  24. lpArgumentString - Points to any arguments passed
  25. to the command.
  26. HISTORY:
  27. KeithMo 13-Jun-1993 Created.
  28. ********************************************************************/
  29. VOID stats( HANDLE hCurrentProcess,
  30. HANDLE hCurrentThread,
  31. DWORD dwCurrentPc,
  32. LPVOID lpExtensionApis,
  33. LPSTR lpArgumentString )
  34. {
  35. W3_STATISTICS_0 W3Stats;
  36. CHAR szLargeInt[64];
  37. LPVOID pstats;
  38. //
  39. // Grab the debugger entrypoints.
  40. //
  41. GrabDebugApis( lpExtensionApis );
  42. //
  43. // Capture the statistics.
  44. //
  45. pstats = (LPVOID)DebugEval( "W3Stats" );
  46. if( pstats == NULL )
  47. {
  48. DebugPrint( "cannot locate W3Stats\n" );
  49. return;
  50. }
  51. ReadProcessMemory( hCurrentProcess,
  52. pstats,
  53. (LPVOID)&W3Stats,
  54. sizeof(W3Stats),
  55. (LPDWORD)NULL );
  56. //
  57. // Dump the statistics.
  58. //
  59. RtlLargeIntegerToChar( &W3Stats.TotalBytesSent,
  60. 10,
  61. sizeof(szLargeInt),
  62. szLargeInt );
  63. DebugPrint( "TotalBytesSent = %s\n",
  64. szLargeInt );
  65. RtlLargeIntegerToChar( &W3Stats.TotalBytesReceived,
  66. 10,
  67. sizeof(szLargeInt),
  68. szLargeInt );
  69. DebugPrint( "TotalBytesReceived = %s\n",
  70. szLargeInt );
  71. DebugPrint( "TotalFilesSent = %lu\n",
  72. W3Stats.TotalFilesSent );
  73. DebugPrint( "TotalFilesReceived = %lu\n",
  74. W3Stats.TotalFilesReceived );
  75. DebugPrint( "CurrentAnonymousUsers = %lu\n",
  76. W3Stats.CurrentAnonymousUsers );
  77. DebugPrint( "CurrentNonAnonymousUsers = %lu\n",
  78. W3Stats.CurrentNonAnonymousUsers );
  79. DebugPrint( "TotalAnonymousUsers = %lu\n",
  80. W3Stats.TotalAnonymousUsers );
  81. DebugPrint( "TotalNonAnonymousUsers = %lu\n",
  82. W3Stats.TotalNonAnonymousUsers );
  83. DebugPrint( "MaxAnonymousUsers = %lu\n",
  84. W3Stats.MaxAnonymousUsers );
  85. DebugPrint( "MaxNonAnonymousUsers = %lu\n",
  86. W3Stats.MaxNonAnonymousUsers );
  87. DebugPrint( "CurrentConnections = %lu\n",
  88. W3Stats.CurrentConnections );
  89. DebugPrint( "MaxConnections = %lu\n",
  90. W3Stats.MaxConnections );
  91. DebugPrint( "ConnectionAttempts = %lu\n",
  92. W3Stats.ConnectionAttempts );
  93. DebugPrint( "LogonAttempts = %lu\n",
  94. W3Stats.LogonAttempts );
  95. DebugPrint( "TimeOfLastClear = %s\n",
  96. asctime( localtime( (time_t *)&W3Stats.TimeOfLastClear ) ) );
  97. } // stats