| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

ChronoEntity.h

Go to the documentation of this file.
00001 // $Id: ChronoEntity.h,v 1.2 2008/05/13 12:36:54 marcocle Exp $
00002 // ============================================================================ 
00003 #ifndef GAUDIKERNEL_CHRONOENTITY_H
00004 #define GAUDIKERNEL_CHRONOENTITY_H 1 
00005 // ============================================================================ 
00006 // Include files 
00007 // ============================================================================
00008 // GaudiKernel 
00009 // ============================================================================
00010 #include "GaudiKernel/IChronoSvc.h" 
00011 #include "GaudiKernel/StatEntity.h" 
00012 #include "GaudiKernel/Timing.h" 
00013 // ============================================================================
00023 class ChronoEntity 
00024 {
00025 public:
00027   ChronoEntity();
00029   ~ChronoEntity(){};
00031 public: 
00032   // ==========================================================================
00033   // The basic Chrono Operations 
00034   // ==========================================================================
00036   IChronoSvc::ChronoStatus        start() ;
00038   IChronoSvc::ChronoStatus        stop () ;
00039   // ==========================================================================
00041   inline IChronoSvc::ChronoTime   delta ( IChronoSvc::ChronoType type ) const ;
00043   inline IChronoSvc::ChronoStatus status() const ;
00044   // ==========================================================================
00045 public:
00046   // ==========================================================
00047   // Access to Chrono Statistics 
00048   // ==========================================================
00050   inline unsigned long nOfMeasurements   () const ; 
00051   // ==========================================================
00053   inline double uMinimalTime   () const ;
00055   inline double kMinimalTime   () const ;
00057   inline double eMinimalTime   () const ;
00059   inline double uMaximalTime   () const ;
00061   inline double kMaximalTime   () const ; 
00063   inline double eMaximalTime   () const ;
00065   inline double uTotalTime     () const ;
00067   inline double kTotalTime     () const ;
00069   inline double eTotalTime     () const ;
00071   inline double totalTime      () const ;
00073   inline double kMeanTime      () const ;
00075   inline double uMeanTime      () const ;
00077   inline double eMeanTime      () const ;
00079   inline double kRMSTime       () const ;
00081   inline double uRMSTime       () const ;
00083   inline double eRMSTime       () const ;
00085   inline double kMeanErrorTime () const ;
00087   inline double uMeanErrorTime () const ;
00089   inline double eMeanErrorTime () const ;
00090   // ==========================================================================
00091 public:
00092   // ==========================================================================
00094   bool operator<( const ChronoEntity& entity ) const;
00095   // ==========================================================================
00096 public:
00097   // ==========================================================================
00099   std::string outputUserTime     () const ; 
00101   std::string outputSystemTime   () const ; 
00103   std::string outputElapsedTime  () const ;
00104   // ==========================================================================
00105 public:
00106   // ==========================================================================
00113   inline std::string outputUserTime     
00114   ( const std::string& fmt  , 
00115     System::TimeType   unit ) const ; 
00122   inline std::string outputSystemTime
00123   ( const std::string& fmt  , 
00124     System::TimeType   unit ) const ; 
00131   inline std::string outputElapsedTime 
00132   ( const std::string& fmt  , 
00133     System::TimeType   unit ) const ; 
00134   // ==========================================================================
00153   std::string outputTime 
00154   ( IChronoSvc::ChronoType typ  , 
00155     const std::string&     fmt  , 
00156     System::TimeType       unit ) const ; 
00157   // ==========================================================================
00158 protected:
00159   // ==========================================================================
00161   std::string format 
00162   ( const double        total     ,
00163     const double        minimal   ,
00164     const double        mean      ,
00165     const double        rms       ,
00166     const double        maximal   ,
00167     const unsigned long number    ) const ;
00168   // ==========================================================================
00169 private:
00170   // ==========================================================================
00172   IChronoSvc::ChronoStatus m_status ;
00174   IChronoSvc::ChronoTime   m_delta_user    ; // delta user time
00176   IChronoSvc::ChronoTime   m_delta_kernel  ; // delta Kernel time
00178   IChronoSvc::ChronoTime   m_delta_elapsed ; // delta Elapsed time
00180   IChronoSvc::ChronoTime   m_start_user    ;
00182   IChronoSvc::ChronoTime   m_start_kernel  ;
00184   IChronoSvc::ChronoTime   m_start_elapsed ;
00186   StatEntity m_user    ; // the actual storage of "user" time 
00188   StatEntity m_kernel  ; // the actual storage of "kernel" time 
00190   StatEntity m_elapsed ; // the actual storage of "elapsed" time 
00191   // ==========================================================================
00192 };
00193 // ============================================================================
00194 // return the status of chronoi
00195 // ============================================================================
00196 inline IChronoSvc::ChronoStatus 
00197 ChronoEntity::status() const { return m_status; }
00198 // ============================================================================
00199 // number of chrono measurements
00200 // ============================================================================
00201 inline unsigned long 
00202 ChronoEntity::nOfMeasurements   () const { return m_user   . nEntries() ; }
00203 // ============================================================================
00204 // minimal measurement for user time
00205 // ============================================================================
00206 inline double ChronoEntity::uMinimalTime      () const 
00207 { return m_user   . flagMin () ; }
00208 // ============================================================================
00209 // minimal measurement for kernel time
00210 // ============================================================================
00211 inline double 
00212 ChronoEntity::kMinimalTime      () const { return m_kernel . flagMin () ; }
00213 // ============================================================================
00214 // minimal measurement for ellapsed time
00215 // ============================================================================
00216 inline double 
00217 ChronoEntity::eMinimalTime      () const { return m_elapsed. flagMin () ; }
00218 // ============================================================================
00219 // maximal measurement for user time
00220 // ============================================================================
00221 inline double 
00222 ChronoEntity::uMaximalTime      () const { return m_user   . flagMax () ; }
00223 // ============================================================================
00224 // maximal measurement for kernel time
00225 // ============================================================================
00226 inline double 
00227 ChronoEntity::kMaximalTime      () const { return m_kernel . flagMax () ; }
00228 // ============================================================================
00229 // maximal measurement for ellapsed time
00230 // ============================================================================
00231 inline double
00232 ChronoEntity::eMaximalTime      () const { return m_elapsed . flagMax () ; }
00233 // ============================================================================
00234 // total user time
00235 // ============================================================================
00236 inline double
00237 ChronoEntity::uTotalTime        () const { return m_user    . flag () ; }
00238 // ============================================================================
00239 // total Kernel time
00240 // ============================================================================
00241 inline double          
00242 ChronoEntity::kTotalTime        () const { return m_kernel  . flag () ; }
00243 // ============================================================================
00244 // total Elapsed time
00245 // ============================================================================
00246 inline double 
00247 ChronoEntity::eTotalTime        () const { return m_elapsed . flag () ; }
00248 // ============================================================================
00249 // total time
00250 // ============================================================================
00251 inline double          
00252 ChronoEntity::totalTime         () const 
00253 { return uTotalTime() + kTotalTime()  ; }
00254 // ============================================================================
00255 // average Kernel Time
00256 // ============================================================================
00257 inline double 
00258 ChronoEntity::kMeanTime      () const { return m_kernel  . flagMean () ; }
00259 // ============================================================================
00260 // average User   Time
00261 // ============================================================================
00262 inline double 
00263 ChronoEntity::uMeanTime      () const { return m_user    . flagMean () ; }
00264 // ============================================================================
00265 // average Elapsed   Time
00266 // ============================================================================
00267 inline double 
00268 ChronoEntity::eMeanTime      () const { return m_elapsed . flagMean () ; }
00269 // ============================================================================
00270 // r.m.s Kernel Time
00271 // ============================================================================
00272 inline double 
00273 ChronoEntity::kRMSTime       () const { return m_kernel  . flagRMS  () ; }
00274 // ============================================================================
00275 // r.m.s User Time
00276 // ============================================================================
00277 inline double 
00278 ChronoEntity::uRMSTime       () const { return m_user    . flagRMS  () ; }
00279 // ============================================================================
00280 // r.m.s Elapsed Time
00281 // ============================================================================
00282 inline double 
00283 ChronoEntity::eRMSTime       () const { return m_elapsed . flagRMS () ; }
00284 // ============================================================================
00285 // error in mean Kernel time
00286 // ============================================================================
00287 inline double 
00288 ChronoEntity::kMeanErrorTime () const { return m_kernel  . flagMeanErr () ; }
00289 // ============================================================================
00290 // error in mean User   time
00291 // ============================================================================
00292 inline double 
00293 ChronoEntity::uMeanErrorTime () const { return m_user    . flagMeanErr () ; }
00294 // ============================================================================
00295 // error in mean Elapsed   time
00296 // ============================================================================
00297 inline double 
00298 ChronoEntity::eMeanErrorTime () const { return m_elapsed . flagMeanErr () ; }
00299 // ============================================================================
00300 // return the last delta-time of type "type"
00301 // ============================================================================
00302 inline IChronoSvc::ChronoTime   
00303 ChronoEntity::delta ( IChronoSvc::ChronoType type ) const 
00304 {
00305   const IChronoSvc::ChronoTime result = -1 ;
00306   switch ( type ) 
00307   {
00308   case IChronoSvc::USER    : return m_delta_user    ;
00309   case IChronoSvc::KERNEL  : return m_delta_kernel  ;
00310   case IChronoSvc::ELAPSED : return m_delta_elapsed ;
00311   default                  : return result          ;
00312   }
00313   return result;
00314 }
00315 // ============================================================================
00316 /*  print the chrono according the format and units 
00317  *  @param fmt  the format string 
00318  *  @param unit the unit
00319  *  @return the string representations 
00320  *  @see boost::format
00321  */
00322 // ============================================================================
00323 inline std::string 
00324 ChronoEntity::outputUserTime     
00325 ( const std::string& fmt  , 
00326   System::TimeType   unit ) const 
00327 {
00328   return outputTime ( IChronoSvc::USER , fmt , unit ) ;
00329 }
00330 // ============================================================================
00331 /*  print the chrono according the format and units 
00332  *  @param fmt  the format string 
00333  *  @param unit the unit
00334  *  @return the string representations 
00335  *  @see boost::format
00336  */
00337 // ============================================================================
00338 inline std::string
00339 ChronoEntity::outputSystemTime
00340 ( const std::string& fmt  , 
00341   System::TimeType   unit ) const 
00342 {
00343   return outputTime ( IChronoSvc::KERNEL , fmt , unit ) ;
00344 }  
00345 // ============================================================================
00346 /*  print the chrono according the format and units 
00347  *  @param fmt  the format string 
00348  *  @param unit the unit
00349  *  @return the string representations 
00350  *  @see boost::format
00351  */
00352 // ============================================================================
00353 inline std::string 
00354 ChronoEntity::outputElapsedTime 
00355 ( const std::string& fmt  , 
00356   System::TimeType   unit ) const 
00357 {
00358   return outputTime ( IChronoSvc::ELAPSED , fmt , unit ) ;
00359 }  
00360 // ============================================================================
00361 // The END 
00362 // ============================================================================
00363 #endif  //  GAUDIKERNEL_CHRONOENTITY_H
00364 // ============================================================================
00365 
00366 
00367 
00368 
00369 
00370 
00371 
00372 
00373 
00374 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:56:57 2011 for GaudiKernel by doxygen 1.4.7