aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-10-23 23:00:03 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-25 09:24:48 -0400
commit77f02f44460ab1480af2ae6145a1a85b9fe0b8ac (patch)
tree89a0dfd42c1afd1475d5ea013e5e8cd99d2e4bc6
parent369a2478973a416a2c42a37a8cf7031872a6d926 (diff)
perf sched: Make common options cascading
The -i and -v options can be used in subcommands so enable cascading the sched_options. This fixes the following inconvenience in 'perf sched': $ perf sched -i perf.data.sched map ... (it works well) ... $ perf sched map -i perf.data.sched Error: unknown switch `i' Usage: perf sched map [<options>] --color-cpus <cpus> highlight given CPUs in map --color-pids <pids> highlight given pids in map --compact map output in compact mode --cpus <cpus> display given CPUs in map With this patch, the second command line works with the perf.data.sched data file. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/20161024030003.28534-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-sched.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index f5503ca22e1c..8ca1b5409289 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1954,6 +1954,15 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
1954 .next_shortname2 = '0', 1954 .next_shortname2 = '0',
1955 .skip_merge = 0, 1955 .skip_merge = 0,
1956 }; 1956 };
1957 const struct option sched_options[] = {
1958 OPT_STRING('i', "input", &input_name, "file",
1959 "input file name"),
1960 OPT_INCR('v', "verbose", &verbose,
1961 "be more verbose (show symbol address, etc)"),
1962 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
1963 "dump raw trace in ASCII"),
1964 OPT_END()
1965 };
1957 const struct option latency_options[] = { 1966 const struct option latency_options[] = {
1958 OPT_STRING('s', "sort", &sched.sort_order, "key[,key2...]", 1967 OPT_STRING('s', "sort", &sched.sort_order, "key[,key2...]",
1959 "sort by key(s): runtime, switch, avg, max"), 1968 "sort by key(s): runtime, switch, avg, max"),
@@ -1965,7 +1974,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
1965 "dump raw trace in ASCII"), 1974 "dump raw trace in ASCII"),
1966 OPT_BOOLEAN('p', "pids", &sched.skip_merge, 1975 OPT_BOOLEAN('p', "pids", &sched.skip_merge,
1967 "latency stats per pid instead of per comm"), 1976 "latency stats per pid instead of per comm"),
1968 OPT_END() 1977 OPT_PARENT(sched_options)
1969 }; 1978 };
1970 const struct option replay_options[] = { 1979 const struct option replay_options[] = {
1971 OPT_UINTEGER('r', "repeat", &sched.replay_repeat, 1980 OPT_UINTEGER('r', "repeat", &sched.replay_repeat,
@@ -1975,16 +1984,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
1975 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, 1984 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
1976 "dump raw trace in ASCII"), 1985 "dump raw trace in ASCII"),
1977 OPT_BOOLEAN('f', "force", &sched.force, "don't complain, do it"), 1986 OPT_BOOLEAN('f', "force", &sched.force, "don't complain, do it"),
1978 OPT_END() 1987 OPT_PARENT(sched_options)
1979 };
1980 const struct option sched_options[] = {
1981 OPT_STRING('i', "input", &input_name, "file",
1982 "input file name"),
1983 OPT_INCR('v', "verbose", &verbose,
1984 "be more verbose (show symbol address, etc)"),
1985 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
1986 "dump raw trace in ASCII"),
1987 OPT_END()
1988 }; 1988 };
1989 const struct option map_options[] = { 1989 const struct option map_options[] = {
1990 OPT_BOOLEAN(0, "compact", &sched.map.comp, 1990 OPT_BOOLEAN(0, "compact", &sched.map.comp,
@@ -1995,7 +1995,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
1995 "highlight given CPUs in map"), 1995 "highlight given CPUs in map"),
1996 OPT_STRING(0, "cpus", &sched.map.cpus_str, "cpus", 1996 OPT_STRING(0, "cpus", &sched.map.cpus_str, "cpus",
1997 "display given CPUs in map"), 1997 "display given CPUs in map"),
1998 OPT_END() 1998 OPT_PARENT(sched_options)
1999 }; 1999 };
2000 const char * const latency_usage[] = { 2000 const char * const latency_usage[] = {
2001 "perf sched latency [<options>]", 2001 "perf sched latency [<options>]",