Timer.h
Go to the documentation of this file.
1 /*
2 * ==========================================================================
3 * This file is part of the implementation of
4 *
5 * <FrameFab: Robotic Fabrication of Frame Shapes>
6 * Yijiang Huang, Juyong Zhang, Xin Hu, Guoxian Song, Zhongyuan Liu, Lei Yu, Ligang Liu
7 * In ACM Transactions on Graphics (Proc. SIGGRAPH Asia 2016)
8 ----------------------------------------------------------------------------
9 * class: Timer
10 *
11 * Description: Timing tool.
12 *
13 * Version: 1.0
14 * Created: Mar/23/2016
15 * Updated: Aug/24/2016
16 *
17 * Author: Xin Hu, Yijiang Huang, Guoxian Song
18 * Company: GCL@USTC
19 ----------------------------------------------------------------------------
20 * Copyright (C) 2016 Yijiang Huang, Xin Hu, Guoxian Song, Juyong Zhang
21 * and Ligang Liu.
22 *
23 * FrameFab is free software: you can redistribute it and/or modify
24 * it under the terms of the GNU General Public License as published by
25 * the Free Software Foundation, either version 3 of the License, or
26 * (at your option) any later version.
27 *
28 * FrameFab is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU General Public License for more details.
32 *
33 * You should have received a copy of the GNU General Public License
34 * along with FrameFab. If not, see <http://www.gnu.org/licenses/>.
35 * ==========================================================================
36 */
37 
38 #pragma once
39 
40 #ifndef FIBER_PRINT_TIMER_H
41 #define FIBER_PRINT_TIMER_H
42 
43 #include <chrono>
44 #include <ctime>
45 #include <iostream>
46 #include <string>
47 
48 class Timer
49 {
50  typedef std::chrono::time_point<std::chrono::system_clock> TimePoint;
51  typedef std::chrono::duration<double> Duration;
52 public:
53  Timer();
54  ~Timer();
55 
56 public:
57  void Start();
58  void Stop();
59  void Reset();
60  void Print(char *item);
61  std::string ToString() const;
62 
63 private:
64  TimePoint start_time_;
65  TimePoint end_time_;
66  double sum_time_;
67  int count_;
68 };
69 
70 std::ostream& operator << (std::ostream & os, const Timer& t);
71 
72 
73 #endif //Timer.h
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
std::chrono::duration< double > Duration
Definition: Timer.h:51
void Stop()
Definition: Timer.cpp:21
Timer()
Definition: Timer.cpp:4
TimePoint end_time_
Definition: Timer.h:65
TimePoint start_time_
Definition: Timer.h:64
GLdouble GLdouble t
void Start()
Definition: Timer.cpp:15
void Print(char *item)
Definition: Timer.cpp:37
void Reset()
Definition: Timer.cpp:30
Definition: Timer.h:48
std::chrono::time_point< std::chrono::system_clock > TimePoint
Definition: Timer.h:50
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