All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
To: kvm-ppc@vger.kernel.org
Subject: [kvm-ppc-devel] updated kvmstat script to read kvmppc stats in non
Date: Fri, 28 Mar 2008 14:50:58 +0000	[thread overview]
Message-ID: <47ED05D2.2030209@linux.vnet.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

related to the patch I just submitted.
new script attached.


-- 

Grüsse / regards, 
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization

[-- Attachment #2: kvmstat --]
[-- Type: text/plain, Size: 1386 bytes --]

#!/bin/bash

dir="/sys/kernel/debug/kvm"

items=`ls -U $dir/exits $dir/dcr $dir/mmio $dir/sig $dir/light $dir/itlb_v $dir/itlb_r $dir/isi $dir/dtlb_v $dir/dtlb_r $dir/dsi $dir/inst_emu $dir/sysc $dir/dec $dir/ext_intr | grep -v 44x_tlb0`
duration=2
summode="no"
lph=20
line=-1
if [ $summode = "no" ]
then
	declare -a values
	counter=0
	for i in $items
	do
		values[$counter]=0
		counter=`expr $counter + 1`
	done
fi

kvmstat_header() {
	for i in $items
	do
		printf "|%8s" `basename $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 $items
	do
		val=`cat $i`
		if [ $summode = "no" ]
		then
			cval=$val;
			val=`expr $cval - ${values[$counter]}`
			values[$counter]=$cval
			counter=`expr $counter + 1`	
		fi
        	printf "|%8d" $val
	done
	printf "|\n"

	sleep $duration
done

[-- Attachment #3: Type: text/plain, Size: 278 bytes --]

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

[-- Attachment #4: Type: text/plain, Size: 170 bytes --]

_______________________________________________
kvm-ppc-devel mailing list
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel

                 reply	other threads:[~2008-03-28 14:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47ED05D2.2030209@linux.vnet.ibm.com \
    --to=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.