public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: [PATCH 3/4] kvm_stat: allow enabling/disabling events dynamicalls
Date: Thu, 17 Feb 2011 14:42:49 +0200	[thread overview]
Message-ID: <1297946570-477-4-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1297946570-477-1-git-send-email-avi@redhat.com>

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 kvm/kvm_stat |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/kvm/kvm_stat b/kvm/kvm_stat
index 2e1fe73..e3e9def 100755
--- a/kvm/kvm_stat
+++ b/kvm/kvm_stat
@@ -265,10 +265,11 @@ class TracepointProvider(object):
                 for name, number in values.iteritems():
                     extra.append(f + '(' + name + ')')
         fields += extra
+        self._setup(fields)
         self.select(fields)
     def fields(self):
         return self._fields
-    def select(self, _fields):
+    def _setup(self, _fields):
         self._fields = _fields
         cpure = r'cpu([0-9]+)'
         self.cpus = [int(re.match(cpure, x).group(1))
@@ -293,6 +294,13 @@ class TracepointProvider(object):
                                         tracepoint = tracepoint,
                                         filter = filter)
             self.group_leaders.append(group)
+    def select(self, fields):
+        for group in self.group_leaders:
+            for event in group.events:
+                if event.name in fields:
+                    event.enable()
+                else:
+                    event.disable()
     def read(self):
         from collections import defaultdict
         ret = defaultdict(int)
-- 
1.7.1


  parent reply	other threads:[~2011-02-17 12:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-17 12:42 [PATCH 0/4] Enable drilldown for kvm_exit reasons Avi Kivity
2011-02-17 12:42 ` [PATCH 1/4] kvm_stat: move groups and events into well defined objects Avi Kivity
2011-02-17 12:42 ` [PATCH 2/4] kvm_stat: add wrappers for perf_event enable and disable ioctls Avi Kivity
2011-02-17 12:42 ` Avi Kivity [this message]
2011-02-17 12:42 ` [PATCH 4/4] kvm_stat: add 'x' key for enabling/disabling "drilldown" Avi Kivity

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=1297946570-477-4-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox