CMS 3D CMS Logo

SMPerformanceMeter.h

Go to the documentation of this file.
00001 #ifndef EVFSM_SMPerformanceMeter_h_
00002 #define EVFSM_SMPerformanceMeter_h_
00003 /*
00004      Header file for performance statistics for
00005      Storage Manager and SMProxyServer.
00006 
00007      $Id: SMPerformanceMeter.h,v 1.6 2008/10/13 13:05:36 hcheung Exp $
00008 */
00009 
00010 #include <string>
00011 
00012 #include "toolbox/string.h"
00013 
00014 #include "boost/shared_ptr.hpp"
00015 #include "boost/thread/thread.hpp"
00016 #include "EventFilter/StorageManager/interface/ForeverCounter.h"
00017 #include "EventFilter/StorageManager/interface/RollingSampleCounter.h"
00018 #include "EventFilter/StorageManager/interface/RollingIntervalCounter.h"
00019 
00020 namespace stor {
00021 
00022   struct SMPerfStats
00023   {
00024     SMPerfStats();
00025     public:
00026     void reset();
00027     void fullReset();
00028     unsigned long samples_;
00029     unsigned long period4samples_;
00030     boost::shared_ptr<ForeverCounter> longTermCounter_;
00031     boost::shared_ptr<RollingSampleCounter> shortTermCounter_;
00032     boost::shared_ptr<RollingIntervalCounter> shortPeriodCounter_;
00033     // for sample based statistics
00034     double maxBandwidth_;
00035     double minBandwidth_;
00036     // for time period based statistics
00037     double maxBandwidth2_;
00038     double minBandwidth2_;
00039   };
00040 
00041   struct SMOnlyStats
00042   {
00043     SMOnlyStats();
00044     public:
00045     unsigned long samples_;
00046     unsigned long period4samples_;
00047     // for sample based statistics
00048     double instantBandwidth_;
00049     double instantRate_;
00050     double instantLatency_;
00051     double totalSamples_;
00052     double duration_;
00053     double meanBandwidth_;
00054     double meanRate_;
00055     double meanLatency_;
00056     double maxBandwidth_;
00057     double minBandwidth_;
00058 
00059     // for time period based statistics
00060     double instantBandwidth2_;
00061     double instantRate2_;
00062     double instantLatency2_;
00063     double totalSamples2_;
00064     double duration2_;
00065     double meanBandwidth2_;
00066     double meanRate2_;
00067     double meanLatency2_;
00068     double maxBandwidth2_;
00069     double minBandwidth2_;
00070 
00071     double receivedVolume_;
00072   };
00073 
00074   class SMPerformanceMeter 
00075   {
00076     public:
00077 
00078     SMPerformanceMeter();
00079 
00080     virtual ~SMPerformanceMeter(){}
00081 
00082     void init(unsigned long samples, unsigned long time_period);
00083     bool addSample(unsigned long size);
00084     void setSamples(unsigned long num_samples);
00085     void setPeriod4Samples(unsigned long time_period);
00086     unsigned long getSetSamples() { return stats_.samples_; }
00087     unsigned long getPeriod4Samples() { return stats_.period4samples_; }
00088   
00089     SMPerfStats getStats();
00090     unsigned long samples();
00091     double totalvolumemb();
00092 
00093     protected:
00094 
00095     unsigned long loopCounter_;
00096     SMPerfStats stats_;
00097 
00098     boost::mutex data_lock_;
00099   }; //end class
00100 
00101 } // end namespace stor
00102 
00103 #endif

Generated on Tue Jun 9 17:34:55 2009 for CMSSW by  doxygen 1.5.4