From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Ehrhardt Subject: script for watching kvm_stat Date: Mon, 17 Mar 2008 16:09:17 +0100 Message-ID: <47DE899D.7000207@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000909050308040302040508" To: kvm-ppc-devel , Hollis Blanchard , CBORNTRA@de.ibm.com, "kvm-devel@lists.sourceforge.net" Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org This is a multi-part message in MIME format. --------------000909050308040302040508 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable I added the kvm_stat support to ppc to watch my guest while executing e.g= . to check things like "what does my guest do when I see nothing" ;-) To be able to do that I also needed a script that reports in a iostat/vms= tat like style, because of that I wrote a small shell script. Additionally my colleague Christian Borntr=E4ger had the need for a top s= tyle output and wrote a script for that need. I attached both to help everyone experimenting with kvm_stat. They are just small helpers and might still contain issues, feel free to = comment, correct, whatever ;-) --=20 Gr=FCsse / regards,=20 Christian Ehrhardt IBM Linux Technology Center, Open Virtualization --------------000909050308040302040508 Content-Type: text/plain; name="kvmstat" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kvmstat" #!/bin/bash kvmstatdir="/sys/kernel/debug/kvm" duration=2 summode="no" lph=20 line=-1 if [ $summode = "no" ] then declare -a values counter=0 for i in `ls $kvmstatdir` do values[$counter]=0 counter=`expr $counter + 1` done fi kvmstat_header() { for i in `ls $kvmstatdir` do printf "|%16s " $i done printf "|\n" } USAGE="Usage: `basename $0` [-d arg] [-l arg] [-hs]" while getopts hvsd:l: OPT; do case "$OPT" in h) echo $USAGE echo "d - sleep between reported lines" echo "l - number of lines betweeen headers" echo "s - summary mode (default is difference since last print)" exit 0 ;; v) echo "`basename $0` version 0.1" exit 0 ;; d) duration=$OPTARG ;; l) lph=$OPTARG ;; s) summode="yes" ;; \?) # getopts issues an error message echo $USAGE >&2 exit 1 ;; esac done while true do line=`expr $line + 1` line=`expr $line % $lph` if [ $line -eq "0" ] then kvmstat_header fi counter=0 for i in `ls $kvmstatdir` do val=`cat $kvmstatdir/$i` if [ $summode = "no" ] then cval=$val; val=`expr $cval - ${values[$counter]}` values[$counter]=$cval counter=`expr $counter + 1` fi printf "|%16d " $val done printf "|\n" sleep $duration done --------------000909050308040302040508 Content-Type: text/plain; name="kvmtop" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kvmtop" #!/bin/bash watch --differences -n 1 " kvmtop_once | sort -n -r" --------------000909050308040302040508 Content-Type: text/plain; name="kvmtop_once" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kvmtop_once" #!/bin/bash cd /sys/kernel/debug/kvm for d in * do cat $d | tr -d \\n echo -e :\\t $d done --------------000909050308040302040508 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ --------------000909050308040302040508 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------000909050308040302040508--