617c66b9 | 24-Aug-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: fix handling of invalid paths in debugfs provider
When filtering by guest, kvm_stat displays garbage when the guest is destroyed - see sample output below. We add code to remove the
tools/kvm_stat: fix handling of invalid paths in debugfs provider
When filtering by guest, kvm_stat displays garbage when the guest is destroyed - see sample output below. We add code to remove the invalid paths from the providers, so at least no more garbage is displayed. Here's a sample output to illustrate:
kvm statistics - pid 13986 (foo)
Event Total %Total CurAvg/s diagnose_258 -2 0.0 0 deliver_program_interruption -3 0.0 0 diagnose_308 -4 0.0 0 halt_poll_invalid -91 0.0 -6 deliver_service_signal -244 0.0 -16 halt_successful_poll -250 0.1 -17 exit_pei -285 0.1 -19 exit_external_request -312 0.1 -21 diagnose_9c -328 0.1 -22 userspace_handled -713 0.1 -47 halt_attempted_poll -939 0.2 -62 deliver_emergency_signal -3126 0.6 -208 halt_wakeup -7199 1.5 -481 exit_wait_state -7379 1.5 -493 diagnose_500 -56499 11.5 -3757 exit_null -85491 17.4 -5685 diagnose_44 -133300 27.1 -8874 exit_instruction -195898 39.8 -13037 Total -492063
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
show more ...
|
1f97e01a | 23-Mar-2018 |
Cole Robinson <crobinso@redhat.com> |
tools/kvm_stat: Remove unused function
Unused since added in 18e8f4100
Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-and-tested-by: Stefan Raspl <stefan.raspl@linux.vnet.ibm.com> Sign
tools/kvm_stat: Remove unused function
Unused since added in 18e8f4100
Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-and-tested-by: Stefan Raspl <stefan.raspl@linux.vnet.ibm.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
show more ...
|
0866c31b | 23-Mar-2018 |
Cole Robinson <crobinso@redhat.com> |
tools/kvm_stat: Don't use deprecated file()
$ python3 tools/kvm/kvm_stat/kvm_stat Traceback (most recent call last): File "tools/kvm/kvm_stat/kvm_stat", line 1668, in <module> main() File "t
tools/kvm_stat: Don't use deprecated file()
$ python3 tools/kvm/kvm_stat/kvm_stat Traceback (most recent call last): File "tools/kvm/kvm_stat/kvm_stat", line 1668, in <module> main() File "tools/kvm/kvm_stat/kvm_stat", line 1639, in main assign_globals() File "tools/kvm/kvm_stat/kvm_stat", line 1618, in assign_globals for line in file('/proc/mounts'): NameError: name 'file' is not defined
open() is the python3 way, and works on python2.6+
Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-and-tested-by: Stefan Raspl <stefan.raspl@linux.vnet.ibm.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
show more ...
|
6789af03 | 22-Feb-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: print 'Total' line for multiple events only
The 'Total' line looks a bit weird when we have a single event only. This can happen e.g. due to filters. Therefore suppress when there's
tools/kvm_stat: print 'Total' line for multiple events only
The 'Total' line looks a bit weird when we have a single event only. This can happen e.g. due to filters. Therefore suppress when there's only a single event in the output.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
df72ecfc | 22-Feb-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: group child events indented after parent
We keep the current logic that sorts all events (parent and child), but re-shuffle the events afterwards, grouping the children after the res
tools/kvm_stat: group child events indented after parent
We keep the current logic that sorts all events (parent and child), but re-shuffle the events afterwards, grouping the children after the respective parent. Note that the percentage column for child events gives the percentage of the parent's total. Since we rework the logic anyway, we modify the total average calculation to use the raw numbers instead of the (rounded) averages. Note that this can result in differing numbers (between total average and the sum of the individual averages) due to rounding errors.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
18e8f410 | 22-Feb-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: separate drilldown and fields filtering
Drilldown (i.e. toggle display of child trace events) was implemented by overriding the fields filter. This resulted in inconsistencies: E.g.
tools/kvm_stat: separate drilldown and fields filtering
Drilldown (i.e. toggle display of child trace events) was implemented by overriding the fields filter. This resulted in inconsistencies: E.g. when drilldown was not active, adding a filter that also matches child trace events would not only filter fields according to the filter, but also add in the child trace events matching the filter. E.g. on x86, setting 'kvm_userspace_exit' as the fields filter after startup would result in display of kvm_userspace_exit(DCR), although that wasn't previously present - not exactly what one would expect from a filter. This patch addresses the issue by keeping drilldown and fields filter separate. While at it, we also fix a PEP8 issue by adding a blank line at one place (since we're in the area...). We implement this by adding a framework that also allows to define a taxonomy among the debugfs events to identify child trace events. I.e. drilldown using 'x' can now also work with debugfs. A respective parent- child relationship is only known for S390 at the moment, but could be added adjusting other platforms' ARCH.dbg_is_child() methods accordingly.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
516f1190 | 22-Feb-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: eliminate extra guest/pid selection dialog
We can do with a single dialog that takes both, pids and guest names. Note that we keep both interactive commands, 'p' and 'g' for now, to
tools/kvm_stat: eliminate extra guest/pid selection dialog
We can do with a single dialog that takes both, pids and guest names. Note that we keep both interactive commands, 'p' and 'g' for now, to avoid confusion among users used to a specific key.
While at it, we improve on some minor glitches regarding curses usage, e.g. cursor still visible when not supposed to be.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
c0e8c21e | 22-Feb-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: mark private methods as such
Helps quite a bit reading the code when it's obvious when a method is intended for internal use only.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.
tools/kvm_stat: mark private methods as such
Helps quite a bit reading the code when it's obvious when a method is intended for internal use only.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
1fd6a708 | 22-Feb-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: fix debugfs handling
Te checks for debugfs assumed that debugfs is always mounted at /sys/kernel/debug - which is likely, but not guaranteed. This is addressed by checking /proc/moun
tools/kvm_stat: fix debugfs handling
Te checks for debugfs assumed that debugfs is always mounted at /sys/kernel/debug - which is likely, but not guaranteed. This is addressed by checking /proc/mounts for the actual location. Furthermore, when debugfs was mounted, but the kvm module not loaded, a misleading error pointing towards debugfs not present was given. To reproduce, (a) run kvm_stat with debugfs mounted at a place different from /sys/kernel/debug (b) run kvm_stat with debugfs mounted but kvm module not loaded
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
1cd8bfb1 | 05-Feb-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: print error on invalid regex
Entering an invalid regular expression did not produce any indication of an error so far. To reproduce, press 'f' and enter 'foo(' (with an unescaped bra
tools/kvm_stat: print error on invalid regex
Entering an invalid regular expression did not produce any indication of an error so far. To reproduce, press 'f' and enter 'foo(' (with an unescaped bracket).
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
3df33a0f | 05-Feb-2018 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: fix crash when filtering out all non-child trace events
When we apply a filter that will only leave child trace events, we receive a ZeroDivisionError when calculating the percentage
tools/kvm_stat: fix crash when filtering out all non-child trace events
When we apply a filter that will only leave child trace events, we receive a ZeroDivisionError when calculating the percentages. In that case, provide percentages based on child events only. To reproduce, run 'kvm_stat -f .*[\(].*'.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
369d5a85 | 09-Jan-2018 |
Marc Hartmayer <mhartmay@linux.vnet.ibm.com> |
tools/kvm_stat: avoid 'is' for equality checks
Use '==' for equality checks and 'is' when comparing identities.
An example where '==' and 'is' behave differently: >>> a = 4242 >>> a == 4242 True >>
tools/kvm_stat: avoid 'is' for equality checks
Use '==' for equality checks and 'is' when comparing identities.
An example where '==' and 'is' behave differently: >>> a = 4242 >>> a == 4242 True >>> a is 4242 False
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
0eb57800 | 09-Jan-2018 |
Marc Hartmayer <mhartmay@linux.vnet.ibm.com> |
tools/kvm_stat: use a more pythonic way to iterate over dictionaries
If it's clear that the values of a dictionary will be used then use the '.items()' method.
Signed-off-by: Marc Hartmayer <mhartm
tools/kvm_stat: use a more pythonic way to iterate over dictionaries
If it's clear that the values of a dictionary will be used then use the '.items()' method.
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Tested-by: Stefan Raspl <raspl@linux.vnet.ibm.com> [Include fix for logging mode by Stefan Raspl] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
006f1548 | 09-Jan-2018 |
Marc Hartmayer <mhartmay@linux.vnet.ibm.com> |
tools/kvm_stat: use a namedtuple for storing the values
Use a namedtuple for storing the values as it allows to access the fields of a tuple via names. This makes the overall code much easier to rea
tools/kvm_stat: use a namedtuple for storing the values
Use a namedtuple for storing the values as it allows to access the fields of a tuple via names. This makes the overall code much easier to read and to understand. Access by index is still possible as before.
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Tested-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
aa12f594 | 21-Dec-2017 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: sort '-f help' output
Sort the fields returned by specifying '-f help' on the command line. While at it, simplify the code a bit, indent the output and eliminate an extra blank line
tools/kvm_stat: sort '-f help' output
Sort the fields returned by specifying '-f help' on the command line. While at it, simplify the code a bit, indent the output and eliminate an extra blank line at the beginning.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
cf656c76 | 11-Dec-2017 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: add line for totals
Add a line for the total number of events and current average at the bottom of the body. Note that both values exclude child trace events. I.e. if drilldown is ac
tools/kvm_stat: add line for totals
Add a line for the total number of events and current average at the bottom of the body. Note that both values exclude child trace events. I.e. if drilldown is activated via interactive command 'x', only the totals are accounted, or we'd be counting these twice (see previous commit "tools/kvm_stat: fix child trace events accounting").
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
73fab6ff | 11-Dec-2017 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: stop ignoring unhandled arguments
Unhandled arguments, which could easily include typos, are simply ignored. We should be strict to avoid undetected typos. To reproduce start kvm_sta
tools/kvm_stat: stop ignoring unhandled arguments
Unhandled arguments, which could easily include typos, are simply ignored. We should be strict to avoid undetected typos. To reproduce start kvm_stat with an extra argument, e.g. 'kvm_stat -d bnuh5ol' and note that this will actually work.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
822cfe3e | 11-Dec-2017 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: suppress usage information on command line errors
Errors while parsing the '-g' command line argument result in display of usage information prior to the error message. This is a bit
tools/kvm_stat: suppress usage information on command line errors
Errors while parsing the '-g' command line argument result in display of usage information prior to the error message. This is a bit confusing, as the command line is syntactically correct. To reproduce, run 'kvm_stat -g' and specify a non-existing or inactive guest.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
08e20a63 | 11-Dec-2017 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: handle invalid regular expressions
Passing an invalid regular expression on the command line results in a traceback. Note that interactive specification of invalid regular expression
tools/kvm_stat: handle invalid regular expressions
Passing an invalid regular expression on the command line results in a traceback. Note that interactive specification of invalid regular expressions is not affected To reproduce, run "kvm_stat -f '*'".
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
f3d11b0e | 11-Dec-2017 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: add hint on '-f help' to man page
The man page update for this new functionality was omitted.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pb
tools/kvm_stat: add hint on '-f help' to man page
The man page update for this new functionality was omitted.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
fff8c9eb | 11-Dec-2017 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: fix child trace events accounting
Child trace events were included in calculation of the overall total, which is used for calculation of the percentages of the '%Total' column. Howev
tools/kvm_stat: fix child trace events accounting
Child trace events were included in calculation of the overall total, which is used for calculation of the percentages of the '%Total' column. However, the parent trace envents' stats summarize the child trace events, hence we'd incorrectly account for them twice, leading to slightly wrong stats. With this fix, we use the correct total. Consequently, the sum of the child trace events' '%Total' column values is identical to the respective value of the respective parent event. However, this also means that the sum of the '%Total' column values will aggregate to more than 100 percent.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
b74faa93 | 11-Dec-2017 |
Stefan Raspl <stefan.raspl@de.ibm.com> |
tools/kvm_stat: fix extra handling of 'help' with fields filter
Commit 67fbcd62f54d ("tools/kvm_stat: add '-f help' to get the available event list") added support for '-f help'. However, the extra
tools/kvm_stat: fix extra handling of 'help' with fields filter
Commit 67fbcd62f54d ("tools/kvm_stat: add '-f help' to get the available event list") added support for '-f help'. However, the extra handling of 'help' will also take effect when 'help' is specified as a regex in interactive mode via 'f'. This results in display of all events while only those matching this regex should be shown.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|