The Gaudi Framework  v33r0 (d5ea422b)
CPUCrunchSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDISVC_CPUCRUNCHSVC_H
12 #define GAUDISVC_CPUCRUNCHSVC_H 1
13 
14 #include "GaudiKernel/ClassID.h"
15 #include "GaudiKernel/Service.h"
16 #include "GaudiKernel/StatusCode.h"
17 
19 #include <chrono>
20 #include <string>
21 #include <vector>
22 
23 class CPUCrunchSvc : public extends<Service, ICPUCrunchSvc> {
24 
25 public:
26  CPUCrunchSvc( const std::string& name, ISvcLocator* svc );
27 
28 public:
29  virtual StatusCode initialize() override;
30 
31 public:
32  // number of seconds to CPUCrunch
33  std::chrono::milliseconds crunch_for( const std::chrono::milliseconds& crunchtime ) const override;
34 
35 private:
36  void calibrate();
37  unsigned int getNCaliIters( std::chrono::microseconds runtime ) const;
38  void findPrimes( unsigned int ) const;
39 
41 
43  this, "NIterationsVect", {}, "Number of iterations for the calibration."};
44  Gaudi::Property<bool> m_shortCalib{this, "shortCalib", false, "Enable coarse grained calibration"};
46  "Minimum number of milliseconds to do calibration"};
47  Gaudi::Property<int> m_numCalibRuns{this, "numCalibRuns", 1, "Number of times to do calibration run"};
48  Gaudi::Property<float> m_corrFact{this, "calibCorrectionFactor", 1.,
49  "Calibration correction factor to take into account things like turbo boost"};
50 };
51 
52 #endif
std::chrono::milliseconds crunch_for(const std::chrono::milliseconds &crunchtime) const override
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:35
Gaudi::Property< unsigned int > m_minCalibTime
Definition: CPUCrunchSvc.h:45
Implementation of property with value of concrete type.
Definition: Property.h:370
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:284
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
unsigned int getNCaliIters(std::chrono::microseconds runtime) const
Gaudi::Property< bool > m_shortCalib
Definition: CPUCrunchSvc.h:44
Gaudi::Property< float > m_corrFact
Definition: CPUCrunchSvc.h:48
void calibrate()
Gaudi::Property< int > m_numCalibRuns
Definition: CPUCrunchSvc.h:47
void findPrimes(unsigned int) const
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
virtual StatusCode initialize() override
std::vector< unsigned int > m_times_vect
Definition: CPUCrunchSvc.h:40
CPUCrunchSvc(const std::string &name, ISvcLocator *svc)
Gaudi::Property< std::vector< unsigned int > > m_niters_vect
Definition: CPUCrunchSvc.h:42