All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 09/11] perf mem: Introduce --list-cmds for use by scripts
Date: Wed, 16 Apr 2014 20:41:37 +0200	[thread overview]
Message-ID: <1397673699-25824-10-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1397673699-25824-1-git-send-email-jolsa@redhat.com>

From: Ramkumar Ramachandra <artagnon@gmail.com>

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1394853474-31019-3-git-send-email-artagnon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/builtin-mem.c      | 15 ++++++++-------
 tools/perf/perf-completion.sh |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 2e3ade69..4a1a6c9 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -21,11 +21,6 @@ struct perf_mem {
 	DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
 };
 
-static const char * const mem_usage[] = {
-	"perf mem [<options>] {record <command> |report}",
-	NULL
-};
-
 static int __cmd_record(int argc, const char **argv)
 {
 	int rec_argc, i = 0, j;
@@ -220,9 +215,15 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused)
 		   " between columns '.' is reserved."),
 	OPT_END()
 	};
+	const char *const mem_subcommands[] = { "record", "report", NULL };
+	const char *mem_usage[] = {
+		NULL,
+		NULL
+	};
+
 
-	argc = parse_options(argc, argv, mem_options, mem_usage,
-			     PARSE_OPT_STOP_AT_NON_OPTION);
+	argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands,
+					mem_usage, PARSE_OPT_STOP_AT_NON_OPTION);
 
 	if (!argc || !(strncmp(argv[0], "rec", 3) || mem_operation))
 		usage_with_options(mem_usage, mem_options);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 0ef59dd..f44c04b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -122,7 +122,7 @@ __perf_main ()
 		evts=$($cmd list --raw-dump)
 		__perfcomp_colon "$evts" "$cur"
 	# List subcommands for perf commands
-	elif [[ $prev == @(kvm|kmem) ]]; then
+	elif [[ $prev == @(kvm|kmem|mem) ]]; then
 		subcmds=$($cmd $prev --list-cmds)
 		__perfcomp_colon "$subcmds" "$cur"
 	# List long option names
-- 
1.8.3.1


  parent reply	other threads:[~2014-04-16 18:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16 18:41 [GIT PULL 00/11] perf/core improvements and fixes Jiri Olsa
2014-04-16 18:41 ` [PATCH 01/11] perf hists: Add support for showing relative percentage Jiri Olsa
2014-04-16 18:41 ` [PATCH 02/11] perf report: Add --percentage option Jiri Olsa
2014-04-16 18:41 ` [PATCH 03/11] perf top: " Jiri Olsa
2014-04-16 18:41 ` [PATCH 04/11] perf diff: " Jiri Olsa
2014-04-16 18:41 ` [PATCH 05/11] perf tools: Add hist.percentage config option Jiri Olsa
2014-04-16 18:41 ` [PATCH 06/11] perf ui/tui: Add 'F' hotkey to toggle percentage output Jiri Olsa
2014-04-16 18:41 ` [PATCH 07/11] perf tools: Show absolute percentage by default Jiri Olsa
2014-04-16 18:41 ` [PATCH 08/11] perf kmem: Introduce --list-cmds for use by scripts Jiri Olsa
2014-04-16 18:41 ` Jiri Olsa [this message]
2014-04-16 18:41 ` [PATCH 10/11] perf lock: " Jiri Olsa
2014-04-16 18:41 ` [PATCH 11/11] perf sched: " Jiri Olsa
2014-04-17  8:07 ` [GIT PULL 00/11] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397673699-25824-10-git-send-email-jolsa@redhat.com \
    --to=jolsa@redhat.com \
    --cc=artagnon@gmail.com \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.