15 #ifndef __MLPACK_CORE_UTILITIES_TIMERS_HPP
16 #define __MLPACK_CORE_UTILITIES_TIMERS_HPP
21 #if defined(__unix__) || defined(__unix)
25 #elif defined(__MACH__) && defined(__APPLE__)
26 #include <mach/mach_time.h>
35 #define NOMINMAX // Don't define min and max macros.
44 #if !defined(HAVE_UINT64_T)
45 #if SIZEOF_UNSIGNED_LONG == 8
46 typedef unsigned long uint64_t;
48 typedef unsigned long long uint64_t;
49 #endif // SIZEOF_UNSIGNED_LONG
50 #endif // HAVE_UINT64_T
53 #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
54 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
56 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
57 #endif // _MSC_VER, _MSC_EXTENSIONS
83 static void Start(
const std::string& name);
93 static void Stop(
const std::string& name);
100 static timeval
Get(
const std::string& name);
119 timeval
GetTimer(
const std::string& timerName);
127 void PrintTimer(
const std::string& timerName);
137 void StartTimer(
const std::string& timerName);
145 void StopTimer(
const std::string& timerName);
152 bool GetState(std::string timerName);
166 #endif // __MLPACK_CORE_UTILITIES_TIMERS_HPP
std::map< std::string, bool > timerState
A map that contains whether or not each timer is currently running.
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.
Linear algebra utility functions, generally performed on matrices or vectors.
std::map< std::string, timeval > timers
A map of all the timers that are being tracked.
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)
bool GetState(std::string timerName)
Returns state of the given timer.
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.