| 5 | //! architecture and machine (for example, a fixed-frequency system counter on |
| 6 | //! Arm, and the nominal CPU frequency on x86), so ticks are only comparable |
| 7 | //! with other ticks read on the same machine. [`ticks_per_second`] measures the rate, and |
| 8 | //! [`duration_to_ticks`] and [`ticks_to_duration`] convert with it. |
| 9 | |
| 10 | use core::time::Duration; |
| 11 | use std::sync::OnceLock; |
| 12 | use std::time::Instant; |
| 13 | |
| 14 | /// How often a worker shares the work it has queued with idle siblings. |
| 15 | /// |
| 16 | /// Work that finishes within one heartbeat is never shared, so it runs without |
| 17 | /// any synchronization; longer work is offered to other workers about this |
| 18 | /// often. |
| 19 | pub const HEARTBEAT: Duration = Duration::from_micros(10); |
| 20 | |
| 21 | /// Returns the rate of [`ticks`], in ticks per second. |
| 22 | /// |
| 23 | /// The rate is measured against [`Instant`] the first time this is called, |