| The Gaudi Framework v32r1 (f65d50dc)

CPUCrunchSvc.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_CPUCRUNCHSVC_H
2 #define GAUDISVC_CPUCRUNCHSVC_H 1
3
4 #include "GaudiKernel/ClassID.h"
5 #include "GaudiKernel/Service.h"
6 #include "GaudiKernel/StatusCode.h"
7
8 #include "GaudiKernel/ICPUCrunchSvc.h"
9 #include <chrono>
10 #include <string>
11 #include <vector>
12
13 class CPUCrunchSvc : public extends<Service, ICPUCrunchSvc> {
14
15 public:
16 CPUCrunchSvc( const std::string& name, ISvcLocator* svc );
17
18 public:
19 virtual StatusCode initialize() override;
20
21 public:
22 // number of seconds to CPUCrunch
23 std::chrono::milliseconds crunch_for( const std::chrono::milliseconds& crunchtime ) const override;
24
25 private:
26 void calibrate();
27 unsigned int getNCaliIters( std::chrono::microseconds runtime ) const;
28 void findPrimes( unsigned int ) const;
29
30 std::vector<unsigned int> m_times_vect;
31
32 Gaudi::Property<std::vector<unsigned int>> m_niters_vect{
33 this, "NIterationsVect", {}, "Number of iterations for the calibration."};
34 Gaudi::Property<bool> m_shortCalib{this, "shortCalib", false, "Enable coarse grained calibration"};
35 Gaudi::Property<unsigned int> m_minCalibTime{this, "minCalibTime", 0,
36 "Minimum number of milliseconds to do calibration"};
37 Gaudi::Property<int> m_numCalibRuns{this, "numCalibRuns", 1, "Number of times to do calibration run"};
38 Gaudi::Property<float> m_corrFact{this, "calibCorrectionFactor", 1.,
39 "Calibration correction factor to take into account things like turbo boost"};
40 };
41
42 #endif
CPUCrunchSvc::crunch_for
std::chrono::milliseconds crunch_for(const std::chrono::milliseconds &crunchtime) const override
Definition: CPUCrunchSvc.cpp:194
std::chrono::milliseconds
CPUCrunchSvc
Definition: CPUCrunchSvc.h:13
ClassID.h
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
CPUCrunchSvc::m_minCalibTime
Gaudi::Property< unsigned int > m_minCalibTime
Definition: CPUCrunchSvc.h:35
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
std::string
STL class.
Service.h
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
CPUCrunchSvc::getNCaliIters
unsigned int getNCaliIters(std::chrono::microseconds runtime) const
Definition: CPUCrunchSvc.cpp:104
CPUCrunchSvc::m_shortCalib
Gaudi::Property< bool > m_shortCalib
Definition: CPUCrunchSvc.h:34
CPUCrunchSvc::m_corrFact
Gaudi::Property< float > m_corrFact
Definition: CPUCrunchSvc.h:38
CPUCrunchSvc::calibrate
void calibrate()
Definition: CPUCrunchSvc.cpp:42
CPUCrunchSvc::m_numCalibRuns
Gaudi::Property< int > m_numCalibRuns
Definition: CPUCrunchSvc.h:37
CPUCrunchSvc::findPrimes
void findPrimes(unsigned int) const
Definition: CPUCrunchSvc.cpp:142
std::vector< unsigned int >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
CPUCrunchSvc::initialize
virtual StatusCode initialize() override
Definition: CPUCrunchSvc.cpp:23
StatusCode.h
CPUCrunchSvc::m_times_vect
std::vector< unsigned int > m_times_vect
Definition: CPUCrunchSvc.h:30
CPUCrunchSvc::CPUCrunchSvc
CPUCrunchSvc(const std::string &name, ISvcLocator *svc)
Definition: CPUCrunchSvc.cpp:19
ICPUCrunchSvc.h
CPUCrunchSvc::m_niters_vect
Gaudi::Property< std::vector< unsigned int > > m_niters_vect
Definition: CPUCrunchSvc.h:32