diff options
| author | ruki <[email protected]> | 2022-07-28 22:40:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-07-28 10:06:02 +0800 |
| commit | 73fa9b4422c42ec89862c440898bb790afd2cf1b (patch) | |
| tree | 588cdde13a0d3e95873ac8e0e719dd21219ceca4 /core/src | |
| parent | f1f6f196cf5c9acf8d3805b808f08da3ac9d5b4f (diff) | |
get meminfo for win
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/os/meminfo.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/xmake/os/meminfo.c b/core/src/xmake/os/meminfo.c index 5fc877831..8189d698a 100644 --- a/core/src/xmake/os/meminfo.c +++ b/core/src/xmake/os/meminfo.c @@ -37,6 +37,8 @@ # include <mach-o/nlist.h> #elif defined(TB_CONFIG_OS_LINUX) # include <sys/sysinfo.h> +#elif defined(TB_CONFIG_OS_WINDOWS) +# include <windows.h> #endif /* ////////////////////////////////////////////////////////////////////////////////////// @@ -120,6 +122,15 @@ static tb_bool_t xm_os_meminfo_stats(tb_int_t* ptotalsize, tb_int_t* pavailsize) return tb_true; } } +#elif defined(TB_CONFIG_OS_WINDOWS) + MEMORYSTATUSEX statex; + statex.dwLength = sizeof(statex); + if (GlobalMemoryStatusEx(&statex)) + { + *ptotalsize = (tb_int_t)(statex.ullTotalPhys / (1024 * 1024)); + *pavailsize = (tb_int_t)(statex.ullAvailPhys / (1024 * 1024)); + return tb_true; + } #endif return tb_false; } |
