00001 // service_stats.h 00002 00019 #ifndef DB_STATS_SERVICE_STATS_HEADER 00020 #define DB_STATS_SERVICE_STATS_HEADER 00021 00022 #include <string> 00023 00024 #include "../../util/concurrency/spin_lock.h" 00025 00026 namespace mongo { 00027 00028 using std::string; 00029 00030 class Histogram; 00031 00037 class ServiceStats { 00038 public: 00039 ServiceStats(); 00040 ~ServiceStats(); 00041 00047 void logResponse( uint64_t duration, uint64_t bytes ); 00048 00053 string toHTML() const; 00054 00055 private: 00056 SpinLock _spinLock; // protects state below 00057 Histogram* _timeHistogram; 00058 Histogram* _spaceHistogram; 00059 00060 ServiceStats( const ServiceStats& ); 00061 ServiceStats operator=( const ServiceStats& ); 00062 }; 00063 00064 } // namespace mongo 00065 00066 #endif // DB_STATS_SERVICE_STATS_HEADER