Timer.cpp
Go to the documentation of this file.
1 // ros output
3 
5 {
6  Reset();
7 }
8 
9 
11 {
12 }
13 
14 
16 {
17  start_time_ = std::chrono::system_clock::now();
18 }
19 
20 
22 {
23  end_time_ = std::chrono::system_clock::now();
24  sum_time_ += std::chrono::duration_cast<std::chrono::duration<double>>
26  count_++;
27 }
28 
29 
31 {
32  sum_time_ = 0;
33  count_ = 0;
34 }
35 
36 
37 void Timer::Print(char *item)
38 {
39  printf("%s total-time:%3.4lf count:%4d avg-time:%3.4lf\n",
40  item, sum_time_, count_, sum_time_ / count_);
41 }
42 
43 
44 std::string Timer::ToString() const
45 {
46  std::string s = std::to_string(sum_time_);
47  s.append(" s");
48  return s;
49 }
50 
51 
52 std::ostream & operator << (std::ostream& os, const Timer& t)
53 {
54  os << t.ToString();
55  return os;
56 }
double sum_time_
Definition: Timer.h:66
std::ostream & operator<<(std::ostream &os, const Timer &t)
Definition: Timer.cpp:52
int count_
Definition: Timer.h:67
~Timer()
Definition: Timer.cpp:10
void Stop()
Definition: Timer.cpp:21
Timer()
Definition: Timer.cpp:4
TimePoint end_time_
Definition: Timer.h:65
GLint GLsizei count
TimePoint start_time_
Definition: Timer.h:64
GLdouble GLdouble t
void Start()
Definition: Timer.cpp:15
GLdouble s
void Print(char *item)
Definition: Timer.cpp:37
void Reset()
Definition: Timer.cpp:30
Definition: Timer.h:48
std::string ToString() const
Definition: Timer.cpp:44


choreo_task_sequence_planner
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:03:14