diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-10-22 11:15:46 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-29 08:32:47 -0400 |
commit | e5b2c20755d37d781bb6e1e733faec5c39bd087a (patch) | |
tree | 061151a31fd446c0f9b786c25fa2c477447d1350 /tools | |
parent | d152d1be5962ace0706066db71b4f05dff8764eb (diff) |
perf tools: Export usage string and option table of perf record
Those are shared with other builtin commands like kvm, script. So
make it accessable from them. This is a preparation of later change
that limiting possible options.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1413990949-13953-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 7 | ||||
-rw-r--r-- | tools/perf/builtin-script.c | 1 | ||||
-rw-r--r-- | tools/perf/builtin-timechart.c | 7 | ||||
-rw-r--r-- | tools/perf/perf.h | 3 |
4 files changed, 12 insertions, 6 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 2583a9b04317..5091a27e6d28 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -680,11 +680,12 @@ static int perf_record_config(const char *var, const char *value, void *cb) | |||
680 | return perf_default_config(var, value, cb); | 680 | return perf_default_config(var, value, cb); |
681 | } | 681 | } |
682 | 682 | ||
683 | static const char * const record_usage[] = { | 683 | static const char * const __record_usage[] = { |
684 | "perf record [<options>] [<command>]", | 684 | "perf record [<options>] [<command>]", |
685 | "perf record [<options>] -- <command> [<options>]", | 685 | "perf record [<options>] -- <command> [<options>]", |
686 | NULL | 686 | NULL |
687 | }; | 687 | }; |
688 | const char * const *record_usage = __record_usage; | ||
688 | 689 | ||
689 | /* | 690 | /* |
690 | * XXX Ideally would be local to cmd_record() and passed to a record__new | 691 | * XXX Ideally would be local to cmd_record() and passed to a record__new |
@@ -725,7 +726,7 @@ const char record_callchain_help[] = CALLCHAIN_HELP "fp"; | |||
725 | * perf_evlist__prepare_workload, etc instead of fork+exec'in 'perf record', | 726 | * perf_evlist__prepare_workload, etc instead of fork+exec'in 'perf record', |
726 | * using pipes, etc. | 727 | * using pipes, etc. |
727 | */ | 728 | */ |
728 | const struct option record_options[] = { | 729 | struct option __record_options[] = { |
729 | OPT_CALLBACK('e', "event", &record.evlist, "event", | 730 | OPT_CALLBACK('e', "event", &record.evlist, "event", |
730 | "event selector. use 'perf list' to list available events", | 731 | "event selector. use 'perf list' to list available events", |
731 | parse_events_option), | 732 | parse_events_option), |
@@ -802,6 +803,8 @@ const struct option record_options[] = { | |||
802 | OPT_END() | 803 | OPT_END() |
803 | }; | 804 | }; |
804 | 805 | ||
806 | struct option *record_options = __record_options; | ||
807 | |||
805 | int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) | 808 | int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) |
806 | { | 809 | { |
807 | int err = -ENOMEM; | 810 | int err = -ENOMEM; |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index b35517f2ceb5..ce304dfd962a 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -23,7 +23,6 @@ static char const *generate_script_lang; | |||
23 | static bool debug_mode; | 23 | static bool debug_mode; |
24 | static u64 last_timestamp; | 24 | static u64 last_timestamp; |
25 | static u64 nr_unordered; | 25 | static u64 nr_unordered; |
26 | extern const struct option record_options[]; | ||
27 | static bool no_callchain; | 26 | static bool no_callchain; |
28 | static bool latency_format; | 27 | static bool latency_format; |
29 | static bool system_wide; | 28 | static bool system_wide; |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index f5fb256d90d5..f3bb1a4bf060 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -1963,7 +1963,7 @@ int cmd_timechart(int argc, const char **argv, | |||
1963 | NULL | 1963 | NULL |
1964 | }; | 1964 | }; |
1965 | 1965 | ||
1966 | const struct option record_options[] = { | 1966 | const struct option timechart_record_options[] = { |
1967 | OPT_BOOLEAN('P', "power-only", &tchart.power_only, "output power data only"), | 1967 | OPT_BOOLEAN('P', "power-only", &tchart.power_only, "output power data only"), |
1968 | OPT_BOOLEAN('T', "tasks-only", &tchart.tasks_only, | 1968 | OPT_BOOLEAN('T', "tasks-only", &tchart.tasks_only, |
1969 | "output processes data only"), | 1969 | "output processes data only"), |
@@ -1972,7 +1972,7 @@ int cmd_timechart(int argc, const char **argv, | |||
1972 | OPT_BOOLEAN('g', "callchain", &tchart.with_backtrace, "record callchain"), | 1972 | OPT_BOOLEAN('g', "callchain", &tchart.with_backtrace, "record callchain"), |
1973 | OPT_END() | 1973 | OPT_END() |
1974 | }; | 1974 | }; |
1975 | const char * const record_usage[] = { | 1975 | const char * const timechart_record_usage[] = { |
1976 | "perf timechart record [<options>]", | 1976 | "perf timechart record [<options>]", |
1977 | NULL | 1977 | NULL |
1978 | }; | 1978 | }; |
@@ -1985,7 +1985,8 @@ int cmd_timechart(int argc, const char **argv, | |||
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | if (argc && !strncmp(argv[0], "rec", 3)) { | 1987 | if (argc && !strncmp(argv[0], "rec", 3)) { |
1988 | argc = parse_options(argc, argv, record_options, record_usage, | 1988 | argc = parse_options(argc, argv, timechart_record_options, |
1989 | timechart_record_usage, | ||
1989 | PARSE_OPT_STOP_AT_NON_OPTION); | 1990 | PARSE_OPT_STOP_AT_NON_OPTION); |
1990 | 1991 | ||
1991 | if (tchart.power_only && tchart.tasks_only) { | 1992 | if (tchart.power_only && tchart.tasks_only) { |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 220d44e44c1b..511c2831aa81 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -62,4 +62,7 @@ struct record_opts { | |||
62 | unsigned initial_delay; | 62 | unsigned initial_delay; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | struct option; | ||
66 | extern const char * const *record_usage; | ||
67 | extern struct option *record_options; | ||
65 | #endif | 68 | #endif |