The Gaudi Framework  master (37c0b60a)
CPUCrunchSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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
CPUCrunchSvc::m_minCalibTime
Gaudi::Property< unsigned int > m_minCalibTime
Definition: CPUCrunchSvc.h:45
CPUCrunchSvc::crunch_for
std::chrono::milliseconds crunch_for(const std::chrono::milliseconds &crunchtime) const override
Definition: CPUCrunchSvc.cpp:210
std::string
STL class.
std::vector< unsigned int >
ClassID.h
ISvcLocator
Definition: ISvcLocator.h:46
std::chrono::milliseconds
StatusCode.h
ICPUCrunchSvc.h
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
StatusCode
Definition: StatusCode.h:65
CPUCrunchSvc::getNCaliIters
unsigned int getNCaliIters(std::chrono::microseconds runtime) const
Definition: CPUCrunchSvc.cpp:120
CPUCrunchSvc::m_shortCalib
Gaudi::Property< bool > m_shortCalib
Definition: CPUCrunchSvc.h:44
CPUCrunchSvc::m_corrFact
Gaudi::Property< float > m_corrFact
Definition: CPUCrunchSvc.h:48
CPUCrunchSvc::calibrate
void calibrate()
Definition: CPUCrunchSvc.cpp:58
CPUCrunchSvc
Definition: CPUCrunchSvc.h:23
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
Service.h
CPUCrunchSvc::m_numCalibRuns
Gaudi::Property< int > m_numCalibRuns
Definition: CPUCrunchSvc.h:47
CPUCrunchSvc::findPrimes
void findPrimes(unsigned int) const
Definition: CPUCrunchSvc.cpp:158
CPUCrunchSvc::m_times_vect
std::vector< unsigned int > m_times_vect
Definition: CPUCrunchSvc.h:40
CPUCrunchSvc::CPUCrunchSvc
CPUCrunchSvc(const std::string &name, ISvcLocator *svc)
Definition: CPUCrunchSvc.cpp:35
CPUCrunchSvc::initialize
virtual StatusCode initialize() override
Definition: CPUCrunchSvc.cpp:39
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:37
CPUCrunchSvc::m_niters_vect
Gaudi::Property< std::vector< unsigned int > > m_niters_vect
Definition: CPUCrunchSvc.h:42