diff options
author | Alexander Momchilov <alexandermomchilov@gmail.com> | 2021-08-22 10:47:11 -0400 |
---|---|---|
committer | Alexander Momchilov <alexandermomchilov@gmail.com> | 2021-08-25 11:55:05 -0400 |
commit | 59d0c5b26a55a68be059f2ac32a7c083b2ff01ee (patch) | |
tree | 740efac73ae33c02ca512f46c3ee2f8119c73ef8 /darwin/Platform.h | |
parent | fa48c484cc6db90736789b9ff811fd5bc8dc119d (diff) |
Refactor Darwin platform unit conversion helpers
Diffstat (limited to 'darwin/Platform.h')
-rw-r--r-- | darwin/Platform.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/darwin/Platform.h b/darwin/Platform.h index b1733a56..b907a8d5 100644 --- a/darwin/Platform.h +++ b/darwin/Platform.h @@ -27,10 +27,6 @@ in the source distribution for its full text. extern const ProcessField Platform_defaultFields[]; -extern double Platform_timebaseToNS; - -extern long Platform_clockTicksPerSec; - extern const SignalItem Platform_signals[]; extern const unsigned int Platform_numberOfSignals; @@ -39,6 +35,14 @@ extern const MeterClass* const Platform_meterTypes[]; void Platform_init(void); +// Converts ticks in the Mach "timebase" to nanoseconds. +// See `mach_timebase_info`, as used to define the `Platform_nanosecondsPerMachTick` constant. +uint64_t Platform_machTicksToNanoseconds(uint64_t mach_ticks); + +// Converts "scheduler ticks" to nanoseconds. +// See `sysconf(_SC_CLK_TCK)`, as used to define the `Platform_schedulerTicksPerNS` constant. +double Platform_schedulerTicksToNanoseconds(const double scheduler_ticks); + void Platform_done(void); void Platform_setBindings(Htop_Action* keys); |