--- Em sáb, 2/2/13, Fernando de Oliveira escreveu: > De: Fernando de Oliveira > Assunto: Re: [blfs-support] Swap use and speed doubts > Para: "BLFS Support List" > Data: Sábado, 2 de Fevereiro de 2013, 7:25 > --- Em qui, 31/1/13, Simon Geard > escreveu: > > > De: Simon Geard > > Assunto: Re: [blfs-support] Swap use and speed doubts > > Para: blfs-support > > Data: Quinta-feira, 31 de Janeiro de 2013, 3:48 > > On Wed, 2013-01-30 at 03:31 -0800, > > Fernando de Oliveira wrote:
... > > > 2. How a system with so much RAM is swapping? > > > > Because swap isn't just extra memory to use once RAM > runs > > out. ... > I was still trying to understand the other question, and can > now > answer. Question was essentially why Conky and a script I > reproduced > in the first mail give different swap values. Now, I include > GKrellM ... > script must be run by a privileged user. Again, I got the script from the internet (URL in the script). I have included a test for the user. I do not know if what I have included is a good test, if anyone thinks it is not, and has a better test, I would much appreciate if you please tell me what to change. For this and if anyone is interested, I include, after the signature, the modified script. []s, Fernando $ cat .find-out-what-is-using-your-swap.sh #!/bin/bash # Get current swap usage for all running processes # Erik Ljungstrom 27/05/2011 # http://northernmost.org/blog/find-out-what-is-using-your-swap/ # Modified by Mikko Rantalainen 2012-08-09 # http://stackoverflow.com/questions/479953/how-to-find-out-which-processes-are-swapping-in-linux # Pipe the output to "sort -nk3" to get sorted output # Modified by Fernando 2013/02/02 # User must be "root" [ `id -u` != 0 ] && echo "results may be wrong for unprivileged user" && echo "present user is *$(whoami)*" && echo "please, change to *root*" && exit SUM=0 OVERALL=0 for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"` do PID=`echo $DIR | cut -d / -f 3` PROGNAME=`ps -p $PID -o comm --no-headers` for SWAP in `grep Swap $DIR/smaps 2>/dev/null | awk '{ print $2 }'` do let SUM=$SUM+$SWAP done if (( $SUM > 0 )); then echo "PID=$PID swapped $SUM KB ($PROGNAME)" fi let OVERALL=$OVERALL+$SUM SUM=0 done echo "Overall swap used: $OVERALL KB" -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page