[PATCH 3/4] kvm_stat: allow enabling/disabling events dynamicalls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux