diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f8fe72 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +CMakeCache.txt +CMakeFiles/ +Makefile +cmake_install.cmake +install_manifest.txt +screen-cpu-usage +*.swp diff --git a/README.rst b/README.rst index 4cffd19..437ef15 100644 --- a/README.rst +++ b/README.rst @@ -19,12 +19,12 @@ The CPU usage monitor outputs a percent CPU usage over all processors that is updated every second. It also displays a textual bar graph of the current percent usage where every '|' character represents 10% usage. -The memory monitor is updated every three seconds and displays the used and -available memory. +The memory monitor is updated every three seconds and displays the free of +total memory. Example:: - Mem:2885MB/7987MB Cpu:[||||| ] 51.2% + Mem:3130/15344MB 79.7%[f] Cpu:[||||| ] 51.2% @@ -87,7 +87,7 @@ An example configuration:: The example configuration will result in:: - Host:flea Mem:2961MB/7987MB Cpu:[|| ] 25.6% Load:0.64 0.35 0.28 Fri 09/11 12:56am + Host:flea Mem:3130/15344MB 79.7%[f] Cpu:[|| ] 25.6% Load:0.64 0.35 0.28 Fri 09/11 12:56am diff --git a/screen-mem-usage b/screen-mem-usage index 2aa2b4a..7f95e0a 100755 --- a/screen-mem-usage +++ b/screen-mem-usage @@ -1,9 +1,11 @@ #!/bin/sh -total_mem=$(/usr/bin/free -m | /usr/bin/awk '$1 == "Mem:" { print $2 }') +total_mem=$(/usr/bin/free -tm | /usr/bin/awk '$1 == "Mem:" { print $2 }') while(true); do - current_mem=$(/usr/bin/free -m | /usr/bin/awk '$1 == "-/+" { print $3 }') - echo "${current_mem}MB/${total_mem}MB" + free_mem=$(/usr/bin/free -tm | /usr/bin/awk '$1 == "Mem:" { print $4 }') + free_mem_pct=$(echo "scale=3; ${free_mem}/${total_mem}" | bc -l) + free_mem_pct=$(echo "scale=1; ${free_mem_pct}*100/1" | bc -l) + echo "${free_mem}/${total_mem}MB ${free_mem_pct}%[f]" sleep 3 done