The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
CPUCrunchSvc.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 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#pragma once
12
13#include <GaudiKernel/ClassID.h>
14#include <GaudiKernel/Service.h>
16
18#include <chrono>
19#include <string>
20#include <vector>
21
22class CPUCrunchSvc : public extends<Service, ICPUCrunchSvc> {
23
24public:
25 CPUCrunchSvc( const std::string& name, ISvcLocator* svc );
26
27public:
28 virtual StatusCode initialize() override;
29
30public:
31 // number of seconds to CPUCrunch
32 std::chrono::milliseconds crunch_for( const std::chrono::milliseconds& crunchtime ) const override;
33
34private:
35 void calibrate();
36 unsigned int getNCaliIters( std::chrono::microseconds runtime ) const;
37 void findPrimes( unsigned int ) const;
38
39 std::vector<unsigned int> m_times_vect;
40
42 this, "NIterationsVect", {}, "Number of iterations for the calibration." };
43 Gaudi::Property<bool> m_shortCalib{ this, "shortCalib", false, "Enable coarse grained calibration" };
45 "Minimum number of milliseconds to do calibration" };
46 Gaudi::Property<int> m_numCalibRuns{ this, "numCalibRuns", 1, "Number of times to do calibration run" };
47 Gaudi::Property<float> m_corrFact{ this, "calibCorrectionFactor", 1.,
48 "Calibration correction factor to take into account things like turbo boost" };
49};
std::vector< unsigned int > m_times_vect
virtual StatusCode initialize() override
Gaudi::Property< int > m_numCalibRuns
Gaudi::Property< bool > m_shortCalib
CPUCrunchSvc(const std::string &name, ISvcLocator *svc)
Gaudi::Property< std::vector< unsigned int > > m_niters_vect
void findPrimes(unsigned int) const
Gaudi::Property< float > m_corrFact
Gaudi::Property< unsigned int > m_minCalibTime
std::chrono::milliseconds crunch_for(const std::chrono::milliseconds &crunchtime) const override
unsigned int getNCaliIters(std::chrono::microseconds runtime) const
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
Base class used to extend a class implementing other interfaces.
Definition extends.h:19