From 67f7e5ecf8498d7dcbf5f81803631c64204b5453 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sat, 9 Oct 2021 19:48:10 -0400 Subject: [PATCH] Cleanup RAM file --- scripts/ram_info.sh | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 4526019..97d61b6 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -2,23 +2,13 @@ # setting the locale, some users have issues with different locales, this forces the correct one export LC_ALL=en_US.UTF-8 -# function for getting the refresh rate -get_tmux_option() { - local option=$1 - local default_value=$2 - local option_value=$(tmux show-option -gqv "$option") - if [ -z $option_value ]; then - echo $default_value - else - echo $option_value - fi -} +current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $current_dir/utils.sh get_percent() { case $(uname -s) in Linux) - # percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}') total_mem_gb=$(free -g | awk '/^Mem/ {print $2}') used_mem=$(free -g | awk '/^Mem/ {print $3}') total_mem=$(free -h | awk '/^Mem/ {print $2}') @@ -36,7 +26,6 @@ get_percent() ;; Darwin) - # percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') # Get used memory blocks with vm_stat, multiply by page size to get size in bytes, then convert to MiB used_mem=$(vm_stat | grep ' active\|wired ' | sed 's/[^0-9]//g' | paste -sd ' ' - | awk -v pagesize=$(pagesize) '{printf "%d\n", ($1+$2) * pagesize / 1048576}') total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}')