On Fri, Oct 23, 2020 at 03:16:27PM +0800, Sun Yukui wrote:
+get_mem() {
- echo "nr_node: $(grep -Eo 'Node [0-9]+,' /proc/zoneinfo | uniq | wc -l)"
- echo "nr_cpu: $(nproc)"
local memory_total=$(cat /proc/meminfo |grep MemTotal | awk '{print $2}') echo memory: $(($memory_total/1024/1024 + 1))G
$memory_total/1024/1024 this not a integet, it's decimal and divide by 16 and multiply by 16 to be more accurate, because the memory would have some loss.
Thanks, Zhangyu