summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStefan Raspl <stefan.raspl@de.ibm.com>2019-04-21 09:26:24 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2019-05-24 15:27:17 -0400
commit883d25e70b2f699fed9017e509d1ef8e36229b89 (patch)
tree85b0ef25b39e9ea8214f6635b9e05cbf3bcf7842 /tools
parentc795720629ae1bfcbaef7a934a4cc1ce8c2e2834 (diff)
tools/kvm_stat: fix fields filter for child events
The fields filter would not work with child fields, as the respective parents would not be included. No parents displayed == no childs displayed. To reproduce, run on s390 (would work on other platforms, too, but would require a different filter name): - Run 'kvm_stat -d' - Press 'f' - Enter 'instruct' Notice that events like instruction_diag_44 or instruction_diag_500 are not displayed - the output remains empty. With this patch, we will filter by matching events and their parents. However, consider the following example where we filter by instruction_diag_44: kvm statistics - summary regex filter: instruction_diag_44 Event Total %Total CurAvg/s exit_instruction 276 100.0 12 instruction_diag_44 256 92.8 11 Total 276 12 Note that the parent ('exit_instruction') displays the total events, but the childs listed do not match its total (256 instead of 276). This is intended (since we're filtering all but one child), but might be confusing on first sight. Signed-off-by: Stefan Raspl <raspl@linux.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/kvm/kvm_stat/kvm_stat16
-rw-r--r--tools/kvm/kvm_stat/kvm_stat.txt2
2 files changed, 14 insertions, 4 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 2ed395b817cb..bc508dae286c 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -575,8 +575,12 @@ class TracepointProvider(Provider):
575 def update_fields(self, fields_filter): 575 def update_fields(self, fields_filter):
576 """Refresh fields, applying fields_filter""" 576 """Refresh fields, applying fields_filter"""
577 self.fields = [field for field in self._get_available_fields() 577 self.fields = [field for field in self._get_available_fields()
578 if self.is_field_wanted(fields_filter, field) or 578 if self.is_field_wanted(fields_filter, field)]
579 ARCH.tracepoint_is_child(field)] 579 # add parents for child fields - otherwise we won't see any output!
580 for field in self._fields:
581 parent = ARCH.tracepoint_is_child(field)
582 if (parent and parent not in self._fields):
583 self.fields.append(parent)
580 584
581 @staticmethod 585 @staticmethod
582 def _get_online_cpus(): 586 def _get_online_cpus():
@@ -735,8 +739,12 @@ class DebugfsProvider(Provider):
735 def update_fields(self, fields_filter): 739 def update_fields(self, fields_filter):
736 """Refresh fields, applying fields_filter""" 740 """Refresh fields, applying fields_filter"""
737 self._fields = [field for field in self._get_available_fields() 741 self._fields = [field for field in self._get_available_fields()
738 if self.is_field_wanted(fields_filter, field) or 742 if self.is_field_wanted(fields_filter, field)]
739 ARCH.debugfs_is_child(field)] 743 # add parents for child fields - otherwise we won't see any output!
744 for field in self._fields:
745 parent = ARCH.debugfs_is_child(field)
746 if (parent and parent not in self._fields):
747 self.fields.append(parent)
740 748
741 @property 749 @property
742 def fields(self): 750 def fields(self):
diff --git a/tools/kvm/kvm_stat/kvm_stat.txt b/tools/kvm/kvm_stat/kvm_stat.txt
index 0811d860fe75..c057ba52364e 100644
--- a/tools/kvm/kvm_stat/kvm_stat.txt
+++ b/tools/kvm/kvm_stat/kvm_stat.txt
@@ -34,6 +34,8 @@ INTERACTIVE COMMANDS
34*c*:: clear filter 34*c*:: clear filter
35 35
36*f*:: filter by regular expression 36*f*:: filter by regular expression
37 :: *Note*: Child events pull in their parents, and parents' stats summarize
38 all child events, not just the filtered ones
37 39
38*g*:: filter by guest name/PID 40*g*:: filter by guest name/PID
39 41