23 #ifndef __MLPACK_CORE_UTILITIES_TIMERS_HPP
24 #define __MLPACK_CORE_UTILITIES_TIMERS_HPP
29 #if defined(__unix__) || defined(__unix)
33 #elif defined(__MACH__) && defined(__APPLE__)
34 #include <mach/mach_time.h>
48 #if !defined(HAVE_UINT64_T)
49 #if SIZEOF_UNSIGNED_LONG == 8
50 typedef unsigned long uint64_t;
52 typedef unsigned long long uint64_t;
53 #endif // SIZEOF_UNSIGNED_LONG
54 #endif // HAVE_UINT64_T
57 #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
58 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
60 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
61 #endif // _MSC_VER, _MSC_EXTENSIONS
86 static void Start(
const std::string& name);
95 static void Stop(
const std::string& name);
102 static timeval
Get(
const std::string& name);
121 timeval
GetTimer(
const std::string& timerName);
129 void PrintTimer(
const std::string& timerName);
139 void StartTimer(
const std::string& timerName);
147 void StopTimer(
const std::string& timerName);
158 #endif // __MLPACK_CORE_UTILITIES_TIMERS_HPP
void PrintTimer(const std::string &timerName)
Prints the specified timer.
Timers()
Nothing to do for the constructor.
void FileTimeToTimeVal(timeval *tv)
timeval GetTimer(const std::string &timerName)
Returns a copy of the timer specified.
std::map< std::string, timeval > timers
static void Start(const std::string &name)
Start the given timer.
static timeval Get(const std::string &name)
Get the value of the given timer.
void StartTimer(const std::string &timerName)
* Initializes a timer, available like a normal value specified on * the command line...
The timer class provides a way for MLPACK methods to be timed.
static void Stop(const std::string &name)
Stop the given timer.
void GetTime(timeval *tv)
void StopTimer(const std::string &timerName)
* Halts the timer, and replaces it's value with * the delta time from it's start * *...
std::map< std::string, timeval > & GetAllTimers()
Returns a copy of all the timers used via this interface.