diff options
author | Janosch Frank <frankja@linux.vnet.ibm.com> | 2016-01-11 16:18:04 +0100 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:29:55 -0600 |
commit | a4591ee848dd955baa7811f77768da6821f4a546 (patch) | |
tree | 71df88ec37d04a53a4be473fb2a1b151f08a7517 | |
parent | 8072b7583490c5ecf01a58e6f8e5c6c0a4459fd6 (diff) | |
download | hqemu-a4591ee848dd955baa7811f77768da6821f4a546.zip hqemu-a4591ee848dd955baa7811f77768da6821f4a546.tar.gz |
scripts/kvm/kvm_stat: Add optparse description
Added a description text that explains what the script does and which
requirements have to be met to let it run.
The help formatter class is needed as the default optparse formatter
makes the text unreadable.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1452525484-32309-35-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rwxr-xr-x | scripts/kvm/kvm_stat | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index 25631a4..d43e8f3 100755 --- a/scripts/kvm/kvm_stat +++ b/scripts/kvm/kvm_stat @@ -705,7 +705,34 @@ def log(stats): line += 1 def get_options(): - optparser = optparse.OptionParser() + description_text = """ +This script displays various statistics about VMs running under KVM. +The statistics are gathered from the KVM debugfs entries and / or the +currently available perf traces. + +The monitoring takes additional cpu cycles and might affect the VM's +performance. + +Requirements: +- Access to: + /sys/kernel/debug/kvm + /sys/kernel/debug/trace/events/* + /proc/pid/task +- /proc/sys/kernel/perf_event_paranoid < 1 if user has no + CAP_SYS_ADMIN and perf events are used. +- CAP_SYS_RESOURCE if the hard limit is not high enough to allow + the large number of files that are possibly opened. +""" + + class PlainHelpFormatter(optparse.IndentedHelpFormatter): + def format_description(self, description): + if description: + return description + "\n" + else: + return "" + + optparser = optparse.OptionParser(description=description_text, + formatter=PlainHelpFormatter()) optparser.add_option('-1', '--once', '--batch', action='store_true', default=False, |