00001 #ifndef STORAGE_FACTORY_STORAGE_ACCOUNT_H 00002 # define STORAGE_FACTORY_STORAGE_ACCOUNT_H 00003 00004 # include <boost/shared_ptr.hpp> 00005 # include <stdint.h> 00006 # include <string> 00007 # include <map> 00008 00009 class StorageAccount 00010 { 00011 public: 00012 struct Counter 00013 { 00014 uint64_t attempts; 00015 uint64_t successes; 00016 double amount; 00017 double timeTotal; 00018 double timeMin; 00019 double timeMax; 00020 }; 00021 00022 class Stamp 00023 { 00024 public: 00025 Stamp (Counter &counter); 00026 00027 void tick (double amount = 0.) const; 00028 protected: 00029 Counter &m_counter; 00030 double m_start; 00031 }; 00032 00033 typedef std::map<std::string, Counter> OperationStats; 00034 typedef std::map<std::string, boost::shared_ptr<OperationStats> > StorageStats; 00035 00036 static const StorageStats & summary (void); 00037 static std::string summaryXML (void); 00038 static std::string summaryText (bool banner=false); 00039 static Counter & counter (const std::string &storageClass, 00040 const std::string &operation); 00041 }; 00042 00043 #endif // STORAGE_FACTORY_STORAGE_ACCOUNT_H