RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
UTimer.h
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/utilite_export.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
46class UTILITE_EXPORT UTimer
47{
48public:
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
86 double restart() {return ticks();}
87 double ticks();
88
89private:
90#ifdef _WIN32
91 LARGE_INTEGER startTimeRecorded_; /* When we start the timer, timeRecorded is copied over lastTimeRecorded.*/
92 LARGE_INTEGER stopTimeRecorded_; /* When we stop the timer. */
93
94 LARGE_INTEGER frequency_; /* Keep the frequency of the counter */
95#else
96 struct timeval startTimeRecorded_; /* When we start the timer, timeRecorded is copied over lastTimeRecorded.*/
97 struct timeval stopTimeRecorded_; /* When we stop the timer. */
98#endif
99};
100
101#endif //UTIMER_H
void start()
double elapsed()
Definition UTimer.h:75
void stop()
double restart()
Definition UTimer.h:86
static double now()