qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 34/34] scripts/kvm/kvm_stat: Add optparse descrip


From: Janosch Frank
Subject: [Qemu-devel] [PATCH v2 34/34] scripts/kvm/kvm_stat: Add optparse description
Date: Mon, 11 Jan 2016 16:18:04 +0100

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 <address@hidden>
---
 scripts/kvm/kvm_stat | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
index f64d4e8..c1d6541 100755
--- a/scripts/kvm/kvm_stat
+++ b/scripts/kvm/kvm_stat
@@ -703,7 +703,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,
-- 
2.3.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]