TimingServiceBase

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#ifndef FWCore_AbstractServices_interface_TimingServiceBase_h
#define FWCore_AbstractServices_interface_TimingServiceBase_h
// -*- C++ -*-
//
// Package:     FWCore/AbstractServices
// Class  :     TimingServiceBase
//
/**\class TimingServiceBase TimingServiceBase.h "TimingServiceBase.h"

 Description: Base class for Timing Services

 Usage:
    Provides an interface to allow

*/
//
// Original Author:  Chris Jones
//         Created:  Wed, 11 Jun 2014 14:50:33 GMT
//

// system include files
#include <chrono>

// user include files
#include "FWCore/Utilities/interface/StreamID.h"

// forward declarations
namespace edm {
  class TimingServiceBase {
  public:
    TimingServiceBase();
    TimingServiceBase(const TimingServiceBase&) = delete;
    const TimingServiceBase& operator=(const TimingServiceBase&) = delete;
    TimingServiceBase(TimingServiceBase&&) = delete;
    const TimingServiceBase& operator=(TimingServiceBase&&) = delete;
    virtual ~TimingServiceBase();

    // ---------- member functions ---------------------------
    ///Extra CPU time used by a job but not seen by cmsRun
    /// The value should be in seconds.
    /// This function is safe to call from multiple threads
    virtual void addToCPUTime(double iTime) = 0;

    ///CPU time used by this process and all its children.
    /// The value returned should be in seconds.
    virtual double getTotalCPU() const = 0;

    static void jobStarted();

    static std::chrono::steady_clock::time_point jobStartTime() { return s_jobStartTime; }

  private:
    static std::chrono::steady_clock::time_point s_jobStartTime;
  };
}  // namespace edm

#endif