Hi Avi,
2008/3/17, Avi Kivity <[EMAIL PROTECTED]>:
> Ryota OZAKI wrote:
> > Hi all,
> >
> > This patch allows a VM to have own directory on debugfs,
> > that contains statics only for the VM. Each directory
> > is identified by the pid of the VM (ie qemu).
> >
> > I tried this patch under several host kernel versions,
> > .22, .23, and .24, and confirmed things work out well.
> >
>
>
> Nice patch; it's certainly useful to improve per-vm trace capabilities.
>
> It would be nice to keep the summary, since that allows running kvm_stat
> with no arguments.
My patch keeps the summary. But it actually breaks a kvm_stat's assumption
so kvm_stat doesn't work under kvm with my patch. I wrote a patch to fix this
problem. See the following patch. (i'm not familiar with python, sorry.)
> On the other hand, the kvmtrace patchset recently posted adds much more
> detailed data; we should probably concentrate on that as a means of
> improving performance tracing.
The patchset is useful for me, too. I will concentrate that as well.
Thanks,
ozaki-r
> --
> error compiling committee.c: too many arguments to function
Signed-off-by: Ryota Ozaki <[EMAIL PROTECTED]>
--
kvm_stat | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/kvm_stat b/kvm_stat
index 07773b0..e507e62 100755
--- a/kvm_stat
+++ b/kvm_stat
@@ -4,11 +4,15 @@ import curses
import sys, os, time, optparse
class Stats:
- def __init__(self):
- self.base = '/sys/kernel/debug/kvm'
+ def __init__(self, pid = None):
+ if pid:
+ self.base = '/sys/kernel/debug/kvm/' + pid
+ else:
+ self.base = '/sys/kernel/debug/kvm'
self.values = {}
for key in os.listdir(self.base):
- self.values[key] = None
+ if not os.path.isdir(self.base + '/' + key):
+ self.values[key] = None
def get(self):
for key, oldval in self.values.iteritems():
newval = int(file(self.base + '/' + key).read())
@@ -26,7 +30,6 @@ if not os.access('/sys/kernel/debug/kvm', os.F_OK):
print "and ensure the kvm modules are loaded"
sys.exit(1)
-stats = Stats()
label_width = 20
number_width = 10
@@ -73,14 +76,22 @@ def batch(stats):
values = s[key]
print '%-22s%10d%10d' % (key, values[0], values[1])
-options = optparse.OptionParser()
-options.add_option('-1', '--once', '--batch',
+usage = "usage: %prog [options] [<pid>]"
+parser = optparse.OptionParser(usage)
+parser.add_option('-1', '--once', '--batch',
action = 'store_true',
default = False,
dest = 'once',
help = 'run in batch mode for one second',
)
-(options, args) = options.parse_args(sys.argv)
+(options, args) = parser.parse_args(sys.argv)
+
+if len(args) == 1:
+ stats = Stats()
+elif len(args) == 2:
+ stats = Stats(args[1])
+else:
+ parser.error("too many arguments.")
if not options.once:
import curses.wrapper
--
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel