Alsvinn  0.5.3
The fast FVM simulator with UQ support
TimerData.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <map>
3 #include <string>
4 #include <cmath>
5 #include <boost/property_tree/ptree.hpp>
6 
7 namespace alsutils {
8 namespace timer {
9 
10 class TimerData {
11 public:
12  TimerData() = default;
13 
14  template<class ...T>
15  TimerData& getTimerData(const std::string& name, T... names) {
16  return children[name].getTimerData(names...);
17  }
18 
19  TimerData& getTimerData(const std::string& name);
20 
21  void addTime(double time);
22 
23  double getTotalTime() const;
24 
25 
26  void print(const std::string& indent);
27 
28  boost::property_tree::ptree getTimesAsPropertyTree(double programTotalTime)
29  const;
30 private:
31  std::map<std::string, TimerData> children;
32  double usedTime = 0;
33  bool hasTimeData = false;
34 };
35 
36 
37 } // namespace timer
38 } // namespace alsutils
void addTime(double time)
Definition: TimerData.cpp:10
boost::property_tree::ptree getTimesAsPropertyTree(double programTotalTime) const
Definition: TimerData.cpp:39
std::string name
Definition: EquationParameterFactory.cpp:39
Various utilities for mpi and cuda.
Definition: Factory.hpp:3
double getTotalTime() const
Definition: TimerData.cpp:15
TimerData & getTimerData(const std::string &name, T... names)
Definition: TimerData.hpp:15
Definition: TimerData.hpp:10
void print(const std::string &indent)
Definition: TimerData.cpp:29