mirror of
https://github.com/TECHNOFAB11/tmux2k.git
synced 2025-12-11 23:50:08 +01:00
fix: linux ram percent
This commit is contained in:
parent
f193d0661d
commit
d87007c2d0
1 changed files with 2 additions and 2 deletions
|
|
@ -10,7 +10,7 @@ get_percent() {
|
||||||
Linux)
|
Linux)
|
||||||
total_mem=$(free -g | awk '/^Mem/ {print $2}')
|
total_mem=$(free -g | awk '/^Mem/ {print $2}')
|
||||||
used_mem=$(free -g | awk '/^Mem/ {print $3}')
|
used_mem=$(free -g | awk '/^Mem/ {print $3}')
|
||||||
memory_percent=$(awk "BEGIN {printf \"%.2f\", ($used_mem / $total_mem)}")
|
memory_percent=$(awk "BEGIN {printf \"%.2f\", ($used_mem / $total_mem * 100)}")
|
||||||
echo "$memory_percent%"
|
echo "$memory_percent%"
|
||||||
;;
|
;;
|
||||||
Darwin)
|
Darwin)
|
||||||
|
|
@ -29,7 +29,7 @@ get_percent() {
|
||||||
free_mem=$(((mem_inactive + mem_unused + mem_cache) / 1024 / 1024))
|
free_mem=$(((mem_inactive + mem_unused + mem_cache) / 1024 / 1024))
|
||||||
total_mem=$(($(sysctl -n hw.physmem) / 1024 / 1024))
|
total_mem=$(($(sysctl -n hw.physmem) / 1024 / 1024))
|
||||||
used_mem=$((total_mem - free_mem))
|
used_mem=$((total_mem - free_mem))
|
||||||
memory_percent=$(awk "BEGIN {printf \"%.2f\", ($used_mem / $total_mem)}")
|
memory_percent=$(awk "BEGIN {printf \"%.2f\", ($used_mem / $total_mem * 100)}")
|
||||||
echo "$memory_percent%"
|
echo "$memory_percent%"
|
||||||
;;
|
;;
|
||||||
CYGWIN* | MINGW32* | MSYS* | MINGW*) ;; # TODO - windows compatibility
|
CYGWIN* | MINGW32* | MSYS* | MINGW*) ;; # TODO - windows compatibility
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue