mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
perf evlist: Use the right prefix for 'struct evlist' 'workload' methods
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/, go on completing this split. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
a622eafa1a
commit
7b392ef04e
@ -67,7 +67,7 @@ static void sig_handler(int sig __maybe_unused)
|
||||
}
|
||||
|
||||
/*
|
||||
* perf_evlist__prepare_workload will send a SIGUSR1 if the fork fails, since
|
||||
* evlist__prepare_workload will send a SIGUSR1 if the fork fails, since
|
||||
* we asked by setting its exec_error to the function below,
|
||||
* ftrace__workload_exec_failed_signal.
|
||||
*
|
||||
@ -600,9 +600,8 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
|
||||
if (write_tracing_file("trace", "0") < 0)
|
||||
goto out;
|
||||
|
||||
if (argc && perf_evlist__prepare_workload(ftrace->evlist,
|
||||
&ftrace->target, argv, false,
|
||||
ftrace__workload_exec_failed_signal) < 0) {
|
||||
if (argc && evlist__prepare_workload(ftrace->evlist, &ftrace->target, argv, false,
|
||||
ftrace__workload_exec_failed_signal) < 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -644,7 +643,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
perf_evlist__start_workload(ftrace->evlist);
|
||||
evlist__start_workload(ftrace->evlist);
|
||||
|
||||
if (ftrace->initial_delay) {
|
||||
usleep(ftrace->initial_delay * 1000);
|
||||
|
@ -1333,7 +1333,7 @@ record__switch_output(struct record *rec, bool at_exit)
|
||||
static volatile int workload_exec_errno;
|
||||
|
||||
/*
|
||||
* perf_evlist__prepare_workload will send a SIGUSR1
|
||||
* evlist__prepare_workload will send a SIGUSR1
|
||||
* if the fork fails, since we asked by setting its
|
||||
* want_signal to true.
|
||||
*/
|
||||
@ -1689,9 +1689,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
|
||||
record__init_features(rec);
|
||||
|
||||
if (forks) {
|
||||
err = perf_evlist__prepare_workload(rec->evlist, &opts->target,
|
||||
argv, data->is_pipe,
|
||||
workload_exec_failed_signal);
|
||||
err = evlist__prepare_workload(rec->evlist, &opts->target, argv, data->is_pipe,
|
||||
workload_exec_failed_signal);
|
||||
if (err < 0) {
|
||||
pr_err("Couldn't run the workload!\n");
|
||||
status = err;
|
||||
@ -1835,7 +1834,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
|
||||
machine);
|
||||
free(event);
|
||||
|
||||
perf_evlist__start_workload(rec->evlist);
|
||||
evlist__start_workload(rec->evlist);
|
||||
}
|
||||
|
||||
if (evlist__initialize_ctlfd(rec->evlist, opts->ctl_fd, opts->ctl_fd_ack))
|
||||
@ -2413,7 +2412,7 @@ static bool dry_run;
|
||||
* 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
|
||||
* from builtin-record.c, i.e. use record_opts,
|
||||
* perf_evlist__prepare_workload, etc instead of fork+exec'in 'perf record',
|
||||
* evlist__prepare_workload, etc instead of fork+exec'in 'perf record',
|
||||
* using pipes, etc.
|
||||
*/
|
||||
static struct option __record_options[] = {
|
||||
|
@ -534,7 +534,7 @@ static void disable_counters(void)
|
||||
static volatile int workload_exec_errno;
|
||||
|
||||
/*
|
||||
* perf_evlist__prepare_workload will send a SIGUSR1
|
||||
* evlist__prepare_workload will send a SIGUSR1
|
||||
* if the fork fails, since we asked by setting its
|
||||
* want_signal to true.
|
||||
*/
|
||||
@ -724,8 +724,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
|
||||
bool second_pass = false;
|
||||
|
||||
if (forks) {
|
||||
if (perf_evlist__prepare_workload(evsel_list, &target, argv, is_pipe,
|
||||
workload_exec_failed_signal) < 0) {
|
||||
if (evlist__prepare_workload(evsel_list, &target, argv, is_pipe, workload_exec_failed_signal) < 0) {
|
||||
perror("failed to prepare workload");
|
||||
return -1;
|
||||
}
|
||||
@ -876,7 +875,7 @@ try_again_reset:
|
||||
clock_gettime(CLOCK_MONOTONIC, &ref_time);
|
||||
|
||||
if (forks) {
|
||||
perf_evlist__start_workload(evsel_list);
|
||||
evlist__start_workload(evsel_list);
|
||||
enable_counters();
|
||||
|
||||
if (interval || timeout || evlist__ctlfd_initialized(evsel_list))
|
||||
|
@ -3680,7 +3680,7 @@ static int trace__set_filter_pids(struct trace *trace)
|
||||
* Better not use !target__has_task() here because we need to cover the
|
||||
* case where no threads were specified in the command line, but a
|
||||
* workload was, and in that case we will fill in the thread_map when
|
||||
* we fork the workload in perf_evlist__prepare_workload.
|
||||
* we fork the workload in evlist__prepare_workload.
|
||||
*/
|
||||
if (trace->filter_pids.nr > 0) {
|
||||
err = perf_evlist__append_tp_filter_pids(trace->evlist, trace->filter_pids.nr,
|
||||
@ -3969,8 +3969,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
if (forks) {
|
||||
err = perf_evlist__prepare_workload(evlist, &trace->opts.target,
|
||||
argv, false, NULL);
|
||||
err = evlist__prepare_workload(evlist, &trace->opts.target, argv, false, NULL);
|
||||
if (err < 0) {
|
||||
fprintf(trace->output, "Couldn't run the workload!\n");
|
||||
goto out_delete_evlist;
|
||||
@ -4043,7 +4042,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
|
||||
evlist__enable(evlist);
|
||||
|
||||
if (forks)
|
||||
perf_evlist__start_workload(evlist);
|
||||
evlist__start_workload(evlist);
|
||||
|
||||
if (trace->opts.initial_delay) {
|
||||
usleep(trace->opts.initial_delay * 1000);
|
||||
|
@ -32,7 +32,7 @@ static int attach__enable_on_exec(struct evlist *evlist)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = perf_evlist__prepare_workload(evlist, &target, argv, false, NULL);
|
||||
err = evlist__prepare_workload(evlist, &target, argv, false, NULL);
|
||||
if (err < 0) {
|
||||
pr_debug("Couldn't run the workload!\n");
|
||||
return err;
|
||||
@ -47,7 +47,7 @@ static int attach__enable_on_exec(struct evlist *evlist)
|
||||
return err;
|
||||
}
|
||||
|
||||
return perf_evlist__start_workload(evlist) == 1 ? TEST_OK : TEST_FAIL;
|
||||
return evlist__start_workload(evlist) == 1 ? TEST_OK : TEST_FAIL;
|
||||
}
|
||||
|
||||
static int detach__enable_on_exec(struct evlist *evlist)
|
||||
|
@ -81,7 +81,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
||||
/*
|
||||
* Create maps of threads and cpus to monitor. In this case
|
||||
* we start with all threads and cpus (-1, -1) but then in
|
||||
* perf_evlist__prepare_workload we'll fill in the only thread
|
||||
* evlist__prepare_workload we'll fill in the only thread
|
||||
* we're monitoring, the one forked there.
|
||||
*/
|
||||
err = perf_evlist__create_maps(evlist, &opts.target);
|
||||
@ -92,11 +92,11 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
||||
|
||||
/*
|
||||
* Prepare the workload in argv[] to run, it'll fork it, and then wait
|
||||
* for perf_evlist__start_workload() to exec it. This is done this way
|
||||
* for evlist__start_workload() to exec it. This is done this way
|
||||
* so that we have time to open the evlist (calling sys_perf_event_open
|
||||
* on all the fds) and then mmap them.
|
||||
*/
|
||||
err = perf_evlist__prepare_workload(evlist, &opts.target, argv, false, NULL);
|
||||
err = evlist__prepare_workload(evlist, &opts.target, argv, false, NULL);
|
||||
if (err < 0) {
|
||||
pr_debug("Couldn't run the workload!\n");
|
||||
goto out_delete_evlist;
|
||||
@ -161,7 +161,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
||||
/*
|
||||
* Now!
|
||||
*/
|
||||
perf_evlist__start_workload(evlist);
|
||||
evlist__start_workload(evlist);
|
||||
|
||||
while (1) {
|
||||
int before = total_events;
|
||||
|
@ -23,7 +23,7 @@ static void sig_handler(int sig __maybe_unused)
|
||||
}
|
||||
|
||||
/*
|
||||
* perf_evlist__prepare_workload will send a SIGUSR1 if the fork fails, since
|
||||
* evlist__prepare_workload will send a SIGUSR1 if the fork fails, since
|
||||
* we asked by setting its exec_error to this handler.
|
||||
*/
|
||||
static void workload_exec_failed_signal(int signo __maybe_unused,
|
||||
@ -67,7 +67,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
|
||||
/*
|
||||
* Create maps of threads and cpus to monitor. In this case
|
||||
* we start with all threads and cpus (-1, -1) but then in
|
||||
* perf_evlist__prepare_workload we'll fill in the only thread
|
||||
* evlist__prepare_workload we'll fill in the only thread
|
||||
* we're monitoring, the one forked there.
|
||||
*/
|
||||
cpus = perf_cpu_map__dummy_new();
|
||||
@ -83,8 +83,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
|
||||
cpus = NULL;
|
||||
threads = NULL;
|
||||
|
||||
err = perf_evlist__prepare_workload(evlist, &target, argv, false,
|
||||
workload_exec_failed_signal);
|
||||
err = evlist__prepare_workload(evlist, &target, argv, false, workload_exec_failed_signal);
|
||||
if (err < 0) {
|
||||
pr_debug("Couldn't run the workload!\n");
|
||||
goto out_delete_evlist;
|
||||
@ -116,7 +115,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
|
||||
goto out_delete_evlist;
|
||||
}
|
||||
|
||||
perf_evlist__start_workload(evlist);
|
||||
evlist__start_workload(evlist);
|
||||
|
||||
retry:
|
||||
md = &evlist->mmap[0];
|
||||
|
@ -1315,9 +1315,8 @@ out_err:
|
||||
return err;
|
||||
}
|
||||
|
||||
int perf_evlist__prepare_workload(struct evlist *evlist, struct target *target,
|
||||
const char *argv[], bool pipe_output,
|
||||
void (*exec_error)(int signo, siginfo_t *info, void *ucontext))
|
||||
int evlist__prepare_workload(struct evlist *evlist, struct target *target, const char *argv[],
|
||||
bool pipe_output, void (*exec_error)(int signo, siginfo_t *info, void *ucontext))
|
||||
{
|
||||
int child_ready_pipe[2], go_pipe[2];
|
||||
char bf;
|
||||
@ -1362,7 +1361,7 @@ int perf_evlist__prepare_workload(struct evlist *evlist, struct target *target,
|
||||
/*
|
||||
* The parent will ask for the execvp() to be performed by
|
||||
* writing exactly one byte, in workload.cork_fd, usually via
|
||||
* perf_evlist__start_workload().
|
||||
* evlist__start_workload().
|
||||
*
|
||||
* For cancelling the workload without actually running it,
|
||||
* the parent will just close workload.cork_fd, without writing
|
||||
@ -1429,7 +1428,7 @@ out_close_ready_pipe:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int perf_evlist__start_workload(struct evlist *evlist)
|
||||
int evlist__start_workload(struct evlist *evlist)
|
||||
{
|
||||
if (evlist->workload.cork_fd > 0) {
|
||||
char bf = 0;
|
||||
|
@ -182,12 +182,10 @@ void perf_evlist__config(struct evlist *evlist, struct record_opts *opts,
|
||||
struct callchain_param *callchain);
|
||||
int record_opts__config(struct record_opts *opts);
|
||||
|
||||
int perf_evlist__prepare_workload(struct evlist *evlist,
|
||||
struct target *target,
|
||||
const char *argv[], bool pipe_output,
|
||||
void (*exec_error)(int signo, siginfo_t *info,
|
||||
void *ucontext));
|
||||
int perf_evlist__start_workload(struct evlist *evlist);
|
||||
int evlist__prepare_workload(struct evlist *evlist, struct target *target,
|
||||
const char *argv[], bool pipe_output,
|
||||
void (*exec_error)(int signo, siginfo_t *info, void *ucontext));
|
||||
int evlist__start_workload(struct evlist *evlist);
|
||||
|
||||
struct option;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user