summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-28 22:58:18 +0800
committerruki <[email protected]>2022-07-28 22:58:18 +0800
commite215d9b9ea21fe5eacb69a5eff90817293bc79db (patch)
tree95093004b671fd7f849adc78e5485d8584f0b8a5 /core/src
parentbdeee918bc0bd351249c478fd9f04db496fe936c (diff)
improve bsd meminfo
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/os/meminfo.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/src/xmake/os/meminfo.c b/core/src/xmake/os/meminfo.c
index baceb18cf..b679e5aee 100644
--- a/core/src/xmake/os/meminfo.c
+++ b/core/src/xmake/os/meminfo.c
@@ -140,6 +140,7 @@ static tb_bool_t xm_os_meminfo_stats(tb_int_t* ptotalsize, tb_int_t* pavailsize)
if (sysctlbyname("hw.physmem", &totalsize, &size, tb_null, 0) != 0)
return tb_false;
+ // http://web.mit.edu/freebsd/head/usr.bin/systat/vmstat.c
tb_uint32_t v_free_count;
size = sizeof(v_free_count);
if (sysctlbyname("vm.stats.vm.v_free_count", &v_free_count, &size, tb_null, 0) != 0)
@@ -150,8 +151,6 @@ static tb_bool_t xm_os_meminfo_stats(tb_int_t* ptotalsize, tb_int_t* pavailsize)
if (sysctlbyname("vm.stats.vm.v_inactive_count", &v_inactive_count, &size, tb_null, 0) != 0)
return tb_false;
- tb_trace_i("%ld %d %d", totalsize, v_free_count, v_inactive_count);
-
*ptotalsize = (tb_int_t)(totalsize / (1024 * 1024));
*pavailsize = (tb_int_t)(((tb_int64_t)(v_free_count + v_inactive_count) * tb_page_size()) / (1024 * 1024));
return tb_true;