ATLAS Offline Software
HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Utils.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 #ifndef PSC_UTILS_H
13 #define PSC_UTILS_H
14 
15 #include <vector>
16 #include <string>
17 #include <chrono>
18 
19 namespace psc {
20 
21  namespace Utils {
22 
28  bool execPython (const std::string& pyCmd);
29 
35  bool execPython (const std::vector<std::string>& pyCmds);
36 
42  bool pyInclude (const std::string& pyFileName);
43 
49  bool execFile (const std::string& pyFileName);
50 
56  class ScopeTimer {
57  public:
61  ScopeTimer (const std::string& descr = "Timer");
62 
66  ~ScopeTimer() { if (m_running) stop(); }
67 
71  void stop();
72 
73  private:
74  std::string m_descr;
75  std::chrono::system_clock::time_point m_t1;
76  bool m_running;
77  };
78 
79  } /* namespace Utils */
80 } /* namespace psc */
81 
82 
83 #endif /* PSC_UTILS_H */
psc::Utils::ScopeTimer::ScopeTimer
ScopeTimer(const std::string &descr="Timer")
Create timer and start timing.
Definition: HLT/Trigger/TrigControl/TrigPSC/src/Utils.cxx:66
psc::Utils::ScopeTimer::m_running
bool m_running
timer running?
Definition: HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Utils.h:76
psc::Utils::pyInclude
bool pyInclude(const std::string &pyFileName)
Include a python file via AthenaCommon.Include.
Definition: HLT/Trigger/TrigControl/TrigPSC/src/Utils.cxx:45
psc::Utils::ScopeTimer::m_descr
std::string m_descr
description of timer
Definition: HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Utils.h:74
psc::Utils::ScopeTimer::~ScopeTimer
~ScopeTimer()
Stop timer (if still running)
Definition: HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Utils.h:66
psc
Definition: Config.h:26
python.TransformConfig.descr
descr
print "%s.properties()" % self.__name__
Definition: TransformConfig.py:360
psc::Utils::execPython
bool execPython(const std::string &pyCmd)
Execute a python command in the python interpreter.
Definition: HLT/Trigger/TrigControl/TrigPSC/src/Utils.cxx:24
psc::Utils::ScopeTimer
Very simple timer class.
Definition: HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Utils.h:56
Utils
Definition: CaloCellSelectorUtils.cxx:10
psc::Utils::execFile
bool execFile(const std::string &pyFileName)
Execute a python file (via include or import)
Definition: HLT/Trigger/TrigControl/TrigPSC/src/Utils.cxx:54
psc::Utils::ScopeTimer::stop
void stop()
Stop timer manually.
Definition: HLT/Trigger/TrigControl/TrigPSC/src/Utils.cxx:77
psc::Utils::ScopeTimer::m_t1
std::chrono::system_clock::time_point m_t1
start time
Definition: HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Utils.h:75