perf tools: Rename 'perf_record_opts' to 'record_opts

Reduce typing, functions use class__method convention, so unlikely to
clash with other libraries.

This actually was discussed in the "Link:" referenced message below.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20131112113427.GA4053@ghostprotocols.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8c6f45a7
...@@ -89,7 +89,7 @@ struct exit_reasons_table { ...@@ -89,7 +89,7 @@ struct exit_reasons_table {
struct perf_kvm_stat { struct perf_kvm_stat {
struct perf_tool tool; struct perf_tool tool;
struct perf_record_opts opts; struct record_opts opts;
struct perf_evlist *evlist; struct perf_evlist *evlist;
struct perf_session *session; struct perf_session *session;
......
...@@ -64,7 +64,7 @@ static void __handle_on_exit_funcs(void) ...@@ -64,7 +64,7 @@ static void __handle_on_exit_funcs(void)
struct record { struct record {
struct perf_tool tool; struct perf_tool tool;
struct perf_record_opts opts; struct record_opts opts;
u64 bytes_written; u64 bytes_written;
struct perf_data_file file; struct perf_data_file file;
struct perf_evlist *evlist; struct perf_evlist *evlist;
...@@ -178,7 +178,7 @@ static int record__open(struct record *rec) ...@@ -178,7 +178,7 @@ static int record__open(struct record *rec)
struct perf_evsel *pos; struct perf_evsel *pos;
struct perf_evlist *evlist = rec->evlist; struct perf_evlist *evlist = rec->evlist;
struct perf_session *session = rec->session; struct perf_session *session = rec->session;
struct perf_record_opts *opts = &rec->opts; struct record_opts *opts = &rec->opts;
int rc = 0; int rc = 0;
perf_evlist__config(evlist, opts); perf_evlist__config(evlist, opts);
...@@ -348,7 +348,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) ...@@ -348,7 +348,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
const bool forks = argc > 0; const bool forks = argc > 0;
struct machine *machine; struct machine *machine;
struct perf_tool *tool = &rec->tool; struct perf_tool *tool = &rec->tool;
struct perf_record_opts *opts = &rec->opts; struct record_opts *opts = &rec->opts;
struct perf_evlist *evsel_list = rec->evlist; struct perf_evlist *evsel_list = rec->evlist;
struct perf_data_file *file = &rec->file; struct perf_data_file *file = &rec->file;
struct perf_session *session; struct perf_session *session;
...@@ -657,7 +657,7 @@ static int get_stack_size(char *str, unsigned long *_size) ...@@ -657,7 +657,7 @@ static int get_stack_size(char *str, unsigned long *_size)
} }
#endif /* HAVE_LIBUNWIND_SUPPORT */ #endif /* HAVE_LIBUNWIND_SUPPORT */
int record_parse_callchain(const char *arg, struct perf_record_opts *opts) int record_parse_callchain(const char *arg, struct record_opts *opts)
{ {
char *tok, *name, *saveptr = NULL; char *tok, *name, *saveptr = NULL;
char *buf; char *buf;
...@@ -713,7 +713,7 @@ int record_parse_callchain(const char *arg, struct perf_record_opts *opts) ...@@ -713,7 +713,7 @@ int record_parse_callchain(const char *arg, struct perf_record_opts *opts)
return ret; return ret;
} }
static void callchain_debug(struct perf_record_opts *opts) static void callchain_debug(struct record_opts *opts)
{ {
pr_debug("callchain: type %d\n", opts->call_graph); pr_debug("callchain: type %d\n", opts->call_graph);
...@@ -726,7 +726,7 @@ int record_parse_callchain_opt(const struct option *opt, ...@@ -726,7 +726,7 @@ int record_parse_callchain_opt(const struct option *opt,
const char *arg, const char *arg,
int unset) int unset)
{ {
struct perf_record_opts *opts = opt->value; struct record_opts *opts = opt->value;
int ret; int ret;
/* --no-call-graph */ /* --no-call-graph */
...@@ -747,7 +747,7 @@ int record_callchain_opt(const struct option *opt, ...@@ -747,7 +747,7 @@ int record_callchain_opt(const struct option *opt,
const char *arg __maybe_unused, const char *arg __maybe_unused,
int unset __maybe_unused) int unset __maybe_unused)
{ {
struct perf_record_opts *opts = opt->value; struct record_opts *opts = opt->value;
if (opts->call_graph == CALLCHAIN_NONE) if (opts->call_graph == CALLCHAIN_NONE)
opts->call_graph = CALLCHAIN_FP; opts->call_graph = CALLCHAIN_FP;
...@@ -796,7 +796,7 @@ const char record_callchain_help[] = CALLCHAIN_HELP "fp"; ...@@ -796,7 +796,7 @@ const char record_callchain_help[] = CALLCHAIN_HELP "fp";
/* /*
* XXX Will stay a global variable till we fix builtin-script.c to stop messing * XXX Will stay a global variable till we fix builtin-script.c to stop messing
* with it and switch to use the library functions in perf_evlist that came * with it and switch to use the library functions in perf_evlist that came
* from builtin-record.c, i.e. use perf_record_opts, * from builtin-record.c, i.e. use record_opts,
* perf_evlist__prepare_workload, etc instead of fork+exec'in 'perf record', * perf_evlist__prepare_workload, etc instead of fork+exec'in 'perf record',
* using pipes, etc. * using pipes, etc.
*/ */
...@@ -944,7 +944,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -944,7 +944,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
if (perf_evlist__create_maps(evsel_list, &rec->opts.target) < 0) if (perf_evlist__create_maps(evsel_list, &rec->opts.target) < 0)
usage_with_options(record_usage, record_options); usage_with_options(record_usage, record_options);
if (perf_record_opts__config(&rec->opts)) { if (record_opts__config(&rec->opts)) {
err = -EINVAL; err = -EINVAL;
goto out_free_fd; goto out_free_fd;
} }
......
...@@ -854,7 +854,7 @@ static int perf_top__start_counters(struct perf_top *top) ...@@ -854,7 +854,7 @@ static int perf_top__start_counters(struct perf_top *top)
char msg[512]; char msg[512];
struct perf_evsel *counter; struct perf_evsel *counter;
struct perf_evlist *evlist = top->evlist; struct perf_evlist *evlist = top->evlist;
struct perf_record_opts *opts = &top->record_opts; struct record_opts *opts = &top->record_opts;
perf_evlist__config(evlist, opts); perf_evlist__config(evlist, opts);
...@@ -906,7 +906,7 @@ static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused) ...@@ -906,7 +906,7 @@ static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused)
static int __cmd_top(struct perf_top *top) static int __cmd_top(struct perf_top *top)
{ {
struct perf_record_opts *opts = &top->record_opts; struct record_opts *opts = &top->record_opts;
pthread_t thread; pthread_t thread;
int ret; int ret;
...@@ -1028,7 +1028,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -1028,7 +1028,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
.max_stack = PERF_MAX_STACK_DEPTH, .max_stack = PERF_MAX_STACK_DEPTH,
.sym_pcnt_filter = 5, .sym_pcnt_filter = 5,
}; };
struct perf_record_opts *opts = &top.record_opts; struct record_opts *opts = &top.record_opts;
struct target *target = &opts->target; struct target *target = &opts->target;
const struct option options[] = { const struct option options[] = {
OPT_CALLBACK('e', "event", &top.evlist, "event", 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,7 +1179,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
if (top.delay_secs < 1) if (top.delay_secs < 1)
top.delay_secs = 1; top.delay_secs = 1;
if (perf_record_opts__config(opts)) { if (record_opts__config(opts)) {
status = -EINVAL; status = -EINVAL;
goto out_delete_maps; goto out_delete_maps;
} }
......
...@@ -1159,7 +1159,7 @@ struct trace { ...@@ -1159,7 +1159,7 @@ struct trace {
int max; int max;
struct syscall *table; struct syscall *table;
} syscalls; } syscalls;
struct perf_record_opts opts; struct record_opts opts;
struct machine *host; struct machine *host;
u64 base_time; u64 base_time;
bool full_time; bool full_time;
......
...@@ -247,7 +247,7 @@ enum perf_call_graph_mode { ...@@ -247,7 +247,7 @@ enum perf_call_graph_mode {
CALLCHAIN_DWARF CALLCHAIN_DWARF
}; };
struct perf_record_opts { struct record_opts {
struct target target; struct target target;
int call_graph; int call_graph;
bool group; bool group;
......
...@@ -391,7 +391,7 @@ static int do_test_code_reading(bool try_kcore) ...@@ -391,7 +391,7 @@ static int do_test_code_reading(bool try_kcore)
struct machines machines; struct machines machines;
struct machine *machine; struct machine *machine;
struct thread *thread; struct thread *thread;
struct perf_record_opts opts = { struct record_opts opts = {
.mmap_pages = UINT_MAX, .mmap_pages = UINT_MAX,
.user_freq = UINT_MAX, .user_freq = UINT_MAX,
.user_interval = ULLONG_MAX, .user_interval = ULLONG_MAX,
......
...@@ -51,7 +51,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm) ...@@ -51,7 +51,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm)
*/ */
int test__keep_tracking(void) int test__keep_tracking(void)
{ {
struct perf_record_opts opts = { struct record_opts opts = {
.mmap_pages = UINT_MAX, .mmap_pages = UINT_MAX,
.user_freq = UINT_MAX, .user_freq = UINT_MAX,
.user_interval = ULLONG_MAX, .user_interval = ULLONG_MAX,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
int test__syscall_open_tp_fields(void) int test__syscall_open_tp_fields(void)
{ {
struct perf_record_opts opts = { struct record_opts opts = {
.target = { .target = {
.uid = UINT_MAX, .uid = UINT_MAX,
.uses_mmap = true, .uses_mmap = true,
......
...@@ -34,7 +34,7 @@ static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp) ...@@ -34,7 +34,7 @@ static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
int test__PERF_RECORD(void) int test__PERF_RECORD(void)
{ {
struct perf_record_opts opts = { struct record_opts opts = {
.target = { .target = {
.uid = UINT_MAX, .uid = UINT_MAX,
.uses_mmap = true, .uses_mmap = true,
......
...@@ -46,7 +46,7 @@ static u64 rdtsc(void) ...@@ -46,7 +46,7 @@ static u64 rdtsc(void)
*/ */
int test__perf_time_to_tsc(void) int test__perf_time_to_tsc(void)
{ {
struct perf_record_opts opts = { struct record_opts opts = {
.mmap_pages = UINT_MAX, .mmap_pages = UINT_MAX,
.user_freq = UINT_MAX, .user_freq = UINT_MAX,
.user_interval = ULLONG_MAX, .user_interval = ULLONG_MAX,
......
...@@ -146,7 +146,7 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor) ...@@ -146,7 +146,7 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor)
struct option; struct option;
int record_parse_callchain(const char *arg, struct perf_record_opts *opts); int record_parse_callchain(const char *arg, struct record_opts *opts);
int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset);
int record_callchain_opt(const struct option *opt, const char *arg, int unset); int record_callchain_opt(const struct option *opt, const char *arg, int unset);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
struct pollfd; struct pollfd;
struct thread_map; struct thread_map;
struct cpu_map; struct cpu_map;
struct perf_record_opts; struct record_opts;
#define PERF_EVLIST__HLIST_BITS 8 #define PERF_EVLIST__HLIST_BITS 8
#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
...@@ -97,9 +97,8 @@ void perf_evlist__close(struct perf_evlist *evlist); ...@@ -97,9 +97,8 @@ void perf_evlist__close(struct perf_evlist *evlist);
void perf_evlist__set_id_pos(struct perf_evlist *evlist); void perf_evlist__set_id_pos(struct perf_evlist *evlist);
bool perf_can_sample_identifier(void); bool perf_can_sample_identifier(void);
void perf_evlist__config(struct perf_evlist *evlist, void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts);
struct perf_record_opts *opts); int record_opts__config(struct record_opts *opts);
int perf_record_opts__config(struct perf_record_opts *opts);
int perf_evlist__prepare_workload(struct perf_evlist *evlist, int perf_evlist__prepare_workload(struct perf_evlist *evlist,
struct target *target, struct target *target,
......
...@@ -528,8 +528,7 @@ int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size) ...@@ -528,8 +528,7 @@ int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size)
* enable/disable events specifically, as there's no * enable/disable events specifically, as there's no
* initial traced exec call. * initial traced exec call.
*/ */
void perf_evsel__config(struct perf_evsel *evsel, void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
struct perf_record_opts *opts)
{ {
struct perf_evsel *leader = evsel->leader; struct perf_evsel *leader = evsel->leader;
struct perf_event_attr *attr = &evsel->attr; struct perf_event_attr *attr = &evsel->attr;
......
...@@ -96,7 +96,7 @@ struct perf_evsel { ...@@ -96,7 +96,7 @@ struct perf_evsel {
struct cpu_map; struct cpu_map;
struct thread_map; struct thread_map;
struct perf_evlist; struct perf_evlist;
struct perf_record_opts; struct record_opts;
struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx); struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx);
...@@ -120,7 +120,7 @@ void perf_evsel__exit(struct perf_evsel *evsel); ...@@ -120,7 +120,7 @@ void perf_evsel__exit(struct perf_evsel *evsel);
void perf_evsel__delete(struct perf_evsel *evsel); void perf_evsel__delete(struct perf_evsel *evsel);
void perf_evsel__config(struct perf_evsel *evsel, void perf_evsel__config(struct perf_evsel *evsel,
struct perf_record_opts *opts); struct record_opts *opts);
int __perf_evsel__sample_size(u64 sample_type); int __perf_evsel__sample_size(u64 sample_type);
void perf_evsel__calc_id_pos(struct perf_evsel *evsel); void perf_evsel__calc_id_pos(struct perf_evsel *evsel);
......
...@@ -74,8 +74,7 @@ bool perf_can_sample_identifier(void) ...@@ -74,8 +74,7 @@ bool perf_can_sample_identifier(void)
return perf_probe_api(perf_probe_sample_identifier); return perf_probe_api(perf_probe_sample_identifier);
} }
void perf_evlist__config(struct perf_evlist *evlist, void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts)
struct perf_record_opts *opts)
{ {
struct perf_evsel *evsel; struct perf_evsel *evsel;
bool use_sample_identifier = false; bool use_sample_identifier = false;
...@@ -123,7 +122,7 @@ static int get_max_rate(unsigned int *rate) ...@@ -123,7 +122,7 @@ static int get_max_rate(unsigned int *rate)
return filename__read_int(path, (int *) rate); return filename__read_int(path, (int *) rate);
} }
static int perf_record_opts__config_freq(struct perf_record_opts *opts) static int record_opts__config_freq(struct record_opts *opts)
{ {
bool user_freq = opts->user_freq != UINT_MAX; bool user_freq = opts->user_freq != UINT_MAX;
unsigned int max_rate; unsigned int max_rate;
...@@ -173,9 +172,9 @@ static int perf_record_opts__config_freq(struct perf_record_opts *opts) ...@@ -173,9 +172,9 @@ static int perf_record_opts__config_freq(struct perf_record_opts *opts)
return 0; return 0;
} }
int perf_record_opts__config(struct perf_record_opts *opts) int record_opts__config(struct record_opts *opts)
{ {
return perf_record_opts__config_freq(opts); return record_opts__config_freq(opts);
} }
bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str) bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str)
......
...@@ -26,7 +26,7 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size) ...@@ -26,7 +26,7 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size)
float samples_per_sec; float samples_per_sec;
float ksamples_per_sec; float ksamples_per_sec;
float esamples_percent; float esamples_percent;
struct perf_record_opts *opts = &top->record_opts; struct record_opts *opts = &top->record_opts;
struct target *target = &opts->target; struct target *target = &opts->target;
size_t ret = 0; size_t ret = 0;
......
...@@ -14,7 +14,7 @@ struct perf_session; ...@@ -14,7 +14,7 @@ struct perf_session;
struct perf_top { struct perf_top {
struct perf_tool tool; struct perf_tool tool;
struct perf_evlist *evlist; struct perf_evlist *evlist;
struct perf_record_opts record_opts; struct record_opts record_opts;
/* /*
* Symbols will be added here in perf_event__process_sample and will * Symbols will be added here in perf_event__process_sample and will
* get out after decayed. * get out after decayed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment