LogCabin
|
Classes | |
struct | CSystemClock |
Wall clock in nanosecond granularity. More... | |
struct | CSteadyClock |
Monotonic clock in nanosecond granularity. More... | |
struct | MockableClock |
Reads the current time. More... | |
class | SteadyTimeConverter |
Used to convert one or more SteadyClock::time_point values into values of the SystemClock. More... | |
Typedefs | |
typedef MockableClock < std::chrono::steady_clock > | SteadyClock |
The best available clock on this system for uses where a steady, monotonic clock is desired. | |
typedef MockableClock < std::chrono::system_clock > | SystemClock |
A clock that reads wall time and is affected by NTP adjustments. | |
Functions | |
int64_t | parseSignedDuration (const std::string &description) |
Convert a human-readable description of a time duration into a number of nanoseconds. | |
uint64_t | parseNonNegativeDuration (const std::string &description) |
Convert a human-readable description of a time duration into a number of nanoseconds. | |
void | sleep (SteadyClock::time_point wake) |
Block the calling thread until the given time. | |
void | sleep (std::chrono::nanoseconds duration) |
Block the calling thread for the given duration. | |
template<typename Clock , typename Duration > | |
struct timespec | makeTimeSpec (const std::chrono::time_point< Clock, Duration > &when) |
Convert a C++11 time point into a POSIX timespec. | |
static __inline uint64_t | rdtsc () |
Read the CPU's cycle counter. | |
Variables | |
const clockid_t | STEADY_CLOCK_ID |
The clock used by CSteadyClock. |
typedef MockableClock<std::chrono::steady_clock> LogCabin::Core::Time::SteadyClock |
typedef MockableClock<std::chrono::system_clock> LogCabin::Core::Time::SystemClock |
int64_t LogCabin::Core::Time::parseSignedDuration | ( | const std::string & | description | ) |
Convert a human-readable description of a time duration into a number of nanoseconds.
description | Something like 10, 10s, -200ms, 3us, or -999ns. With no units, defaults to seconds. May be negative. Allowed units: ns, nanosecond(s), ms, millisecond(s), s, second(s), min, minute(s), h, hr, hour(s), d, day(s), w, wk, week(s), mo, month(s), y, yr, year(s). |
std::runtime_error | If description could not be parsed successfully. |
uint64_t LogCabin::Core::Time::parseNonNegativeDuration | ( | const std::string & | description | ) |
Convert a human-readable description of a time duration into a number of nanoseconds.
description | Something like 10, 10s, 200ms, 3us, or 999ns. With no units, defaults to seconds. May not be negative. Allowed units: ns, nanosecond(s), ms, millisecond(s), s, second(s), min, minute(s), h, hr, hour(s), d, day(s), w, wk, week(s), mo, month(s), y, yr, year(s). |
std::runtime_error | If description could not be parsed successfully. |
void LogCabin::Core::Time::sleep | ( | SteadyClock::time_point | wake | ) |
void LogCabin::Core::Time::sleep | ( | std::chrono::nanoseconds | duration | ) |
struct timespec LogCabin::Core::Time::makeTimeSpec | ( | const std::chrono::time_point< Clock, Duration > & | when | ) | [read] |
static __inline uint64_t LogCabin::Core::Time::rdtsc | ( | ) | [static] |
const clockid_t LogCabin::Core::Time::STEADY_CLOCK_ID |
The clock used by CSteadyClock.
For now (2014), we can't use CLOCK_MONOTONIC_RAW in condition variables since glibc doesn't support that, so stick with CLOCK_MONOTONIC. This rate of this clock may change due to NTP adjustments, but at least it won't jump.