[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [OT] keep memory under control
From: "Roberto A. Foglietta" <roberto.foglietta () gmail ! com>
Date: 2007-08-31 15:02:13
Message-ID: e4c675870708310802q21729675p6a07723f4c66505f () mail ! gmail ! com
[Download RAW message or body]
Hi to all folks,
sorry for the OT but I hope these scripts will be usefull for you too
If I would keep trace of memory (in order to find some naqsty memory
leaks) amount used this script for bb-ash would work in your opinion?
getrssmem() {
local rss=0 lst="$(ls -1 /proc/*/statm | grep -v $$)"
local val="$(for i in $lst; do cat $i 2>/dev/null | cut -d\ -f2; done)"
for i in $val; do let rss+=$i; done
echo $rss
}
getkrnmem() {
local str x y z krn
str=$(free | head -n2 | tail -n1)
x=$(echo $str | cut -d\ -f3)
y=$(echo $str | cut -d\ -f5)
z=$(echo $str | cut -d\ -f6)
let krn=$x-$y-$z-$1
echo $krn
}
waituntilminute() {
local x
let x=$(date +%s)%60
let x=60-$x
sleep $x
}
while true; do
waituntilminute
rss=$(getrssmem); echo -n "$rss "; getkrnmem $rss
done
Cheers,
--
/roberto
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic