aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-kvm.c2
-rw-r--r--tools/perf/builtin-record.c18
-rw-r--r--tools/perf/builtin-top.c8
-rw-r--r--tools/perf/builtin-trace.c2
-rw-r--r--tools/perf/perf.h2
-rw-r--r--tools/perf/tests/code-reading.c2
-rw-r--r--tools/perf/tests/keep-tracking.c2
-rw-r--r--tools/perf/tests/open-syscall-tp-fields.c2
-rw-r--r--tools/perf/tests/perf-record.c2
-rw-r--r--tools/perf/tests/perf-time-to-tsc.c2
-rw-r--r--tools/perf/util/callchain.h2
-rw-r--r--tools/perf/util/evlist.h7
-rw-r--r--tools/perf/util/evsel.c3
-rw-r--r--tools/perf/util/evsel.h4
-rw-r--r--tools/perf/util/record.c9
-rw-r--r--tools/perf/util/top.c2
-rw-r--r--tools/perf/util/top.h2
17 files changed, 34 insertions, 37 deletions
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 154b397a5d27..5a80da6ba413 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -89,7 +89,7 @@ struct exit_reasons_table {
89 89
90struct perf_kvm_stat { 90struct perf_kvm_stat {
91 struct perf_tool tool; 91 struct perf_tool tool;
92 struct perf_record_opts opts; 92 struct record_opts opts;
93 struct perf_evlist *evlist; 93 struct perf_evlist *evlist;
94 struct perf_session *session; 94 struct perf_session *session;
95 95
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f2624d43333e..6ec0cbc2a5d5 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -64,7 +64,7 @@ static void __handle_on_exit_funcs(void)
64 64
65struct record { 65struct record {
66 struct perf_tool tool; 66 struct perf_tool tool;
67 struct perf_record_opts opts; 67 struct record_opts opts;
68 u64 bytes_written; 68 u64 bytes_written;
69 struct perf_data_file file; 69 struct perf_data_file file;
70 struct perf_evlist *evlist; 70 struct perf_evlist *evlist;
@@ -178,7 +178,7 @@ static int record__open(struct record *rec)
178 struct perf_evsel *pos; 178 struct perf_evsel *pos;
179 struct perf_evlist *evlist = rec->evlist; 179 struct perf_evlist *evlist = rec->evlist;
180 struct perf_session *session = rec->session; 180 struct perf_session *session = rec->session;
181 struct perf_record_opts *opts = &rec->opts; 181 struct record_opts *opts = &rec->opts;
182 int rc = 0; 182 int rc = 0;
183 183
184 perf_evlist__config(evlist, opts); 184 perf_evlist__config(evlist, opts);
@@ -348,7 +348,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
348 const bool forks = argc > 0; 348 const bool forks = argc > 0;
349 struct machine *machine; 349 struct machine *machine;
350 struct perf_tool *tool = &rec->tool; 350 struct perf_tool *tool = &rec->tool;
351 struct perf_record_opts *opts = &rec->opts; 351 struct record_opts *opts = &rec->opts;
352 struct perf_evlist *evsel_list = rec->evlist; 352 struct perf_evlist *evsel_list = rec->evlist;
353 struct perf_data_file *file = &rec->file; 353 struct perf_data_file *file = &rec->file;
354 struct perf_session *session; 354 struct perf_session *session;
@@ -657,7 +657,7 @@ static int get_stack_size(char *str, unsigned long *_size)
657} 657}
658#endif /* HAVE_LIBUNWIND_SUPPORT */ 658#endif /* HAVE_LIBUNWIND_SUPPORT */
659 659
660int record_parse_callchain(const char *arg, struct perf_record_opts *opts) 660int record_parse_callchain(const char *arg, struct record_opts *opts)
661{ 661{
662 char *tok, *name, *saveptr = NULL; 662 char *tok, *name, *saveptr = NULL;
663 char *buf; 663 char *buf;
@@ -713,7 +713,7 @@ int record_parse_callchain(const char *arg, struct perf_record_opts *opts)
713 return ret; 713 return ret;
714} 714}
715 715
716static void callchain_debug(struct perf_record_opts *opts) 716static void callchain_debug(struct record_opts *opts)
717{ 717{
718 pr_debug("callchain: type %d\n", opts->call_graph); 718 pr_debug("callchain: type %d\n", opts->call_graph);
719 719
@@ -726,7 +726,7 @@ int record_parse_callchain_opt(const struct option *opt,
726 const char *arg, 726 const char *arg,
727 int unset) 727 int unset)
728{ 728{
729 struct perf_record_opts *opts = opt->value; 729 struct record_opts *opts = opt->value;
730 int ret; 730 int ret;
731 731
732 /* --no-call-graph */ 732 /* --no-call-graph */
@@ -747,7 +747,7 @@ int record_callchain_opt(const struct option *opt,
747 const char *arg __maybe_unused, 747 const char *arg __maybe_unused,
748 int unset __maybe_unused) 748 int unset __maybe_unused)
749{ 749{
750 struct perf_record_opts *opts = opt->value; 750 struct record_opts *opts = opt->value;
751 751
752 if (opts->call_graph == CALLCHAIN_NONE) 752 if (opts->call_graph == CALLCHAIN_NONE)
753 opts->call_graph = CALLCHAIN_FP; 753 opts->call_graph = CALLCHAIN_FP;
@@ -796,7 +796,7 @@ const char record_callchain_help[] = CALLCHAIN_HELP "fp";
796/* 796/*
797 * XXX Will stay a global variable till we fix builtin-script.c to stop messing 797 * XXX Will stay a global variable till we fix builtin-script.c to stop messing
798 * with it and switch to use the library functions in perf_evlist that came 798 * with it and switch to use the library functions in perf_evlist that came
799 * from builtin-record.c, i.e. use perf_record_opts, 799 * from builtin-record.c, i.e. use record_opts,
800 * perf_evlist__prepare_workload, etc instead of fork+exec'in 'perf record', 800 * perf_evlist__prepare_workload, etc instead of fork+exec'in 'perf record',
801 * using pipes, etc. 801 * using pipes, etc.
802 */ 802 */
@@ -944,7 +944,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
944 if (perf_evlist__create_maps(evsel_list, &rec->opts.target) < 0) 944 if (perf_evlist__create_maps(evsel_list, &rec->opts.target) < 0)
945 usage_with_options(record_usage, record_options); 945 usage_with_options(record_usage, record_options);
946 946
947 if (perf_record_opts__config(&rec->opts)) { 947 if (record_opts__config(&rec->opts)) {
948 err = -EINVAL; 948 err = -EINVAL;
949 goto out_free_fd; 949 goto out_free_fd;
950 } 950 }
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 2c6cb66f5358..172e91a9ce62 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -854,7 +854,7 @@ static int perf_top__start_counters(struct perf_top *top)
854 char msg[512]; 854 char msg[512];
855 struct perf_evsel *counter; 855 struct perf_evsel *counter;
856 struct perf_evlist *evlist = top->evlist; 856 struct perf_evlist *evlist = top->evlist;
857 struct perf_record_opts *opts = &top->record_opts; 857 struct record_opts *opts = &top->record_opts;
858 858
859 perf_evlist__config(evlist, opts); 859 perf_evlist__config(evlist, opts);
860 860
@@ -906,7 +906,7 @@ static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused)
906 906
907static int __cmd_top(struct perf_top *top) 907static int __cmd_top(struct perf_top *top)
908{ 908{
909 struct perf_record_opts *opts = &top->record_opts; 909 struct record_opts *opts = &top->record_opts;
910 pthread_t thread; 910 pthread_t thread;
911 int ret; 911 int ret;
912 912
@@ -1028,7 +1028,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1028 .max_stack = PERF_MAX_STACK_DEPTH, 1028 .max_stack = PERF_MAX_STACK_DEPTH,
1029 .sym_pcnt_filter = 5, 1029 .sym_pcnt_filter = 5,
1030 }; 1030 };
1031 struct perf_record_opts *opts = &top.record_opts; 1031 struct record_opts *opts = &top.record_opts;
1032 struct target *target = &opts->target; 1032 struct target *target = &opts->target;
1033 const struct option options[] = { 1033 const struct option options[] = {
1034 OPT_CALLBACK('e', "event", &top.evlist, "event", 1034 OPT_CALLBACK('e', "event", &top.evlist, "event",
@@ -1179,7 +1179,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1179 if (top.delay_secs < 1) 1179 if (top.delay_secs < 1)
1180 top.delay_secs = 1; 1180 top.delay_secs = 1;
1181 1181
1182 if (perf_record_opts__config(opts)) { 1182 if (record_opts__config(opts)) {
1183 status = -EINVAL; 1183 status = -EINVAL;
1184 goto out_delete_maps; 1184 goto out_delete_maps;
1185 } 1185 }
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 56bbca5bc2dc..f64b5b0aa8b1 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1159,7 +1159,7 @@ struct trace {
1159 int max; 1159 int max;
1160 struct syscall *table; 1160 struct syscall *table;
1161 } syscalls; 1161 } syscalls;
1162 struct perf_record_opts opts; 1162 struct record_opts opts;
1163 struct machine *host; 1163 struct machine *host;
1164 u64 base_time; 1164 u64 base_time;
1165 bool full_time; 1165 bool full_time;
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index b23fed527514..b1cc84b01d5b 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -247,7 +247,7 @@ enum perf_call_graph_mode {
247 CALLCHAIN_DWARF 247 CALLCHAIN_DWARF
248}; 248};
249 249
250struct perf_record_opts { 250struct record_opts {
251 struct target target; 251 struct target target;
252 int call_graph; 252 int call_graph;
253 bool group; 253 bool group;
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 85d4919dd623..4248d1e96848 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -391,7 +391,7 @@ static int do_test_code_reading(bool try_kcore)
391 struct machines machines; 391 struct machines machines;
392 struct machine *machine; 392 struct machine *machine;
393 struct thread *thread; 393 struct thread *thread;
394 struct perf_record_opts opts = { 394 struct record_opts opts = {
395 .mmap_pages = UINT_MAX, 395 .mmap_pages = UINT_MAX,
396 .user_freq = UINT_MAX, 396 .user_freq = UINT_MAX,
397 .user_interval = ULLONG_MAX, 397 .user_interval = ULLONG_MAX,
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 376c35608534..27eb75142b88 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -51,7 +51,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm)
51 */ 51 */
52int test__keep_tracking(void) 52int test__keep_tracking(void)
53{ 53{
54 struct perf_record_opts opts = { 54 struct record_opts opts = {
55 .mmap_pages = UINT_MAX, 55 .mmap_pages = UINT_MAX,
56 .user_freq = UINT_MAX, 56 .user_freq = UINT_MAX,
57 .user_interval = ULLONG_MAX, 57 .user_interval = ULLONG_MAX,
diff --git a/tools/perf/tests/open-syscall-tp-fields.c b/tools/perf/tests/open-syscall-tp-fields.c
index 41cc0badb74b..774620a5aecb 100644
--- a/tools/perf/tests/open-syscall-tp-fields.c
+++ b/tools/perf/tests/open-syscall-tp-fields.c
@@ -6,7 +6,7 @@
6 6
7int test__syscall_open_tp_fields(void) 7int test__syscall_open_tp_fields(void)
8{ 8{
9 struct perf_record_opts opts = { 9 struct record_opts opts = {
10 .target = { 10 .target = {
11 .uid = UINT_MAX, 11 .uid = UINT_MAX,
12 .uses_mmap = true, 12 .uses_mmap = true,
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 93a62b06c3af..eeba562920e9 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -34,7 +34,7 @@ realloc:
34 34
35int test__PERF_RECORD(void) 35int test__PERF_RECORD(void)
36{ 36{
37 struct perf_record_opts opts = { 37 struct record_opts opts = {
38 .target = { 38 .target = {
39 .uid = UINT_MAX, 39 .uid = UINT_MAX,
40 .uses_mmap = true, 40 .uses_mmap = true,
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c
index 4ca1b938f6a6..c6398b90e897 100644
--- a/tools/perf/tests/perf-time-to-tsc.c
+++ b/tools/perf/tests/perf-time-to-tsc.c
@@ -46,7 +46,7 @@ static u64 rdtsc(void)
46 */ 46 */
47int test__perf_time_to_tsc(void) 47int test__perf_time_to_tsc(void)
48{ 48{
49 struct perf_record_opts opts = { 49 struct record_opts opts = {
50 .mmap_pages = UINT_MAX, 50 .mmap_pages = UINT_MAX,
51 .user_freq = UINT_MAX, 51 .user_freq = UINT_MAX,
52 .user_interval = ULLONG_MAX, 52 .user_interval = ULLONG_MAX,
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 4f7f989876ec..08b25af9eea1 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -146,7 +146,7 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor)
146 146
147struct option; 147struct option;
148 148
149int record_parse_callchain(const char *arg, struct perf_record_opts *opts); 149int record_parse_callchain(const char *arg, struct record_opts *opts);
150int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); 150int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset);
151int record_callchain_opt(const struct option *opt, const char *arg, int unset); 151int record_callchain_opt(const struct option *opt, const char *arg, int unset);
152 152
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 9f64ede3ecbd..2fe51958ed85 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -12,7 +12,7 @@
12struct pollfd; 12struct pollfd;
13struct thread_map; 13struct thread_map;
14struct cpu_map; 14struct cpu_map;
15struct perf_record_opts; 15struct record_opts;
16 16
17#define PERF_EVLIST__HLIST_BITS 8 17#define PERF_EVLIST__HLIST_BITS 8
18#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) 18#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
@@ -97,9 +97,8 @@ void perf_evlist__close(struct perf_evlist *evlist);
97 97
98void perf_evlist__set_id_pos(struct perf_evlist *evlist); 98void perf_evlist__set_id_pos(struct perf_evlist *evlist);
99bool perf_can_sample_identifier(void); 99bool perf_can_sample_identifier(void);
100void perf_evlist__config(struct perf_evlist *evlist, 100void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts);
101 struct perf_record_opts *opts); 101int record_opts__config(struct record_opts *opts);
102int perf_record_opts__config(struct perf_record_opts *opts);
103 102
104int perf_evlist__prepare_workload(struct perf_evlist *evlist, 103int perf_evlist__prepare_workload(struct perf_evlist *evlist,
105 struct target *target, 104 struct target *target,
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 01ff4cfde1f5..6874e0485693 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -528,8 +528,7 @@ int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size)
528 * enable/disable events specifically, as there's no 528 * enable/disable events specifically, as there's no
529 * initial traced exec call. 529 * initial traced exec call.
530 */ 530 */
531void perf_evsel__config(struct perf_evsel *evsel, 531void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
532 struct perf_record_opts *opts)
533{ 532{
534 struct perf_evsel *leader = evsel->leader; 533 struct perf_evsel *leader = evsel->leader;
535 struct perf_event_attr *attr = &evsel->attr; 534 struct perf_event_attr *attr = &evsel->attr;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 8120eeb86ac1..f1b325665aae 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -96,7 +96,7 @@ struct perf_evsel {
96struct cpu_map; 96struct cpu_map;
97struct thread_map; 97struct thread_map;
98struct perf_evlist; 98struct perf_evlist;
99struct perf_record_opts; 99struct record_opts;
100 100
101struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx); 101struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx);
102 102
@@ -120,7 +120,7 @@ void perf_evsel__exit(struct perf_evsel *evsel);
120void perf_evsel__delete(struct perf_evsel *evsel); 120void perf_evsel__delete(struct perf_evsel *evsel);
121 121
122void perf_evsel__config(struct perf_evsel *evsel, 122void perf_evsel__config(struct perf_evsel *evsel,
123 struct perf_record_opts *opts); 123 struct record_opts *opts);
124 124
125int __perf_evsel__sample_size(u64 sample_type); 125int __perf_evsel__sample_size(u64 sample_type);
126void perf_evsel__calc_id_pos(struct perf_evsel *evsel); 126void perf_evsel__calc_id_pos(struct perf_evsel *evsel);
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index e5104538c354..104a47563d39 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -74,8 +74,7 @@ bool perf_can_sample_identifier(void)
74 return perf_probe_api(perf_probe_sample_identifier); 74 return perf_probe_api(perf_probe_sample_identifier);
75} 75}
76 76
77void perf_evlist__config(struct perf_evlist *evlist, 77void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts)
78 struct perf_record_opts *opts)
79{ 78{
80 struct perf_evsel *evsel; 79 struct perf_evsel *evsel;
81 bool use_sample_identifier = false; 80 bool use_sample_identifier = false;
@@ -123,7 +122,7 @@ static int get_max_rate(unsigned int *rate)
123 return filename__read_int(path, (int *) rate); 122 return filename__read_int(path, (int *) rate);
124} 123}
125 124
126static int perf_record_opts__config_freq(struct perf_record_opts *opts) 125static int record_opts__config_freq(struct record_opts *opts)
127{ 126{
128 bool user_freq = opts->user_freq != UINT_MAX; 127 bool user_freq = opts->user_freq != UINT_MAX;
129 unsigned int max_rate; 128 unsigned int max_rate;
@@ -173,9 +172,9 @@ static int perf_record_opts__config_freq(struct perf_record_opts *opts)
173 return 0; 172 return 0;
174} 173}
175 174
176int perf_record_opts__config(struct perf_record_opts *opts) 175int record_opts__config(struct record_opts *opts)
177{ 176{
178 return perf_record_opts__config_freq(opts); 177 return record_opts__config_freq(opts);
179} 178}
180 179
181bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str) 180bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str)
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c
index ce793c7dd23c..8e517def925b 100644
--- a/tools/perf/util/top.c
+++ b/tools/perf/util/top.c
@@ -26,7 +26,7 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size)
26 float samples_per_sec; 26 float samples_per_sec;
27 float ksamples_per_sec; 27 float ksamples_per_sec;
28 float esamples_percent; 28 float esamples_percent;
29 struct perf_record_opts *opts = &top->record_opts; 29 struct record_opts *opts = &top->record_opts;
30 struct target *target = &opts->target; 30 struct target *target = &opts->target;
31 size_t ret = 0; 31 size_t ret = 0;
32 32
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index 88cfeaff600b..dab14d0ad3d0 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -14,7 +14,7 @@ struct perf_session;
14struct perf_top { 14struct perf_top {
15 struct perf_tool tool; 15 struct perf_tool tool;
16 struct perf_evlist *evlist; 16 struct perf_evlist *evlist;
17 struct perf_record_opts record_opts; 17 struct record_opts record_opts;
18 /* 18 /*
19 * Symbols will be added here in perf_event__process_sample and will 19 * Symbols will be added here in perf_event__process_sample and will
20 * get out after decayed. 20 * get out after decayed.