aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-kvm.c
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2014-03-03 20:26:36 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-03-14 17:08:41 -0400
commit09a71b97cce70551356b13b668aa1d7d6da84457 (patch)
tree47f628218b6a436fe565484a0a65360cd72c162d /tools/perf/builtin-kvm.c
parent94a0793ddf7fa9890006a8dc203b985e7b120785 (diff)
perf kvm: introduce --list-cmds for use by scripts
Introduce $ perf kvm --list-cmds to dump a raw list of commands for use by the completion script. In order to do this, introduce parse_options_subcommand() for handling subcommands as a special case in the parse-options machinery. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Acked-by: David Ahern <dsahern@gmail.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: David Ahern <dsahern@gmail.com> Link: http://lkml.kernel.org/r/1393896396-10427-1-git-send-email-artagnon@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-kvm.c')
-rw-r--r--tools/perf/builtin-kvm.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index a7350519c63f..21c164b8f9db 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1691,17 +1691,15 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
1691 OPT_END() 1691 OPT_END()
1692 }; 1692 };
1693 1693
1694 1694 const char *const kvm_subcommands[] = { "top", "record", "report", "diff",
1695 const char * const kvm_usage[] = { 1695 "buildid-list", "stat", NULL };
1696 "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}", 1696 const char *kvm_usage[] = { NULL, NULL };
1697 NULL
1698 };
1699 1697
1700 perf_host = 0; 1698 perf_host = 0;
1701 perf_guest = 1; 1699 perf_guest = 1;
1702 1700
1703 argc = parse_options(argc, argv, kvm_options, kvm_usage, 1701 argc = parse_options_subcommand(argc, argv, kvm_options, kvm_subcommands, kvm_usage,
1704 PARSE_OPT_STOP_AT_NON_OPTION); 1702 PARSE_OPT_STOP_AT_NON_OPTION);
1705 if (!argc) 1703 if (!argc)
1706 usage_with_options(kvm_usage, kvm_options); 1704 usage_with_options(kvm_usage, kvm_options);
1707 1705