Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CMakeCache.txt
CMakeFiles/
Makefile
cmake_install.cmake
install_manifest.txt
screen-cpu-usage
*.swp
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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%



Expand Down Expand Up @@ -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



Expand Down
8 changes: 5 additions & 3 deletions screen-mem-usage
Original file line number Diff line number Diff line change
@@ -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