From: Ramkumar Ramachandra <artagnon@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: David Ahern <dsahern@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 5/5] perf sched: introduce --list-cmds
Date: Thu, 2 Jan 2014 16:28:50 +0530 [thread overview]
Message-ID: <1388660330-16781-6-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1388660330-16781-1-git-send-email-artagnon@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
tools/perf/builtin-sched.c | 15 +++++++++++----
tools/perf/perf-completion.sh | 4 ++--
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0f3c6551..ccd9b19 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1658,6 +1658,7 @@ static int __cmd_record(int argc, const char **argv)
int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
{
const char default_sort_order[] = "avg, max, switch, runtime";
+ bool list_cmds = false;
struct perf_sched sched = {
.tool = {
.sample = perf_sched__process_tracepoint_sample,
@@ -1703,6 +1704,8 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
"be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
+ OPT_BOOLEAN(0, "list-cmds", &list_cmds,
+ "list commands raw for use by scripts"),
OPT_END()
};
const char * const latency_usage[] = {
@@ -1713,10 +1716,6 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
"perf sched replay [<options>]",
NULL
};
- const char * const sched_usage[] = {
- "perf sched [<options>] {record|latency|map|replay|script}",
- NULL
- };
struct trace_sched_handler lat_ops = {
.wakeup_event = latency_wakeup_event,
.switch_event = latency_switch_event,
@@ -1732,12 +1731,20 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
.fork_event = replay_fork_event,
};
unsigned int i;
+ const char *const subcommands [] = { "record", "latency", "map",
+ "replay", "script" };
+ const char *sched_usage[] = { NULL, NULL };
+ build_usage_string(sched_usage, "sched", subcommands);
for (i = 0; i < ARRAY_SIZE(sched.curr_pid); i++)
sched.curr_pid[i] = -1;
argc = parse_options(argc, argv, sched_options, sched_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
+ if (list_cmds) {
+ list_cmds_raw(subcommands);
+ return 0;
+ }
if (!argc)
usage_with_options(sched_usage, sched_options);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 4ecef69..3682921 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, mem
- elif [[ $prev == @(kmem|kvm|lock|mem) ]]; then
+ # List subcommands for kmem, kvm, lock, mem, sched
+ elif [[ $prev == @(kmem|kvm|lock|mem|sched) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
--
1.8.5.2.227.g53f3478
next prev parent reply other threads:[~2014-01-02 10:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 10:58 [PATCH 0/5] perf tools: get --list-cmds for subcommands Ramkumar Ramachandra
2014-01-02 10:58 ` [PATCH 1/5] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
2014-01-02 10:58 ` [PATCH 2/5] perf kmem: introduce --list-cmds Ramkumar Ramachandra
2014-01-02 10:58 ` [PATCH 3/5] perf lock: " Ramkumar Ramachandra
2014-01-02 10:58 ` [PATCH 4/5] perf mem: " Ramkumar Ramachandra
2014-01-02 10:58 ` Ramkumar Ramachandra [this message]
2014-01-09 10:50 ` [PATCH 0/5] perf tools: get --list-cmds for subcommands Ramkumar Ramachandra
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=1388660330-16781-6-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®