HikoGUI
A low latency retained GUI
|
#include <hikogui/time/time_stamp_count.hpp>
Data Structures | |
struct | inplace |
struct | inplace_with_cpu_id |
struct | inplace_with_thread_id |
Public Member Functions | |
constexpr | time_stamp_count (uint64_t count, uint32_t aux) noexcept |
time_stamp_count (time_stamp_count::inplace) noexcept | |
Use a constructor to in-place create the timestamp. | |
time_stamp_count (time_stamp_count::inplace_with_cpu_id) noexcept | |
Use a constructor to in-place create the timestamp. | |
time_stamp_count (time_stamp_count::inplace_with_thread_id) noexcept | |
Use a constructor to in-place create the timestamp. | |
ssize_t | cpu_id () const noexcept |
Get the logical CPU index. | |
constexpr uint32_t | thread_id () const noexcept |
Get the thread id. | |
constexpr uint64_t | count () const noexcept |
Get the count since epoch. | |
std::chrono::nanoseconds | time_since_epoch () const noexcept |
Convert to nanoseconds since epoch. | |
constexpr time_stamp_count & | operator+= (uint64_t rhs) noexcept |
constexpr time_stamp_count | operator+ (uint64_t rhs) const noexcept |
Static Public Member Functions | |
static time_stamp_count | now () noexcept |
Get the current count from the CPU's time stamp count. | |
static std::chrono::nanoseconds | duration_from_count (uint64_t count) noexcept |
Convert a time-stamp count to a duration. | |
static std::pair< utc_nanoseconds, time_stamp_count > | time_stamp_utc_sample () |
Get a good quality time sample. | |
static uint64_t | measure_frequency (std::chrono::milliseconds sample_duration) |
Measure the frequency of the time_stamp_count. | |
static void | set_frequency (uint64_t frequency) noexcept |
static std::pair< uint64_t, bool > | start_subsystem () |
Start the time_stamp_count subsystem. | |
Since Window's 10 QueryPerformanceCounter() counts at only 10MHz which is too low to measure performance in many cases.
Instead we will use the TSC.
|
inlineexplicitnoexcept |
Use a constructor to in-place create the timestamp.
|
inlineexplicitnoexcept |
Use a constructor to in-place create the timestamp.
|
inlineexplicitnoexcept |
Use a constructor to in-place create the timestamp.
|
inlineconstexprnoexcept |
Get the count since epoch.
The epoch is the same as the TSC count's epoch. In most cases the epoch is at system startup time.
|
inlinenoexcept |
Get the logical CPU index.
This is logical CPU id that the operating system uses for things like thread affinity.
|
inlinestaticnoexcept |
Convert a time-stamp count to a duration.
count | The number clock ticks. |
|
inlinestatic |
Measure the frequency of the time_stamp_count.
Frequency drift from TSC is 1ppm
sample_duration | The time between samples to determine the frequency longer duration gives a better quality but may increase application start-up time. |
|
inlinestaticnoexcept |
Get the current count from the CPU's time stamp count.
|
inlinestatic |
Start the time_stamp_count subsystem.
os_error | When the time-stamp-counter does not work. AUX is the same as the cpu-id. |
|
inlineconstexprnoexcept |
Get the thread id.
time_stamp_count(time_stamp_count::inplace_with_thread_id)
first.
|
inlinenoexcept |
Convert to nanoseconds since epoch.
The epoch is the same as the TSC count's epoch. In most cases the epoch is at system startup time.
|
inlinestatic |
Get a good quality time sample.
os_error | When there is a problem getting a time-sample. |