diff options
-rw-r--r-- | tools/perf/builtin-annotate.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-buildid-list.c | 6 | ||||
-rw-r--r-- | tools/perf/builtin-evlist.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-kmem.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-lock.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 13 | ||||
-rw-r--r-- | tools/perf/builtin-sched.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-script.c | 1 | ||||
-rw-r--r-- | tools/perf/builtin-timechart.c | 5 | ||||
-rw-r--r-- | tools/perf/perf.c | 1 | ||||
-rw-r--r-- | tools/perf/perf.h | 1 |
11 files changed, 20 insertions, 29 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index c4bb6457b19e..cb234765ce3d 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | struct perf_annotate { | 35 | struct perf_annotate { |
36 | struct perf_tool tool; | 36 | struct perf_tool tool; |
37 | char const *input_name; | ||
38 | bool force, use_tui, use_stdio; | 37 | bool force, use_tui, use_stdio; |
39 | bool full_paths; | 38 | bool full_paths; |
40 | bool print_line; | 39 | bool print_line; |
@@ -175,7 +174,7 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
175 | struct perf_evsel *pos; | 174 | struct perf_evsel *pos; |
176 | u64 total_nr_samples; | 175 | u64 total_nr_samples; |
177 | 176 | ||
178 | session = perf_session__new(ann->input_name, O_RDONLY, | 177 | session = perf_session__new(input_name, O_RDONLY, |
179 | ann->force, false, &ann->tool); | 178 | ann->force, false, &ann->tool); |
180 | if (session == NULL) | 179 | if (session == NULL) |
181 | return -ENOMEM; | 180 | return -ENOMEM; |
@@ -260,7 +259,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) | |||
260 | }, | 259 | }, |
261 | }; | 260 | }; |
262 | const struct option options[] = { | 261 | const struct option options[] = { |
263 | OPT_STRING('i', "input", &annotate.input_name, "file", | 262 | OPT_STRING('i', "input", &input_name, "file", |
264 | "input file name"), | 263 | "input file name"), |
265 | OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", | 264 | OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", |
266 | "only consider symbols in these dsos"), | 265 | "only consider symbols in these dsos"), |
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index a0e94fffa03e..a82d99fec83e 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c | |||
@@ -44,8 +44,7 @@ static int filename__fprintf_build_id(const char *name, FILE *fp) | |||
44 | return fprintf(fp, "%s\n", sbuild_id); | 44 | return fprintf(fp, "%s\n", sbuild_id); |
45 | } | 45 | } |
46 | 46 | ||
47 | static int perf_session__list_build_ids(const char *input_name, | 47 | static int perf_session__list_build_ids(bool force, bool with_hits) |
48 | bool force, bool with_hits) | ||
49 | { | 48 | { |
50 | struct perf_session *session; | 49 | struct perf_session *session; |
51 | 50 | ||
@@ -81,7 +80,6 @@ int cmd_buildid_list(int argc, const char **argv, | |||
81 | bool show_kernel = false; | 80 | bool show_kernel = false; |
82 | bool with_hits = false; | 81 | bool with_hits = false; |
83 | bool force = false; | 82 | bool force = false; |
84 | const char *input_name = NULL; | ||
85 | const struct option options[] = { | 83 | const struct option options[] = { |
86 | OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"), | 84 | OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"), |
87 | OPT_STRING('i', "input", &input_name, "file", "input file name"), | 85 | OPT_STRING('i', "input", &input_name, "file", "input file name"), |
@@ -101,5 +99,5 @@ int cmd_buildid_list(int argc, const char **argv, | |||
101 | if (show_kernel) | 99 | if (show_kernel) |
102 | return sysfs__fprintf_build_id(stdout); | 100 | return sysfs__fprintf_build_id(stdout); |
103 | 101 | ||
104 | return perf_session__list_build_ids(input_name, force, with_hits); | 102 | return perf_session__list_build_ids(force, with_hits); |
105 | } | 103 | } |
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c index 997afb82691b..c20f1dcfb7e2 100644 --- a/tools/perf/builtin-evlist.c +++ b/tools/perf/builtin-evlist.c | |||
@@ -48,12 +48,12 @@ static int __if_print(bool *first, const char *field, u64 value) | |||
48 | 48 | ||
49 | #define if_print(field) __if_print(&first, #field, pos->attr.field) | 49 | #define if_print(field) __if_print(&first, #field, pos->attr.field) |
50 | 50 | ||
51 | static int __cmd_evlist(const char *input_name, struct perf_attr_details *details) | 51 | static int __cmd_evlist(const char *file_name, struct perf_attr_details *details) |
52 | { | 52 | { |
53 | struct perf_session *session; | 53 | struct perf_session *session; |
54 | struct perf_evsel *pos; | 54 | struct perf_evsel *pos; |
55 | 55 | ||
56 | session = perf_session__new(input_name, O_RDONLY, 0, false, NULL); | 56 | session = perf_session__new(file_name, O_RDONLY, 0, false, NULL); |
57 | if (session == NULL) | 57 | if (session == NULL) |
58 | return -ENOMEM; | 58 | return -ENOMEM; |
59 | 59 | ||
@@ -111,7 +111,6 @@ static int __cmd_evlist(const char *input_name, struct perf_attr_details *detail | |||
111 | int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused) | 111 | int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused) |
112 | { | 112 | { |
113 | struct perf_attr_details details = { .verbose = false, }; | 113 | struct perf_attr_details details = { .verbose = false, }; |
114 | const char *input_name = NULL; | ||
115 | const struct option options[] = { | 114 | const struct option options[] = { |
116 | OPT_STRING('i', "input", &input_name, "file", "Input file name"), | 115 | OPT_STRING('i', "input", &input_name, "file", "Input file name"), |
117 | OPT_BOOLEAN('F', "freq", &details.freq, "Show the sample frequency"), | 116 | OPT_BOOLEAN('F', "freq", &details.freq, "Show the sample frequency"), |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 14bf82f63659..0b4b796167be 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -477,7 +477,7 @@ static void sort_result(void) | |||
477 | __sort_result(&root_caller_stat, &root_caller_sorted, &caller_sort); | 477 | __sort_result(&root_caller_stat, &root_caller_sorted, &caller_sort); |
478 | } | 478 | } |
479 | 479 | ||
480 | static int __cmd_kmem(const char *input_name) | 480 | static int __cmd_kmem(void) |
481 | { | 481 | { |
482 | int err = -EINVAL; | 482 | int err = -EINVAL; |
483 | struct perf_session *session; | 483 | struct perf_session *session; |
@@ -743,7 +743,6 @@ static int __cmd_record(int argc, const char **argv) | |||
743 | int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) | 743 | int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) |
744 | { | 744 | { |
745 | const char * const default_sort_order = "frag,hit,bytes"; | 745 | const char * const default_sort_order = "frag,hit,bytes"; |
746 | const char *input_name = NULL; | ||
747 | const struct option kmem_options[] = { | 746 | const struct option kmem_options[] = { |
748 | OPT_STRING('i', "input", &input_name, "file", "input file name"), | 747 | OPT_STRING('i', "input", &input_name, "file", "input file name"), |
749 | OPT_CALLBACK_NOOPT(0, "caller", NULL, NULL, | 748 | OPT_CALLBACK_NOOPT(0, "caller", NULL, NULL, |
@@ -779,7 +778,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) | |||
779 | if (list_empty(&alloc_sort)) | 778 | if (list_empty(&alloc_sort)) |
780 | setup_sorting(&alloc_sort, default_sort_order); | 779 | setup_sorting(&alloc_sort, default_sort_order); |
781 | 780 | ||
782 | return __cmd_kmem(input_name); | 781 | return __cmd_kmem(); |
783 | } else | 782 | } else |
784 | usage_with_options(kmem_usage, kmem_options); | 783 | usage_with_options(kmem_usage, kmem_options); |
785 | 784 | ||
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 6f5f328157aa..425830069749 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c | |||
@@ -335,8 +335,6 @@ alloc_failed: | |||
335 | return NULL; | 335 | return NULL; |
336 | } | 336 | } |
337 | 337 | ||
338 | static const char *input_name; | ||
339 | |||
340 | struct trace_lock_handler { | 338 | struct trace_lock_handler { |
341 | int (*acquire_event)(struct perf_evsel *evsel, | 339 | int (*acquire_event)(struct perf_evsel *evsel, |
342 | struct perf_sample *sample); | 340 | struct perf_sample *sample); |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 90d1162bb8b8..f07eae73e692 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -40,7 +40,6 @@ | |||
40 | struct perf_report { | 40 | struct perf_report { |
41 | struct perf_tool tool; | 41 | struct perf_tool tool; |
42 | struct perf_session *session; | 42 | struct perf_session *session; |
43 | char const *input_name; | ||
44 | bool force, use_tui, use_gtk, use_stdio; | 43 | bool force, use_tui, use_gtk, use_stdio; |
45 | bool hide_unresolved; | 44 | bool hide_unresolved; |
46 | bool dont_use_callchains; | 45 | bool dont_use_callchains; |
@@ -571,7 +570,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
571 | .pretty_printing_style = "normal", | 570 | .pretty_printing_style = "normal", |
572 | }; | 571 | }; |
573 | const struct option options[] = { | 572 | const struct option options[] = { |
574 | OPT_STRING('i', "input", &report.input_name, "file", | 573 | OPT_STRING('i', "input", &input_name, "file", |
575 | "input file name"), | 574 | "input file name"), |
576 | OPT_INCR('v', "verbose", &verbose, | 575 | OPT_INCR('v', "verbose", &verbose, |
577 | "be more verbose (show symbol address, etc)"), | 576 | "be more verbose (show symbol address, etc)"), |
@@ -657,13 +656,13 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
657 | if (report.inverted_callchain) | 656 | if (report.inverted_callchain) |
658 | callchain_param.order = ORDER_CALLER; | 657 | callchain_param.order = ORDER_CALLER; |
659 | 658 | ||
660 | if (!report.input_name || !strlen(report.input_name)) { | 659 | if (!input_name || !strlen(input_name)) { |
661 | if (!fstat(STDIN_FILENO, &st) && S_ISFIFO(st.st_mode)) | 660 | if (!fstat(STDIN_FILENO, &st) && S_ISFIFO(st.st_mode)) |
662 | report.input_name = "-"; | 661 | input_name = "-"; |
663 | else | 662 | else |
664 | report.input_name = "perf.data"; | 663 | input_name = "perf.data"; |
665 | } | 664 | } |
666 | session = perf_session__new(report.input_name, O_RDONLY, | 665 | session = perf_session__new(input_name, O_RDONLY, |
667 | report.force, false, &report.tool); | 666 | report.force, false, &report.tool); |
668 | if (session == NULL) | 667 | if (session == NULL) |
669 | return -ENOMEM; | 668 | return -ENOMEM; |
@@ -694,7 +693,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
694 | 693 | ||
695 | } | 694 | } |
696 | 695 | ||
697 | if (strcmp(report.input_name, "-") != 0) | 696 | if (strcmp(input_name, "-") != 0) |
698 | setup_browser(true); | 697 | setup_browser(true); |
699 | else { | 698 | else { |
700 | use_browser = 0; | 699 | use_browser = 0; |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 30e53360d3c2..cc28b85dabd5 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -120,7 +120,6 @@ struct trace_sched_handler { | |||
120 | 120 | ||
121 | struct perf_sched { | 121 | struct perf_sched { |
122 | struct perf_tool tool; | 122 | struct perf_tool tool; |
123 | const char *input_name; | ||
124 | const char *sort_order; | 123 | const char *sort_order; |
125 | unsigned long nr_tasks; | 124 | unsigned long nr_tasks; |
126 | struct task_desc *pid_to_task[MAX_PID]; | 125 | struct task_desc *pid_to_task[MAX_PID]; |
@@ -1460,7 +1459,7 @@ static int perf_sched__read_events(struct perf_sched *sched, bool destroy, | |||
1460 | }; | 1459 | }; |
1461 | struct perf_session *session; | 1460 | struct perf_session *session; |
1462 | 1461 | ||
1463 | session = perf_session__new(sched->input_name, O_RDONLY, 0, false, &sched->tool); | 1462 | session = perf_session__new(input_name, O_RDONLY, 0, false, &sched->tool); |
1464 | if (session == NULL) { | 1463 | if (session == NULL) { |
1465 | pr_debug("No Memory for session\n"); | 1464 | pr_debug("No Memory for session\n"); |
1466 | return -1; | 1465 | return -1; |
@@ -1708,7 +1707,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1708 | OPT_END() | 1707 | OPT_END() |
1709 | }; | 1708 | }; |
1710 | const struct option sched_options[] = { | 1709 | const struct option sched_options[] = { |
1711 | OPT_STRING('i', "input", &sched.input_name, "file", | 1710 | OPT_STRING('i', "input", &input_name, "file", |
1712 | "input file name"), | 1711 | "input file name"), |
1713 | OPT_INCR('v', "verbose", &verbose, | 1712 | OPT_INCR('v', "verbose", &verbose, |
1714 | "be more verbose (show symbol address, etc)"), | 1713 | "be more verbose (show symbol address, etc)"), |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 04ceb0779d39..7c6e4b2f401a 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -1175,7 +1175,6 @@ static int have_cmd(int argc, const char **argv) | |||
1175 | int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | 1175 | int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) |
1176 | { | 1176 | { |
1177 | bool show_full_info = false; | 1177 | bool show_full_info = false; |
1178 | const char *input_name = NULL; | ||
1179 | char *rec_script_path = NULL; | 1178 | char *rec_script_path = NULL; |
1180 | char *rep_script_path = NULL; | 1179 | char *rep_script_path = NULL; |
1181 | struct perf_session *session; | 1180 | struct perf_session *session; |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index f251b613b2f3..ab4cf232b852 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -965,7 +965,7 @@ static void write_svg_file(const char *filename) | |||
965 | svg_close(); | 965 | svg_close(); |
966 | } | 966 | } |
967 | 967 | ||
968 | static int __cmd_timechart(const char *input_name, const char *output_name) | 968 | static int __cmd_timechart(const char *output_name) |
969 | { | 969 | { |
970 | struct perf_tool perf_timechart = { | 970 | struct perf_tool perf_timechart = { |
971 | .comm = process_comm_event, | 971 | .comm = process_comm_event, |
@@ -1061,7 +1061,6 @@ parse_process(const struct option *opt __maybe_unused, const char *arg, | |||
1061 | int cmd_timechart(int argc, const char **argv, | 1061 | int cmd_timechart(int argc, const char **argv, |
1062 | const char *prefix __maybe_unused) | 1062 | const char *prefix __maybe_unused) |
1063 | { | 1063 | { |
1064 | const char *input_name; | ||
1065 | const char *output_name = "output.svg"; | 1064 | const char *output_name = "output.svg"; |
1066 | const struct option options[] = { | 1065 | const struct option options[] = { |
1067 | OPT_STRING('i', "input", &input_name, "file", "input file name"), | 1066 | OPT_STRING('i', "input", &input_name, "file", "input file name"), |
@@ -1092,5 +1091,5 @@ int cmd_timechart(int argc, const char **argv, | |||
1092 | 1091 | ||
1093 | setup_pager(); | 1092 | setup_pager(); |
1094 | 1093 | ||
1095 | return __cmd_timechart(input_name, output_name); | 1094 | return __cmd_timechart(output_name); |
1096 | } | 1095 | } |
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index d480d8a412b8..e9683738d89f 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -24,6 +24,7 @@ const char perf_more_info_string[] = | |||
24 | 24 | ||
25 | int use_browser = -1; | 25 | int use_browser = -1; |
26 | static int use_pager = -1; | 26 | static int use_pager = -1; |
27 | const char *input_name; | ||
27 | 28 | ||
28 | struct cmd_struct { | 29 | struct cmd_struct { |
29 | const char *cmd; | 30 | const char *cmd; |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index c50985eaec41..469fbf2daea4 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -208,6 +208,7 @@ struct branch_stack { | |||
208 | struct branch_entry entries[0]; | 208 | struct branch_entry entries[0]; |
209 | }; | 209 | }; |
210 | 210 | ||
211 | extern const char *input_name; | ||
211 | extern bool perf_host, perf_guest; | 212 | extern bool perf_host, perf_guest; |
212 | extern const char perf_version_string[]; | 213 | extern const char perf_version_string[]; |
213 | 214 | ||