diff options
author | Hisham <hisham@gobolinux.org> | 2016-02-13 02:13:57 -0200 |
---|---|---|
committer | Hisham <hisham@gobolinux.org> | 2016-02-13 02:13:57 -0200 |
commit | e9b32eb62f6505fd065022cdd085ae6d8e5e0e46 (patch) | |
tree | 1b8e1513aa75a6106ba76b6df6a5587f01308b4b /darwin | |
parent | 3b9a4b10247697661de1cc8ec1599eea4c95648b (diff) |
Fix memory accounting in Darwin.
htop currently expects m_size and m_resident in pages (Process.c).
According to the proc_info.h header, the values returned by libproc
are in bytes:
http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/proc_info.h
Eventually we should change the htop crossplatform API to expect memory
in bytes, but this is the smaller change that should fix it.
Closes #385.
Diffstat (limited to 'darwin')
-rw-r--r-- | darwin/DarwinProcess.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/darwin/DarwinProcess.c b/darwin/DarwinProcess.c index 9c460469..34d873d5 100644 --- a/darwin/DarwinProcess.c +++ b/darwin/DarwinProcess.c @@ -327,8 +327,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; - proc->super.m_resident = pti.pti_resident_size / 1024; + 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.majflt = pti.pti_faults; proc->super.percent_mem = (double)pti.pti_resident_size * 100.0 / (double)dpl->host_info.max_mem; |