| 8a2a3331 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Make tui function a class
The tui function itself had a few sub-functions and therefore basically already was class-like. Making it an actual one with proper methods improved r
scripts/kvm/kvm_stat: Make tui function a class
The tui function itself had a few sub-functions and therefore basically already was class-like. Making it an actual one with proper methods improved readability.
The curses wrapper was dropped in favour of __entry/exit__ methods that implement the same behaviour.
Also renamed single character variable name, so the name reflects the content.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-28-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 9c0ab054 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS
The architecture detection method directly accesses vmx and smv exit reason constants. Therefore we don't need it anymore.
Signed-off-by: Jano
scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS
The architecture detection method directly accesses vmx and smv exit reason constants. Therefore we don't need it anymore.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-27-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 068294a1 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Group arch specific data
Using global variables and multiple initialization functions for arch specific data makes the code hard to read. By grouping them in the Arch classes w
scripts/kvm/kvm_stat: Group arch specific data
Using global variables and multiple initialization functions for arch specific data makes the code hard to read. By grouping them in the Arch classes we encapsulate and initialize them in one place.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-26-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| d895493b | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Cleanup of Event class
Added additional newlines for readability. Factored out attribute and event setup code into own methods. Exchanged file() with preferred open().
Signed-
scripts/kvm/kvm_stat: Cleanup of Event class
Added additional newlines for readability. Factored out attribute and event setup code into own methods. Exchanged file() with preferred open().
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-25-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| fc9fdeeb | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Cleanup of Groups class
Introduced separating newlines for readability and removed special treatment/variable of the group leader. Renamed fmt to read_format.
The group leader
scripts/kvm/kvm_stat: Cleanup of Groups class
Introduced separating newlines for readability and removed special treatment/variable of the group leader. Renamed fmt to read_format.
The group leader's file descriptor will not be turned into a file object anymore, instead os.read is used to read from the descriptor.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-24-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| e75a36ab | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Cleanup of Stats class
Converted class definition to new style and renamed improper named variables.
Introduced property for fields_filter.
Moved member variable declaration
scripts/kvm/kvm_stat: Cleanup of Stats class
Converted class definition to new style and renamed improper named variables.
Introduced property for fields_filter.
Moved member variable declaration to init, so one can see all class variables when reading the init method.
Completely clear the values dict, as we don't need to keep single values.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-23-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| dd0b6a4e | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Encapsulate filters variable
The variable was only used in one class but still was defined globally. Additionaly the detect_platform routine which prepares the data that goes i
scripts/kvm/kvm_stat: Encapsulate filters variable
The variable was only used in one class but still was defined globally. Additionaly the detect_platform routine which prepares the data that goes into the variable was called on each start of the script, no matter if the class was needed.
To make the variable local to the TracepointProvider class, a new function that calls detect_platform and returns the filters was introduced.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-22-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 357bc1e7 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Cleanup cpu list retrieval
Reading /sys/devices/system/cpu/online makes opening the cpu directories unnecessary and works on more/older systems.
Signed-off-by: Janosch Frank <
scripts/kvm/kvm_stat: Cleanup cpu list retrieval
Reading /sys/devices/system/cpu/online makes opening the cpu directories unnecessary and works on more/older systems.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-21-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| e06715a3 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Cleanup of TracepointProvider
Variables with bad names like f and m were renamed to their full name, so it is clearer which data they contain.
Unneeded variables were removed
scripts/kvm/kvm_stat: Cleanup of TracepointProvider
Variables with bad names like f and m were renamed to their full name, so it is clearer which data they contain.
Unneeded variables were removed and the field generating code was moved in an own function.
dict.iteritems() was removed as directly iterating over a dictionary also yields the needed keys.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-20-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| a90b87bf | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Introduce properties for providers
As previous commit authors used a mixture of setters/getters and direct access to class variables consolidating them the python way improved
scripts/kvm/kvm_stat: Introduce properties for providers
As previous commit authors used a mixture of setters/getters and direct access to class variables consolidating them the python way improved readability.
Properties allow us to assign a value to a class variable through a setter without the need to call the setter ourselves.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-19-git-send-email-frankja@linux.vnet.ibm.com> [prop.setter is new in Python 2.6, which is the earliest supported version. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 312bf62b | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Rename _perf_event_open
The underscore in front of the function name does not comply with the python coding guidelines.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com
scripts/kvm/kvm_stat: Rename _perf_event_open
The underscore in front of the function name does not comply with the python coding guidelines.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-18-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 3e46a5c2 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Make cpu detection a function
The online cpus detection method is in the Stats class but does not use any class variables.
Moving it out of the class to the platform detection
scripts/kvm/kvm_stat: Make cpu detection a function
The online cpus detection method is in the Stats class but does not use any class variables.
Moving it out of the class to the platform detection function makes the Stats class more readable.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-17-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 8d3b5ddc | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Cleanup of platform detection
s390 machines can also be detected via uname -m, i.e. python's os.uname, no need for more complicated checks.
Calling uname once and saving its v
scripts/kvm/kvm_stat: Cleanup of platform detection
s390 machines can also be detected via uname -m, i.e. python's os.uname, no need for more complicated checks.
Calling uname once and saving its value for multiple checks is perfectly sufficient. We don't expect the machine's architecture to change when the script is running anyway.
On multi-cpu systems x86_init currently will get called multiple times, returning makes sure we don't waste cicles on that.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-16-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 392a7fa3 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Set sensible no. files rlimit
As num cpus * 1000 is NOT a sensible rlimit, we need to calculate a more accurate rlimit.
The number of open files is directly dependent on the c
scripts/kvm/kvm_stat: Set sensible no. files rlimit
As num cpus * 1000 is NOT a sensible rlimit, we need to calculate a more accurate rlimit.
The number of open files is directly dependent on the cpu count and on the number of trace points per cpu. A additional constant works as a buffer for files that are needed by python or do get opened when the script runs.
Hence we have: cpus * traces + constant
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-15-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 400b3cb5 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Fixup syscall error reporting
In 2008 a patch was written that introduced ctypes.get_errno() and set_errno() as official interfaces to the libc errno variable. Using them we ca
scripts/kvm/kvm_stat: Fixup syscall error reporting
In 2008 a patch was written that introduced ctypes.get_errno() and set_errno() as official interfaces to the libc errno variable. Using them we can avoid accessing private libc variables. The patch was included in python 2.6.
Also we need to raise the right exception, with the right parameters and a helpful message.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-14-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| f4109dba | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Moved DebugfsProvider
When it is next to the TracepointProvider less scrolling is needed to change related, surrounding code.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.i
scripts/kvm/kvm_stat: Moved DebugfsProvider
When it is next to the TracepointProvider less scrolling is needed to change related, surrounding code.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-13-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| a4b2be20 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Rename variables that redefine globals
Filter, id and byte are builtin python modules which should not be redefined by local variables.
Reviewed-by: Jason J. Herne <jjherne@li
scripts/kvm/kvm_stat: Rename variables that redefine globals
Filter, id and byte are builtin python modules which should not be redefined by local variables.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-12-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| e02d896e | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Fix spaces around keyword assignments
Keyword assignments should not not have spaces around the equal character according to PEP8.
Reviewed-by: Jason J. Herne <jjherne@linux.v
scripts/kvm/kvm_stat: Fix spaces around keyword assignments
Keyword assignments should not not have spaces around the equal character according to PEP8.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-11-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 639ce183 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Introduce main function
The main function should be the main location for initialization and helps encapsulating variables into a scope. This way they don't have to be global a
scripts/kvm/kvm_stat: Introduce main function
The main function should be the main location for initialization and helps encapsulating variables into a scope. This way they don't have to be global and might be mistaken for local ones.
As the providers variable is scoped now it can't be accessed from within the Stats class. Hence, the global access to the variable was changed to a local one.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-10-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 7aa4ee5a | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Improve debugfs access checking
Access checking with F_OK was replaced with the better readable os.path.exists().
On Linux exists() returns False when the user doesn't have su
scripts/kvm/kvm_stat: Improve debugfs access checking
Access checking with F_OK was replaced with the better readable os.path.exists().
On Linux exists() returns False when the user doesn't have sufficient permissions for statting the directory. Therefore the error message now states that sufficient rights are needed when the check fails.
Also added check for /sys/kernel/debug/tracing/.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-9-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 6fbff649 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Cleanup of path variables
Paths to debugfs and trace dirs are now specified globally to remove redundancies in the code.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.co
scripts/kvm/kvm_stat: Cleanup of path variables
Paths to debugfs and trace dirs are now specified globally to remove redundancies in the code.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-8-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| a6ad61f9 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Invert dictionaries
The exit reasons dictionaries were defined number -> value but later on were accessed the other way around. Therefore a invert function inverted them.
Defi
scripts/kvm/kvm_stat: Invert dictionaries
The exit reasons dictionaries were defined number -> value but later on were accessed the other way around. Therefore a invert function inverted them.
Defining them the right way removes the need to invert them and therefore also speeds up the script's setup process.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-7-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| dbedce0e | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Mark globals in functions
Updating globals over the globals().update() method is not the standard way of changing globals. Marking variables as global and modifying them the st
scripts/kvm/kvm_stat: Mark globals in functions
Updating globals over the globals().update() method is not the standard way of changing globals. Marking variables as global and modifying them the standard way is better readable.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-6-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| fff51233 | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Removed unneeded PERF constants
Only two of the constants are actually needed to set up the events, so the others were removed. All variables that used them were also removed.
scripts/kvm/kvm_stat: Removed unneeded PERF constants
Only two of the constants are actually needed to set up the events, so the others were removed. All variables that used them were also removed.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-5-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| db3e5d9a | 11-Jan-2016 |
Janosch Frank <frankja@linux.vnet.ibm.com> |
scripts/kvm/kvm_stat: Make constants uppercase
Constants should be uppercase with separating underscores, as requested in PEP8. This helps identifying them when reading the code.
Reviewed-by: Jason
scripts/kvm/kvm_stat: Make constants uppercase
Constants should be uppercase with separating underscores, as requested in PEP8. This helps identifying them when reading the code.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-4-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|