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.

128 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name :
  4. stats.cxx
  5. Abstract:
  6. Defines functions required for server statistics
  7. Author:
  8. Murali R. Krishnan ( MuraliK ) 04-Nov-1994
  9. Project:
  10. Web Server DLL
  11. Functions Exported:
  12. W3_SERVER_STATISTICS::SERVER_STATISTICS( VOID)
  13. VOID W3_SERVER_STATISTICS::ClearStatistics( VOID)
  14. DWORD CopyToStatsBuffer( LPW3_STATISTICS_1 lpStat)
  15. Revision History:
  16. Sophia Chung ( SophiaC ) 20-Nov-1996
  17. --*/
  18. /************************************************************
  19. * Include Headers
  20. ************************************************************/
  21. # include <w3p.hxx>
  22. # include "stats.hxx"
  23. # include "timer.h"
  24. # include "time.h"
  25. /************************************************************
  26. * Functions
  27. ************************************************************/
  28. W3_SERVER_STATISTICS::W3_SERVER_STATISTICS( VOID)
  29. /*++
  30. Initializes statistics information for server.
  31. --*/
  32. {
  33. INITIALIZE_CRITICAL_SECTION( & m_csStatsLock);
  34. ClearStatistics();
  35. } // W3_SERVER_STATISTICS::W3_SERVER_STATISTICS();
  36. VOID
  37. W3_SERVER_STATISTICS::ClearStatistics( VOID)
  38. /*++
  39. Clears the counters used for statistics information
  40. --*/
  41. {
  42. LockStatistics();
  43. memset( &m_W3Stats, 0, sizeof(W3_STATISTICS_1) );
  44. m_W3Stats.TimeOfLastClear = GetCurrentTimeInSeconds();
  45. UnlockStatistics();
  46. } // W3_SERVER_STATISTICS::ClearStatistics()
  47. DWORD
  48. W3_SERVER_STATISTICS::CopyToStatsBuffer( LPW3_STATISTICS_1 lpStat)
  49. /*++
  50. Description:
  51. copies the statistics data from the server statistcs structure
  52. to the W3_STATISTICS_1 structure for RPC access.
  53. Arugments:
  54. lpStat pointer to W3_STATISTICS_1 object which contains the
  55. data on successful return
  56. Returns:
  57. Win32 error codes. NO_ERROR on success.
  58. --*/
  59. {
  60. DBG_ASSERT( lpStat != NULL);
  61. LockStatistics();
  62. CopyMemory( lpStat, &m_W3Stats, sizeof(W3_STATISTICS_1) );
  63. UnlockStatistics();
  64. if (lpStat->ServiceUptime)
  65. {
  66. lpStat->ServiceUptime = GetCurrentTimeInSeconds() - lpStat->ServiceUptime;
  67. }
  68. return ( NO_ERROR);
  69. } // CopyToStatsBuffer()
  70. VOID
  71. W3_SERVER_STATISTICS::UpdateStartTime ()
  72. {
  73. m_W3Stats.ServiceUptime = GetCurrentTimeInSeconds();
  74. }
  75. VOID
  76. W3_SERVER_STATISTICS::UpdateStopTime ()
  77. {
  78. m_W3Stats.ServiceUptime = 0;
  79. }
  80. /************************ End of File ***********************/