CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/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   amount_square;
00016     int64_t  vector_count;
00017     int64_t  vector_square;
00018     double   timeTotal;
00019     double   timeMin;
00020     double   timeMax;
00021   };
00022 
00023   class Stamp {
00024   public:
00025     Stamp (Counter &counter);
00026 
00027     void     tick (double amount = 0., int64_t tick = 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 void                fillSummary(std::map<std::string, std::string> &summary);
00040   static Counter&            counter (const std::string &storageClass,
00041                                       const std::string &operation);
00042 };
00043 
00044 #endif // STORAGE_FACTORY_STORAGE_ACCOUNT_H