[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1388660330-16781-5-git-send-email-artagnon@gmail.com>
Date: Thu, 2 Jan 2014 16:28:49 +0530
From: Ramkumar Ramachandra <artagnon@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: David Ahern <dsahern@...il.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 4/5] perf mem: introduce --list-cmds
Cc: David Ahern <dsahern@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@...il.com>
---
tools/perf/builtin-mem.c | 15 ++++++++++-----
tools/perf/perf-completion.sh | 4 ++--
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 31c00f1..a1db6e7 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;
@@ -191,6 +186,7 @@ static int report_events(int argc, const char **argv, struct perf_mem *mem)
int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused)
{
struct stat st;
+ bool list_cmds = false;
struct perf_mem mem = {
.tool = {
.sample = process_sample_event,
@@ -219,12 +215,21 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused)
"separator",
"separator for columns, no spaces will be added"
" between columns '.' is reserved."),
+ OPT_BOOLEAN(0, "list-cmds", &list_cmds,
+ "list commands raw for use by scripts"),
OPT_END()
};
+ const char *const subcommands[] = { "record", "report", NULL };
+ const char *mem_usage[] = { NULL, NULL };
+ build_usage_string(mem_usage, "mem", subcommands);
argc = parse_options(argc, argv, mem_options, mem_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
+ if (list_cmds) {
+ list_cmds_raw(subcommands);
+ return 0;
+ }
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 302de6a..4ecef69 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -121,8 +121,8 @@ __perf_main ()
elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
__perfcomp_colon "$evts" "$cur"
- # List subcommands for kmem, kvm, lock
- elif [[ $prev == @(kmem|kvm|lock) ]]; then
+ # List subcommands for kmem, kvm, lock, mem
+ elif [[ $prev == @(kmem|kvm|lock|mem) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
--
1.8.5.2.227.g53f3478
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists