summaryrefslogtreecommitdiffstats
path: root/darwin/Platform.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-09-27 13:15:58 +1000
committerNathan Scott <nathans@redhat.com>2021-09-27 13:15:58 +1000
commiteb94c4f9c996afa8dcaccbb427e81a238aaf4563 (patch)
tree9548b5a9fe820f54cc903ea82f00af0970d873b9 /darwin/Platform.c
parent07f934ccfb6f207f9131b08e6cdd51a751a9cbf2 (diff)
parent8361c6c1ae1b41521d09d950b0c2ffa3071eda73 (diff)
Merge branch 'amomchilov-workaround-for-FB9546856'
Diffstat (limited to 'darwin/Platform.c')
-rw-r--r--darwin/Platform.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/darwin/Platform.c b/darwin/Platform.c
index 4df11b2d..3f596a39 100644
--- a/darwin/Platform.c
+++ b/darwin/Platform.c
@@ -35,6 +35,7 @@ in the source distribution for its full text.
#include "TasksMeter.h"
#include "UptimeMeter.h"
#include "darwin/DarwinProcessList.h"
+#include "darwin/PlatformHelpers.h"
#include "zfs/ZfsArcMeter.h"
#include "zfs/ZfsCompressedArcMeter.h"
@@ -42,6 +43,7 @@ in the source distribution for its full text.
#include <mach/clock.h>
#include <mach/mach.h>
#endif
+
#ifdef HAVE_MACH_MACH_TIME_H
#include <mach/mach_time.h>
#endif
@@ -125,15 +127,7 @@ static double Platform_nanosecondsPerMachTick = 1.0;
static double Platform_nanosecondsPerSchedulerTick = -1;
void Platform_init(void) {
- // Check if we can determine the timebase used on this system.
- // If the API is unavailable assume we get our timebase in nanoseconds.
-#ifdef HAVE_MACH_TIMEBASE_INFO
- mach_timebase_info_data_t info;
- mach_timebase_info(&info);
- Platform_nanosecondsPerMachTick = (double)info.numer / (double)info.denom;
-#else
- Platform_nanosecondsPerMachTick = 1.0;
-#endif
+ Platform_nanosecondsPerMachTick = Platform_calculateNanosecondsPerMachTick();
// Determine the number of scheduler clock ticks per second
errno = 0;

© 2014-2024 Faster IT GmbH | imprint | privacy policy