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/vmstat like style, because of that I wrote a small shell script. Additionally my colleague Christian Bornträger had the need for a top style 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 ;-) --GrĂ¼sse / regards, Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization
#!/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
#!/bin/bash watch --differences -n 1 " kvmtop_once | sort -n -r"
#!/bin/bash cd /sys/kernel/debug/kvm for d in * do cat $d | tr -d \\n echo -e :\\t $d done
------------------------------------------------------------------------- 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/
_______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel