CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Utilities/StorageFactory/interface/StorageAccount.h

Go to the documentation of this file.
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 public:
00011   struct Counter {
00012     uint64_t attempts;
00013     uint64_t successes;
00014     double   amount;
00015     double   timeTotal;
00016     double   timeMin;
00017     double   timeMax;
00018   };
00019 
00020   class Stamp {
00021   public:
00022     Stamp (Counter &counter);
00023 
00024     void     tick (double amount = 0.) const;
00025   protected:
00026     Counter &m_counter;
00027     double   m_start;
00028   };
00029 
00030   typedef std::map<std::string, Counter> OperationStats;
00031   typedef std::map<std::string, boost::shared_ptr<OperationStats> > StorageStats;
00032 
00033   static const StorageStats& summary(void);
00034   static std::string         summaryXML(void);
00035   static std::string         summaryText(bool banner=false);
00036   static void                fillSummary(std::map<std::string, std::string> &summary);
00037   static Counter&            counter (const std::string &storageClass,
00038                                       const std::string &operation);
00039 };
00040 
00041 #endif // STORAGE_FACTORY_STORAGE_ACCOUNT_H