updated ram_total and ram_free (obsd)
This commit is contained in:
parent
6464cea333
commit
0f9a1a8367
1 changed files with 4 additions and 4 deletions
|
@ -59,6 +59,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define LOG1024 10
|
||||||
|
|
||||||
inline int
|
inline int
|
||||||
load_uvmexp(struct uvmexp *uvmexp)
|
load_uvmexp(struct uvmexp *uvmexp)
|
||||||
{
|
{
|
||||||
|
@ -79,8 +81,7 @@
|
||||||
|
|
||||||
if (load_uvmexp(&uvmexp)) {
|
if (load_uvmexp(&uvmexp)) {
|
||||||
free_pages = uvmexp.npages - uvmexp.active;
|
free_pages = uvmexp.npages - uvmexp.active;
|
||||||
free = (double) (free_pages * uvmexp.pagesize) / 1024 /
|
free = (float)(free_pages << (uvmexp.pageshift - LOG1024)) / 1024 / 1024;
|
||||||
1024 / 1024;
|
|
||||||
return bprintf("%f", free);
|
return bprintf("%f", free);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +109,7 @@
|
||||||
float total;
|
float total;
|
||||||
|
|
||||||
if (load_uvmexp(&uvmexp)) {
|
if (load_uvmexp(&uvmexp)) {
|
||||||
total = (double) (uvmexp.npages * uvmexp.pagesize) /
|
total = (float)(uvmexp.npages << (uvmexp.pageshift - LOG1024)) / 1024 / 1024;
|
||||||
1024 / 1024 / 1024;
|
|
||||||
return bprintf("%f", total);
|
return bprintf("%f", total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue