UTimer.h
Go to the documentation of this file.
1 /*
2 * utilite is a cross-platform library with
3 * useful utilities for fast and small developing.
4 * Copyright (C) 2010 Mathieu Labbe
5 *
6 * utilite is free library: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * utilite is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef UTIMER_H
21 #define UTIMER_H
22 
23 #include "rtabmap/utilite/UtiLiteExp.h" // DLL export/import defines
24 
25 #ifdef _WIN32
26 #include <windows.h>
27 #else
28 #include <sys/time.h>
29 #include <time.h>
30 #endif
31 
47 {
48 public:
49  UTimer();
50  ~UTimer();
51 
57  static double now();
58 
62  void start();
63 
67  void stop();
68 
75  double elapsed() {return getElapsedTime();}
76  double getElapsedTime();
77 
84  UTILITE_DEPRECATED(double getInterval());
85 
94  double restart() {return ticks();}
95  double ticks();
96 
97 private:
98 #ifdef _WIN32
99  LARGE_INTEGER startTimeRecorded_; /* When we start the timer, timeRecorded is copied over lastTimeRecorded.*/
100  LARGE_INTEGER stopTimeRecorded_; /* When we stop the timer. */
101 
102  LARGE_INTEGER frequency_; /* Keep the frequency of the counter */
103 #else
104  struct timeval startTimeRecorded_; /* When we start the timer, timeRecorded is copied over lastTimeRecorded.*/
105  struct timeval stopTimeRecorded_; /* When we stop the timer. */
106 #endif
107 };
108 
109 #endif //UTIMER_H
double restart()
Definition: UTimer.h:94
Definition: UTimer.h:46
double elapsed()
Definition: UTimer.h:75
#define UTILITE_EXP
Definition: UtiLiteExp.h:33
#define UTILITE_DEPRECATED(func)
Definition: UtiLiteExp.h:42


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Jan 23 2023 03:38:58