A simple class that can be used for benchmarking/timing up to microsecond resolution.
More...
#include <graphlab/util/timer.hpp>
List of all members.
Static Public Member Functions |
static double | sec_of_day () |
| Get the number of seconds (as a floating point value) since the Unix Epoch.
|
static size_t | usec_of_day () |
| Returns only the micro-second component of the time since the Unix Epoch.
|
static float | approx_time_seconds () |
| Returns the time since program start.
|
static size_t | approx_time_millis () |
| Returns the time since program start.
|
static void | sleep (size_t sleeplen) |
static void | sleep_ms (size_t sleeplen) |
Detailed Description
A simple class that can be used for benchmarking/timing up to microsecond resolution.
Standard Usage
The timer is used by calling graphlab::timer::start and then by getting the current time since start by calling graphlab::timer::current_time.
For example:
#include <graphlab.hpp>
std::cout <<
"Elapsed time: " << timer.
current_time() << std::endl;
Fast approximate time
Calling current item in a tight loop can be costly and so we provide a faster less accurate timing primitive which reads a local time variable that is updated roughly every 100 millisecond. These are the graphlab::timer::approx_time_seconds and graphlab::timer::approx_time_millis.
Definition at line 67 of file timer.hpp.
Member Function Documentation
size_t graphlab::timer::approx_time_millis |
( |
| ) |
|
|
static |
Returns the time since program start.
This value is only updated once every 100ms and is therefore approximate (but fast).
Precision of deciseconds
Definition at line 85 of file timer.cpp.
float graphlab::timer::approx_time_seconds |
( |
| ) |
|
|
static |
Returns the time since program start.
This value is only updated once every 100ms and is therefore approximate (but fast).
Precision of deciseconds
Definition at line 78 of file timer.cpp.
double graphlab::timer::current_time |
( |
| ) |
const |
|
inline |
double graphlab::timer::current_time_millis |
( |
| ) |
const |
|
inline |
void graphlab::timer::sleep |
( |
size_t |
sleeplen | ) |
|
|
static |
Sleeps for sleeplen seconds
Definition at line 90 of file timer.cpp.
void graphlab::timer::sleep_ms |
( |
size_t |
sleeplen | ) |
|
|
static |
Sleeps for sleeplen milliseconds.
Definition at line 101 of file timer.cpp.
The documentation for this class was generated from the following files: