From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIeFi-0001l9-MZ for qemu-devel@nongnu.org; Mon, 11 Jan 2016 10:19:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIeFf-0001vk-UA for qemu-devel@nongnu.org; Mon, 11 Jan 2016 10:19:26 -0500 Received: from e06smtp06.uk.ibm.com ([195.75.94.102]:59388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIeFf-0001us-Gt for qemu-devel@nongnu.org; Mon, 11 Jan 2016 10:19:23 -0500 Received: from localhost by e06smtp06.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Jan 2016 15:19:22 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5918A2190056 for ; Mon, 11 Jan 2016 15:19:10 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0BFJLU76422848 for ; Mon, 11 Jan 2016 15:19:21 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0BFJKiP019128 for ; Mon, 11 Jan 2016 08:19:21 -0700 From: Janosch Frank Date: Mon, 11 Jan 2016 16:18:04 +0100 Message-Id: <1452525484-32309-35-git-send-email-frankja@linux.vnet.ibm.com> In-Reply-To: <1452525484-32309-1-git-send-email-frankja@linux.vnet.ibm.com> References: <1452525484-32309-1-git-send-email-frankja@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2 34/34] scripts/kvm/kvm_stat: Add optparse description List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com Cc: frankja@linux.vnet.ibm.com, qemu-devel@nongnu.org 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 --- 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