Bayeux  3.4.1
Core Foundation library for SuperNEMO
time_tools.h
Go to the documentation of this file.
1 
3 #ifndef DATATOOLS_TIME_TOOLS_H
4 #define DATATOOLS_TIME_TOOLS_H
5 
6 // Standard Library:
7 #include <iostream>
8 #include <sys/time.h>
9 
10 // This Project:
11 #include <datatools/i_tree_dump.h>
12 
13 namespace datatools {
14 
19  : public i_tree_dumpable
20  {
21  public:
22 
23  static double system_dead_time();
24 
27 
29  virtual ~computing_time();
30 
31  bool is_stopped() const;
32 
33  bool is_started() const;
34 
35  size_t get_counts() const;
36 
37  double get_last_elapsed_time() const;
38 
39  double get_total_time() const;
40 
41  double get_sum_time() const;
42 
43  double get_sum2_time() const;
44 
45  double get_min_time() const;
46 
47  double get_max_time() const;
48 
49  double get_mean_time() const;
50 
51  double get_sigma_time() const;
52 
53  void start();
54 
55  void stop();
56 
57  void pause();
58 
59  void resume();
60 
61  void reset();
62 
63  virtual void tree_dump(std::ostream & out_ = std::clog,
64  const std::string & title_ = "",
65  const std::string & indent_ = "",
66  bool inherit_ = false) const;
67 
68  static bool g_timeval_subtract(const timeval & stop_,
69  const timeval & start_,
70  timeval & result_);
71 
72  static double compute_system_dead_time();
73 
74  private:
75 
76  timeval _start_;
77  timeval _stop_;
78  size_t _counts_;
79  double _system_dead_time_;
80  double _sum_time_;
81  double _min_time_;
82  double _max_time_;
83  double _sum2_time_;
84  double _last_elapsed_time_;
85 
86  };
87 
88 } // namespace datatools
89 
90 #endif // DATATOOLS_TIME_TOOLS_H
91 
92 // Local Variables: --
93 // mode: c++ --
94 // c-file-style: "gnu" --
95 // tab-width: 2 --
96 // End: --
double get_min_time() const
double get_max_time() const
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Main old interface method for printing.
computing_time()
Constructor.
double get_last_elapsed_time() const
double get_sigma_time() const
size_t get_counts() const
static double system_dead_time()
double get_total_time() const
virtual ~computing_time()
Destructor.
static double compute_system_dead_time()
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
double get_mean_time() const
double get_sum_time() const
double get_sum2_time() const
A class that compute time statistics.
Definition: time_tools.h:18
static bool g_timeval_subtract(const timeval &stop_, const timeval &start_, timeval &result_)