-
-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0f7854
commit 64f03bf
Showing
1 changed file
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,7 +141,18 @@ static void OpenBSDMachine_scanMemoryInfo(OpenBSDMachine* this) { | |
} | ||
|
||
super->totalMem = uvmexp.npages * this->pageSizeKB; | ||
super->usedMem = (uvmexp.npages - uvmexp.free) * this->pageSizeKB; | ||
super->usedMem = (uvmexp.npages - uvmexp.free - uvmexp.paging) * this->pageSizeKB; | ||
|
||
// Taken from OpenBSD systat/iostat.c, top/machine.c and uvm_sysctl(9) | ||
const int bcache_mib[] = { CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT }; | ||
struct bcachestats bcstats; | ||
size_t size_bcstats = sizeof(bcstats); | ||
|
||
if (sysctl(bcache_mib, 3, &bcstats, &size_bcstats, NULL, 0) < 0) { | ||
CRT_fatalError("cannot get vfs.bcachestat"); | ||
} | ||
|
||
super->cachedMem = bcstats.numbufpages * this->pageSizeKB; | ||
|
||
/* | ||
* Copyright (c) 1994 Thorsten Lockert <[email protected]> | ||
|