summaryrefslogtreecommitdiffstats
path: root/darwin/DarwinProcess.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-12-12 20:43:08 +0100
committerBenny Baumann <BenBE@geshi.org>2020-12-13 11:47:34 +0100
commitf32f0188cd140f965c5e02f7fb875116522c4b41 (patch)
tree5eeffc53cf9c7ad26f441e31df7df6a15e81fa9f /darwin/DarwinProcess.c
parente65cdf947cba77e143a31981295062f1aef6d494 (diff)
Correct timebase for non-x86 CPUs on Darwin
Fixes: #368
Diffstat (limited to 'darwin/DarwinProcess.c')
-rw-r--r--darwin/DarwinProcess.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/darwin/DarwinProcess.c b/darwin/DarwinProcess.c
index 904df0bd..8a5be389 100644
--- a/darwin/DarwinProcess.c
+++ b/darwin/DarwinProcess.c
@@ -14,6 +14,7 @@ in the source distribution for its full text.
#include <mach/mach.h>
#include "CRT.h"
+#include "Platform.h"
#include "Process.h"
@@ -248,7 +249,7 @@ void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessList*
uint64_t diff = (pti.pti_total_system - proc->stime)
+ (pti.pti_total_user - proc->utime);
- proc->super.percent_cpu = (double)diff * (double)dpl->super.cpuCount
+ proc->super.percent_cpu = (double)diff * (double)dpl->super.cpuCount * Platform_timebaseToNS
/ ((double)dpl->global_diff * 100000.0);
// fprintf(stderr, "%f %llu %llu %llu %llu %llu\n", proc->super.percent_cpu,

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