Merge pull request #130 from ethancedwards8/cleanup-ram
Cleanup RAM file
This commit is contained in:
commit
0b4954180c
1 changed files with 2 additions and 13 deletions
|
@ -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}')
|
||||
|
|
Loading…
Reference in a new issue