10 Oct, 2018
2 commits
-
[ Upstream commit 617c66b9f236d20f11cecbb3f45e6d5675b2fae1 ]
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 -492063Signed-off-by: Stefan Raspl
Signed-off-by: Radim Krčmář
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman -
[ Upstream commit 58f33cfe73076b6497bada4f7b5bda961ed68083 ]
Python3 returns a float for a regular division - switch to a division
operator that returns an integer.
Furthermore, filters return a generator object instead of the actual
list - wrap result in yet another list, which makes it still work in
both, Python2 and 3.Signed-off-by: Stefan Raspl
Signed-off-by: Radim Krčmář
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
02 Nov, 2017
1 commit
-
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
27 Jul, 2017
2 commits
-
Signed-off-by: Lin Ma
Signed-off-by: Paolo Bonzini -
Using variables instead of hard paths makes the requirements information
more accurate.Signed-off-by: Lin Ma
Signed-off-by: Paolo Bonzini
27 Jun, 2017
3 commits
-
Toggle display total number of events by guest (debugfs only).
When switching to display of events by guest, field filters remain
active. I.e. the number of events per guest reported considers only
events matching the filters. Likewise with pid/guest filtering.
Note that when switching to display of events by guest, DebugfsProvider
remains to collect data for events as it did before, but the read()
method summarizes the values by pid.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
It might be handy to display the full history of event stats to compare
the current event distribution against any available historic data.
Since we have that available for debugfs, we offer a respective command
line option to display what's available.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Fix an instance where print_all_gnames() is called without the mandatory
argument, resulting in a stack trace.
To reproduce, simply press 'g' in interactive mode.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini
09 Jun, 2017
17 commits
-
Display a (possibly inaccurate) list of all running guests. Note that we
leave a bit of extra room above the list for potential error messages.
Furthermore, we deliberately do not reject pids or guest names that are
not in our list, as we cannot rule out that our fuzzy approach might be
in error somehow.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Add new interactive command 'o' to toggle sorting by 'CurAvg/s' (default)
and 'Total' columns.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Add new command 's' to modify the update interval. Limited to a maximum of
25.5 sec and a minimum of 0.1 sec, since curses cannot handle longer
and shorter delays respectively.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Display interactive commands reference on 'h'.
While at it, sort interactive commands alphabetically in various places.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
'Current' can be misleading as it doesn't tell whether this is the amount
of events in the last interval or the current average per second.
Note that this necessitates widening the respective column by one more
character.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Print header in standout font just like the 'top' command does.
Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Give users some indication on the reason why no data is displayed on the
screen yet.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Show the cursor in the interactive screens to specify pid, filter or guest
name as an orientation for the user.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Quite a few of the functions are used only in a single class. Moving
functions accordingly to improve the overall structure.
Furthermore, introduce a base class for the providers, which might also
come handy for future extensions.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Simplify a couple of initialization routines:
* TracepointProvider and DebugfsProvider: Pass pid into __init__() instead
of switching to the requested value in an extra call after initializing
to the default first.
* Pass a single options object into Stats.__init__(), delaying options
evaluation accordingly, instead of evaluating options first and passing
several parts of the options object to Stats.__init__() individually.
* Eliminate Stats.update_provider_pid(), since this 2-line function is now
used in a single place only.
* Remove extra call to update_drilldown() in Tui.__init__() by getting the
value of options.fields right initially when parsing options.
* Simplify get_providers() logic.
* Avoid duplicate fields initialization by handling it once in the
providers' __init__() methods.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Function available_fields() is not used in any place.
Signed-off-by: Stefan Raspl
Reviewed-by: Janosch Frank
Signed-off-by: Paolo Bonzini -
Simplify line print logic for header and data lines in interactive mode
as previously suggested by Radim.
While at it, add a space between the first two columns to avoid the
total bleeding into the event name.
Furthermore, for column 'Current', differentiate between no events being
reported (empty 'Current' column) vs the case where events were reported
but the average was rounded down to zero ('0' in 'Current column), for
the folks who appreciate the difference.
Finally: Only skip events which were not reported at all yet, instead of
events that don't have a value in the current interval.
Considered using constants for the field widths in the format strings.
However, that would make things a bit more complicated, and considering
that there are only two places where output happens, I figured it isn't
worth the trouble.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Certain interactive commands will not modify any information displayed in
the header, hence we can skip them.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
We should not use the initial sleeptime for any key press that does not
switch to a different screen, as that introduces an unaesthetic flicker due
to two updates in quick succession.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
When an update interval is interrupted via key press (e.g. space), the
'Current' column value is calculated using the full interval length
instead of the elapsed time, which leads to lower than actual numbers.
Furthermore, the value should be rounded, not truncated.
This is fixed by using the actual elapsed time for the calculation.Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini -
Signed-off-by: Stefan Raspl
Signed-off-by: Paolo Bonzini
29 Mar, 2017
15 commits
-
Add column '%Total' next to 'Total' for easier comparison of numbers between
hosts.Signed-off-by: Stefan Raspl
Marc Hartmayer
Signed-off-by: Radim Krčmář -
Provide an interactive command to reset the tracepoint statistics.
Requires some extra work for debugfs, as the counters cannot be reset.On the up side, this offers us the opportunity to have debugfs values
reset on startup and whenever a filter is modified, becoming consistent
with the tracepoint provider. As a bonus, 'kvmstat -dt' will now provide
useful output, instead of mixing values in totally different orders of
magnitude.
Furthermore, we avoid unnecessary resets when any of the filters is
"changed" interactively to the previous value.Signed-off-by: Stefan Raspl
Acked-by: Janosch Frank
Signed-off-by: Radim Krčmář -
Provide a real simple way to erase any active filter.
Signed-off-by: Stefan Raspl
Reviewed-by: Marc Hartmayer
Signed-off-by: Radim Krčmář -
Add a new option '-g'/'--guest' to select a particular process by providing
the QEMU guest name.
Notes:
- The logic to figure out the pid corresponding to the guest name might look
scary, but works pretty reliably in practice; in the unlikely event that it
returns add'l flukes, it will bail out and hint at using '-p' instead, no
harm done.
- Mixing '-g' and '-p' is possible, and the final instance specified on the
command line is the significant one. This is consistent with current
behavior for '-p' which, if specified multiple times, also regards the final
instance as the significant one.Signed-off-by: Stefan Raspl
Reviewed-by: Janosch Frank
Signed-off-by: Radim Krčmář -
Behavior on empty/0 input for regex and pid filtering was inconsistent, as
the former would keep the current filter, while the latter would (naturally)
remove any pid filtering.
Make things consistent by falling back to the default filter on empty input
for the regex filter dialogue.Signed-off-by: Stefan Raspl
Reviewed-by: Marc Hartmayer
Signed-off-by: Radim Krčmář -
If a user defines a regex filter through the interactive command, display
the active regex in the header's second line.Signed-off-by: Stefan Raspl
Reviewed-by: Marc Hartmayer
Signed-off-by: Radim Krčmář -
Print helpful messages in case users enter invalid input or invalid pids in
the interactive pid filter dialogue.Signed-off-by: Stefan Raspl
Reviewed-by: Marc Hartmayer
Signed-off-by: Radim Krčmář -
Improve consistency in the interactive dialogue for pid filtering by
removing any filters on empty input (in addition to entering 0).Signed-off-by: Stefan Raspl
Reviewed-by: Janosch Frank
Reviewed-by: Marc Hartmayer
Signed-off-by: Radim Krčmář -
When running kvm_stat with option '-p' to filter per process, display
the QEMU guest name next to the pid, if available.Signed-off-by: Stefan Raspl
Reviewed-By: Janosch Frank
Signed-off-by: Radim Krčmář -
Apart from the source code, there does not seem to be a place that documents
the interactive capabilities of kvm_stat yet.Signed-off-by: Stefan Raspl
Signed-off-by: Radim Krčmář -
Whenever a user adds a filter, we
* redraw the header immediately for a snappy response
* print a message indicating to the user that we're busy while the
noticeable delay induced by updating all of the stats objects takes place
* update the statistics ASAP (i.e. after 0.25s instead of 3s) to be
consistent with behavior on startup
To do so, we split the Tui's refresh() method to allow for drawing header
and stats separately, and trigger a header refresh whenever we are about
to do something that takes a while - like updating filters.Signed-off-by: Stefan Raspl
Signed-off-by: Radim Krčmář -
Provides all missing empty lines as required for full PEP compliance.
Signed-off-by: Stefan Raspl
Reviewed-by: Marc Hartmayer
Signed-off-by: Radim Krčmář -
Updating the fields of the TracepointProvider does not propagate changes to the
tracepoints. This shows when a pid filter is enabled, whereby subsequent
extensions of the fields of the Tracepoint provider (e.g. by toggling
drilldown) will not modify the tracepoints as required.
To reproduce, select a specific process via interactive command 'p', and
enable drilldown via 'x' - none of the fields with the braces will appear
although they should.
The fix will always leave all available fields in the TracepointProvider
enabled.Signed-off-by: Stefan Raspl
Based-on-text-by: Janosch Frank
Signed-off-by: Radim Krčmář -
Addresses
- eliminate extra import
- missing variable initialization
- type redefinition from int to float
- passing of int type argument instead of string
- a couple of PEP8-reported indentation/formatting glitches
- remove unused variable drilldown in class TuiSigned-off-by: Stefan Raspl
Reviewed-by: Marc Hartmayer
Signed-off-by: Radim Krčmář -
SIGINT causes ugly unhandled exceptions in log and batch mode, which we
prevent by catching the exceptions accordingly.Signed-off-by: Stefan Raspl
Reviewed-by: Marc Hartmayer
Signed-off-by: Radim Krčmář