I want to find used space (the value that is reported by top, that is at second position on top Swap line) with sysctl variables.
I need that in a C program, and I want to get it with sysctlbyname() function.
Here are sysctl values for swap:
I've tried different computations adding (swappgsout+swappgsin)*4096 and other things but I cannot obtain the value from top utility which means I am not doing something right.
My question is: how used swap value is calculated?
I need that in a C program, and I want to get it with sysctlbyname() function.
Here are sysctl values for swap:
Code:
vm.swap_enabled: 1
vm.nswapdev: 1
vm.swap_async_max: 4
vm.swap_reserved: 10697715712
vm.swap_total: 8589934592
vm.swap_idle_threshold2: 10
vm.swap_idle_threshold1: 2
vm.stats.vm.v_swappgsout: 167146
vm.stats.vm.v_swappgsin: 53192
vm.stats.vm.v_swapout: 37474
vm.stats.vm.v_swapin: 18443
vm.disable_swapspace_pageouts: 0
vm.defer_swapspace_pageouts: 0
vm.swap_idle_enabled: 0
I've tried different computations adding (swappgsout+swappgsin)*4096 and other things but I cannot obtain the value from top utility which means I am not doing something right.
My question is: how used swap value is calculated?