diff options
| author | ruki <[email protected]> | 2022-07-28 22:58:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-07-28 22:58:18 +0800 |
| commit | e215d9b9ea21fe5eacb69a5eff90817293bc79db (patch) | |
| tree | 95093004b671fd7f849adc78e5485d8584f0b8a5 | |
| parent | bdeee918bc0bd351249c478fd9f04db496fe936c (diff) | |
improve bsd meminfo
| -rw-r--r-- | .github/workflows/freebsd.yml | 5 | ||||
| -rw-r--r-- | core/src/xmake/os/meminfo.c | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 29e2441cf..dac024d48 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -27,12 +27,11 @@ jobs: copyback: false prepare: pkg install -y curl unzip gmake llvm gsed bash perl5 run: | - gmake -j1 + gmake -j4 gmake install export XMAKE_ROOT=y xrepo --version - dmesg | grep -i memory xmake l os.meminfo - #xmake lua -v -D tests/run.lua + xmake lua -v -D tests/run.lua 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; |
