Converts a span of monotonic clock ticks to nanoseconds. More...
#include <load_measurer.hpp>
Public Member Functions | |
| constexpr std::int64_t | to_ns (std::uint64_t ticks) const noexcept |
| Nanoseconds in a span of ticks, saturating at INT64_MAX. | |
Static Public Member Functions | |
| static constexpr LoadClockRatio | reduced (std::uint64_t numer, std::uint64_t denom) noexcept |
| numer/denom reduced by their GCD. | |
| static LoadClockRatio | host () noexcept |
| The running platform's timebase. Not for the audio thread. | |
Public Attributes | |
| std::uint64_t | numer = 1 |
| std::uint64_t | denom = 1 |
Friends | |
| constexpr bool | operator== (const LoadClockRatio &, const LoadClockRatio &)=default |
Converts a span of monotonic clock ticks to nanoseconds.
The ratio is reduced once, off the audio thread, so converting a span is one 64-bit multiply and divide. host() reads the platform timebase: mach_timebase_info() on Apple (125/3 on M1, 1/1 on later chips), and 1/1 elsewhere, where the ticks are already steady_clock nanoseconds.
|
inlinestaticnoexcept |
The running platform's timebase. Not for the audio thread.
|
inlinestaticconstexprnoexcept |
numer/denom reduced by their GCD.
A zero numerator or denominator names an unavailable clock, which converts every span to 0.
|
inlineconstexprnoexcept |
Nanoseconds in a span of ticks, saturating at INT64_MAX.
|
friend |
| std::uint64_t pulp::audio::LoadClockRatio::denom = 1 |
| std::uint64_t pulp::audio::LoadClockRatio::numer = 1 |