From 361877454fe56c95a995d5bdbb7eb70c21e39d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 15 Oct 2020 22:37:02 +0200 Subject: Cache PAGE_SIZE man:sysconf(3) states: The values obtained from these functions are system configuration constants. They do not change during the lifetime of a process. --- darwin/DarwinProcess.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'darwin') diff --git a/darwin/DarwinProcess.c b/darwin/DarwinProcess.c index 48574e2f..7049cb1e 100644 --- a/darwin/DarwinProcess.c +++ b/darwin/DarwinProcess.c @@ -15,6 +15,8 @@ in the source distribution for its full text. #include +#include "CRT.h" + const ProcessClass DarwinProcess_class = { .super = { @@ -257,8 +259,8 @@ void DarwinProcess_setFromLibprocPidinfo(DarwinProcess *proc, DarwinProcessList proc->super.time = (pti.pti_total_system + pti.pti_total_user) / 10000000; proc->super.nlwp = pti.pti_threadnum; - proc->super.m_size = pti.pti_virtual_size / 1024 / PAGE_SIZE_KB; - proc->super.m_resident = pti.pti_resident_size / 1024 / PAGE_SIZE_KB; + proc->super.m_size = pti.pti_virtual_size / CRT_pageSize; + proc->super.m_resident = pti.pti_resident_size / CRT_pageSize; proc->super.majflt = pti.pti_faults; proc->super.percent_mem = (double)pti.pti_resident_size * 100.0 / (double)dpl->host_info.max_mem; -- cgit v1.2.3