add memory usage information

This commit is contained in:
Dustin Kirkland 2009-01-22 00:08:38 -05:00
commit 5d90d8cba1
6 changed files with 14 additions and 6 deletions

View file

@ -1,11 +1,11 @@
#!/bin/sh -e
mem=`grep -m 1 "^MemTotal:" /proc/meminfo | sed 's/ kB$//' | sed 's/^.* //'`
mem=`free | grep -m 1 "^Mem:" | awk '{print $2}'`
if [ $mem -gt 1000000 -a -x /usr/bin/bc ]; then
mem=$(echo "scale=1; $mem/1000000" | bc)
echo "$mem""GB"
elif [ $mem -gt 1000 -a -x /usr/bin/bc ]; then
mem=$(echo "scale=1; $mem/1000" | bc)
mem=$(echo "scale=0; $mem/1000" | bc)
echo "$mem""MB"
else
echo "$mem""KB"

4
bin/mem-used Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh -e
mem=`free | grep -m 1 "^Mem:" | awk '{printf "%.0f", 100 * $3 / $2}'`
echo $mem"%"

6
debian/changelog vendored
View file

@ -1,8 +1,10 @@
screen-profiles (1.13) UNRELEASED; urgency=low
*
* bin/updates-available: fix bug when no updates are available
* bin/mem-used, profiles/common, profiles/ubuntu: add memory usage
information
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 21 Jan 2009 01:42:57 -0600
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 22 Jan 2009 00:08:15 -0500
screen-profiles (1.12-0ubuntu1) jaunty; urgency=low

1
debian/install vendored
View file

@ -2,6 +2,7 @@ bin/cpu-count usr/share/screen-profiles/bin
bin/cpu-freq usr/share/screen-profiles/bin
bin/load-average usr/share/screen-profiles/bin
bin/mem-available usr/share/screen-profiles/bin
bin/mem-used usr/share/screen-profiles/bin
bin/reboot-required usr/share/screen-profiles/bin
bin/release usr/share/screen-profiles/bin
bin/updates-available usr/share/screen-profiles/bin

View file

@ -31,11 +31,12 @@ msgwait 1
# Define status commands
backtick 100 3600 3600 /usr/share/screen-profiles/bin/release
backtick 101 60 60 /usr/share/screen-profiles/bin/updates-available
backtick 102 10 10 /usr/share/screen-profiles/bin/reboot-required
backtick 102 5 5 /usr/share/screen-profiles/bin/reboot-required
backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq
backtick 104 3600 3600 /usr/share/screen-profiles/bin/cpu-count
backtick 105 3600 3600 /usr/share/screen-profiles/bin/mem-available
backtick 106 5 5 /usr/share/screen-profiles/bin/load-average
backtick 107 10 10 /usr/share/screen-profiles/bin/mem-used
hardstatus alwayslastline

View file

@ -21,7 +21,7 @@
source /usr/share/screen-profiles/profiles/common
hardstatus string '%{+b Wr}\%{= Wy}o%{=b WY}/%{=b Wk} %100` %{= Wk} %= %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%105`%{= Wk} %Y-%m-%d %0c:%s'
hardstatus string '%{+b Wr}\%{= Wy}o%{=b WY}/%{=b Wk} %100` %{= Wk} %= %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%107`/%105`%{= Wk} %Y-%m-%d %0c:%s'
# NOTE: There is an arbitrary limit of being able to change colors 16 times
# in this 'hardstatus string'.