Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:48:00

0001 #ifndef FWCore_Utilities_TimingServiceBase_h
0002 #define FWCore_Utilities_TimingServiceBase_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Utilities
0006 // Class  :     TimingServiceBase
0007 //
0008 /**\class TimingServiceBase TimingServiceBase.h "TimingServiceBase.h"
0009 
0010  Description: Base class for Timing Services
0011 
0012  Usage:
0013     Provides an interface to allow
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Wed, 11 Jun 2014 14:50:33 GMT
0019 //
0020 
0021 // system include files
0022 #include <chrono>
0023 
0024 // user include files
0025 #include "FWCore/Utilities/interface/StreamID.h"
0026 
0027 // forward declarations
0028 namespace edm {
0029   class TimingServiceBase {
0030   public:
0031     TimingServiceBase();
0032     TimingServiceBase(const TimingServiceBase&) = delete;                   // stop default
0033     const TimingServiceBase& operator=(const TimingServiceBase&) = delete;  // stop default
0034     virtual ~TimingServiceBase();
0035 
0036     // ---------- member functions ---------------------------
0037     ///Extra CPU time used by a job but not seen by cmsRun
0038     /// The value should be in seconds.
0039     /// This function is safe to call from multiple threads
0040     virtual void addToCPUTime(double iTime) = 0;
0041 
0042     ///CPU time used by this process and all its children.
0043     /// The value returned should be in seconds.
0044     virtual double getTotalCPU() const = 0;
0045 
0046     static void jobStarted();
0047 
0048     static std::chrono::steady_clock::time_point jobStartTime() { return s_jobStartTime; }
0049 
0050   private:
0051     static std::chrono::steady_clock::time_point s_jobStartTime;
0052   };
0053 }  // namespace edm
0054 
0055 #endif