OpenRTM-aist  1.2.1
TimeMeasure.h
Go to the documentation of this file.
1 // -*- C++ -*-
20 #ifndef COIL_TIMEMEASURE_H
21 #define COIL_TIMEMEASURE_H
22 
23 #include <vector>
24 #include <coil/TimeValue.h>
25 
26 namespace coil
27 {
28 
50  {
51  public:
63  struct Statistics
64  {
65  double max_interval;
66  double min_interval;
67  double mean_interval;
68  double std_deviation;
69  };
70 
86  TimeMeasure(int buflen = 100);
87 
103  void tick();
104 
120  void tack();
121 
142 
158  void reset();
159 
179  unsigned long int count() const;
180 
210  bool getStatistics(double &max_interval,
211  double &min_interval,
212  double &mean_interval,
213  double &stddev);
214 
235 
236  private:
237  std::vector<coil::TimeValue> m_record;
238  coil::TimeValue m_begin;
239  coil::TimeValue m_interval;
240 
241  unsigned long int m_count;
242  const unsigned long int m_countMax;
243  unsigned long long int m_cpuClock;
244 
245  bool m_recurred;
246  };
247 }; // namespace coil
248 #endif // COIL_TIMEMEASURE_H
coil::TimeValue & interval()
Get a interval time.
double min_interval
Definition: TimeMeasure.h:66
Structure for time statistics.
Definition: TimeMeasure.h:63
double std_deviation
Definition: TimeMeasure.h:68
TimeValue class.
Definition: TimeValue.h:40
void tack()
Finish time measurement for time statistics.
double max_interval
Definition: TimeMeasure.h:65
void reset()
Initialize for statistics related data.
Statistics getStatistics()
Get statistics result.
TimeMeasure class.
Definition: TimeMeasure.h:49
double mean_interval
Definition: TimeMeasure.h:67
void tick()
Begin time measurement for time statistics.
TimeMeasure(int buflen=100)
Constructor.
unsigned long int count() const
Get number of time measurement buffer.
Common Object Interface Layer.
Definition: Affinity.h:28