mirror of https://gitee.com/openkylin/linux.git
perf evlist: Use the right prefix for 'struct evlist' 'find' 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
2a6599cd5e
commit
b02736f776
|
@ -1960,18 +1960,15 @@ int cmd_kmem(int argc, const char **argv)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
if (kmem_slab) {
|
if (kmem_slab) {
|
||||||
if (!perf_evlist__find_tracepoint_by_name(session->evlist,
|
if (!evlist__find_tracepoint_by_name(session->evlist, "kmem:kmalloc")) {
|
||||||
"kmem:kmalloc")) {
|
|
||||||
pr_err(errmsg, "slab", "slab");
|
pr_err(errmsg, "slab", "slab");
|
||||||
goto out_delete;
|
goto out_delete;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kmem_page) {
|
if (kmem_page) {
|
||||||
struct evsel *evsel;
|
struct evsel *evsel = evlist__find_tracepoint_by_name(session->evlist, "kmem:mm_page_alloc");
|
||||||
|
|
||||||
evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
|
|
||||||
"kmem:mm_page_alloc");
|
|
||||||
if (evsel == NULL) {
|
if (evsel == NULL) {
|
||||||
pr_err(errmsg, "page", "page");
|
pr_err(errmsg, "page", "page");
|
||||||
goto out_delete;
|
goto out_delete;
|
||||||
|
|
|
@ -3036,8 +3036,7 @@ static int perf_sched__timehist(struct perf_sched *sched)
|
||||||
setup_pager();
|
setup_pager();
|
||||||
|
|
||||||
/* prefer sched_waking if it is captured */
|
/* prefer sched_waking if it is captured */
|
||||||
if (perf_evlist__find_tracepoint_by_name(session->evlist,
|
if (evlist__find_tracepoint_by_name(session->evlist, "sched:sched_waking"))
|
||||||
"sched:sched_waking"))
|
|
||||||
handlers[1].handler = timehist_sched_wakeup_ignore;
|
handlers[1].handler = timehist_sched_wakeup_ignore;
|
||||||
|
|
||||||
/* setup per-evsel handlers */
|
/* setup per-evsel handlers */
|
||||||
|
@ -3045,8 +3044,7 @@ static int perf_sched__timehist(struct perf_sched *sched)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* sched_switch event at a minimum needs to exist */
|
/* sched_switch event at a minimum needs to exist */
|
||||||
if (!perf_evlist__find_tracepoint_by_name(session->evlist,
|
if (!evlist__find_tracepoint_by_name(session->evlist, "sched:sched_switch")) {
|
||||||
"sched:sched_switch")) {
|
|
||||||
pr_err("No sched_switch events found. Have you run 'perf sched record'?\n");
|
pr_err("No sched_switch events found. Have you run 'perf sched record'?\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4227,12 +4227,10 @@ static int trace__replay(struct trace *trace)
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
|
evsel = evlist__find_tracepoint_by_name(session->evlist, "raw_syscalls:sys_enter");
|
||||||
"raw_syscalls:sys_enter");
|
|
||||||
/* older kernels have syscalls tp versus raw_syscalls */
|
/* older kernels have syscalls tp versus raw_syscalls */
|
||||||
if (evsel == NULL)
|
if (evsel == NULL)
|
||||||
evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
|
evsel = evlist__find_tracepoint_by_name(session->evlist, "syscalls:sys_enter");
|
||||||
"syscalls:sys_enter");
|
|
||||||
|
|
||||||
if (evsel &&
|
if (evsel &&
|
||||||
(evsel__init_raw_syscall_tp(evsel, trace__sys_enter) < 0 ||
|
(evsel__init_raw_syscall_tp(evsel, trace__sys_enter) < 0 ||
|
||||||
|
@ -4241,11 +4239,9 @@ static int trace__replay(struct trace *trace)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
|
evsel = evlist__find_tracepoint_by_name(session->evlist, "raw_syscalls:sys_exit");
|
||||||
"raw_syscalls:sys_exit");
|
|
||||||
if (evsel == NULL)
|
if (evsel == NULL)
|
||||||
evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
|
evsel = evlist__find_tracepoint_by_name(session->evlist, "syscalls:sys_exit");
|
||||||
"syscalls:sys_exit");
|
|
||||||
if (evsel &&
|
if (evsel &&
|
||||||
(evsel__init_raw_syscall_tp(evsel, trace__sys_exit) < 0 ||
|
(evsel__init_raw_syscall_tp(evsel, trace__sys_exit) < 0 ||
|
||||||
perf_evsel__init_sc_tp_uint_field(evsel, ret))) {
|
perf_evsel__init_sc_tp_uint_field(evsel, ret))) {
|
||||||
|
@ -4905,7 +4901,7 @@ int cmd_trace(int argc, const char **argv)
|
||||||
if (evsel) {
|
if (evsel) {
|
||||||
trace.syscalls.events.augmented = evsel;
|
trace.syscalls.events.augmented = evsel;
|
||||||
|
|
||||||
evsel = perf_evlist__find_tracepoint_by_name(trace.evlist, "raw_syscalls:sys_enter");
|
evsel = evlist__find_tracepoint_by_name(trace.evlist, "raw_syscalls:sys_enter");
|
||||||
if (evsel == NULL) {
|
if (evsel == NULL) {
|
||||||
pr_err("ERROR: raw_syscalls:sys_enter not found in the augmented BPF object\n");
|
pr_err("ERROR: raw_syscalls:sys_enter not found in the augmented BPF object\n");
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -1058,12 +1058,11 @@ __bpf_map__config_event(struct bpf_map *map,
|
||||||
struct parse_events_term *term,
|
struct parse_events_term *term,
|
||||||
struct evlist *evlist)
|
struct evlist *evlist)
|
||||||
{
|
{
|
||||||
struct evsel *evsel;
|
|
||||||
const struct bpf_map_def *def;
|
const struct bpf_map_def *def;
|
||||||
struct bpf_map_op *op;
|
struct bpf_map_op *op;
|
||||||
const char *map_name = bpf_map__name(map);
|
const char *map_name = bpf_map__name(map);
|
||||||
|
struct evsel *evsel = evlist__find_evsel_by_str(evlist, term->val.str);
|
||||||
|
|
||||||
evsel = perf_evlist__find_evsel_by_str(evlist, term->val.str);
|
|
||||||
if (!evsel) {
|
if (!evsel) {
|
||||||
pr_debug("Event (for '%s') '%s' doesn't exist\n",
|
pr_debug("Event (for '%s') '%s' doesn't exist\n",
|
||||||
map_name, term->val.str);
|
map_name, term->val.str);
|
||||||
|
|
|
@ -191,13 +191,12 @@ void perf_evlist__splice_list_tail(struct evlist *evlist,
|
||||||
int __evlist__set_tracepoints_handlers(struct evlist *evlist,
|
int __evlist__set_tracepoints_handlers(struct evlist *evlist,
|
||||||
const struct evsel_str_handler *assocs, size_t nr_assocs)
|
const struct evsel_str_handler *assocs, size_t nr_assocs)
|
||||||
{
|
{
|
||||||
struct evsel *evsel;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
for (i = 0; i < nr_assocs; i++) {
|
for (i = 0; i < nr_assocs; i++) {
|
||||||
// Adding a handler for an event not in this evlist, just ignore it.
|
// Adding a handler for an event not in this evlist, just ignore it.
|
||||||
evsel = perf_evlist__find_tracepoint_by_name(evlist, assocs[i].name);
|
struct evsel *evsel = evlist__find_tracepoint_by_name(evlist, assocs[i].name);
|
||||||
if (evsel == NULL)
|
if (evsel == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -294,8 +293,7 @@ int __evlist__add_default_attrs(struct evlist *evlist, struct perf_event_attr *a
|
||||||
return evlist__add_attrs(evlist, attrs, nr_attrs);
|
return evlist__add_attrs(evlist, attrs, nr_attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct evsel *
|
struct evsel *evlist__find_tracepoint_by_id(struct evlist *evlist, int id)
|
||||||
perf_evlist__find_tracepoint_by_id(struct evlist *evlist, int id)
|
|
||||||
{
|
{
|
||||||
struct evsel *evsel;
|
struct evsel *evsel;
|
||||||
|
|
||||||
|
@ -308,9 +306,7 @@ perf_evlist__find_tracepoint_by_id(struct evlist *evlist, int id)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct evsel *
|
struct evsel *evlist__find_tracepoint_by_name(struct evlist *evlist, const char *name)
|
||||||
perf_evlist__find_tracepoint_by_name(struct evlist *evlist,
|
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
struct evsel *evsel;
|
struct evsel *evsel;
|
||||||
|
|
||||||
|
@ -1594,9 +1590,7 @@ void perf_evlist__set_tracking_event(struct evlist *evlist,
|
||||||
tracking_evsel->tracking = true;
|
tracking_evsel->tracking = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct evsel *
|
struct evsel *evlist__find_evsel_by_str(struct evlist *evlist, const char *str)
|
||||||
perf_evlist__find_evsel_by_str(struct evlist *evlist,
|
|
||||||
const char *str)
|
|
||||||
{
|
{
|
||||||
struct evsel *evsel;
|
struct evsel *evsel;
|
||||||
|
|
||||||
|
|
|
@ -147,12 +147,8 @@ int evlist__append_tp_filter(struct evlist *evlist, const char *filter);
|
||||||
int evlist__append_tp_filter_pid(struct evlist *evlist, pid_t pid);
|
int evlist__append_tp_filter_pid(struct evlist *evlist, pid_t pid);
|
||||||
int evlist__append_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids);
|
int evlist__append_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids);
|
||||||
|
|
||||||
struct evsel *
|
struct evsel *evlist__find_tracepoint_by_id(struct evlist *evlist, int id);
|
||||||
perf_evlist__find_tracepoint_by_id(struct evlist *evlist, int id);
|
struct evsel *evlist__find_tracepoint_by_name(struct evlist *evlist, const char *name);
|
||||||
|
|
||||||
struct evsel *
|
|
||||||
perf_evlist__find_tracepoint_by_name(struct evlist *evlist,
|
|
||||||
const char *name);
|
|
||||||
|
|
||||||
int evlist__add_pollfd(struct evlist *evlist, int fd);
|
int evlist__add_pollfd(struct evlist *evlist, int fd);
|
||||||
int evlist__filter_pollfd(struct evlist *evlist, short revents_and_mask);
|
int evlist__filter_pollfd(struct evlist *evlist, short revents_and_mask);
|
||||||
|
@ -338,8 +334,7 @@ void evlist__cpu_iter_start(struct evlist *evlist);
|
||||||
bool evsel__cpu_iter_skip(struct evsel *ev, int cpu);
|
bool evsel__cpu_iter_skip(struct evsel *ev, int cpu);
|
||||||
bool evsel__cpu_iter_skip_no_inc(struct evsel *ev, int cpu);
|
bool evsel__cpu_iter_skip_no_inc(struct evsel *ev, int cpu);
|
||||||
|
|
||||||
struct evsel *
|
struct evsel *evlist__find_evsel_by_str(struct evlist *evlist, const char *str);
|
||||||
perf_evlist__find_evsel_by_str(struct evlist *evlist, const char *str);
|
|
||||||
|
|
||||||
struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
|
struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
|
||||||
union perf_event *event);
|
union perf_event *event);
|
||||||
|
|
|
@ -41,7 +41,7 @@ static int evswitch__fprintf_enoent(FILE *fp, const char *evtype, const char *ev
|
||||||
int evswitch__init(struct evswitch *evswitch, struct evlist *evlist, FILE *fp)
|
int evswitch__init(struct evswitch *evswitch, struct evlist *evlist, FILE *fp)
|
||||||
{
|
{
|
||||||
if (evswitch->on_name) {
|
if (evswitch->on_name) {
|
||||||
evswitch->on = perf_evlist__find_evsel_by_str(evlist, evswitch->on_name);
|
evswitch->on = evlist__find_evsel_by_str(evlist, evswitch->on_name);
|
||||||
if (evswitch->on == NULL) {
|
if (evswitch->on == NULL) {
|
||||||
evswitch__fprintf_enoent(fp, "on", evswitch->on_name);
|
evswitch__fprintf_enoent(fp, "on", evswitch->on_name);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
@ -50,7 +50,7 @@ int evswitch__init(struct evswitch *evswitch, struct evlist *evlist, FILE *fp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evswitch->off_name) {
|
if (evswitch->off_name) {
|
||||||
evswitch->off = perf_evlist__find_evsel_by_str(evlist, evswitch->off_name);
|
evswitch->off = evlist__find_evsel_by_str(evlist, evswitch->off_name);
|
||||||
if (evswitch->off == NULL) {
|
if (evswitch->off == NULL) {
|
||||||
evswitch__fprintf_enoent(fp, "off", evswitch->off_name);
|
evswitch__fprintf_enoent(fp, "off", evswitch->off_name);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
|
@ -2263,8 +2263,7 @@ static int process_total_mem(struct feat_fd *ff, void *data __maybe_unused)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct evsel *
|
static struct evsel *evlist__find_by_index(struct evlist *evlist, int idx)
|
||||||
perf_evlist__find_by_index(struct evlist *evlist, int idx)
|
|
||||||
{
|
{
|
||||||
struct evsel *evsel;
|
struct evsel *evsel;
|
||||||
|
|
||||||
|
@ -2285,7 +2284,7 @@ perf_evlist__set_event_name(struct evlist *evlist,
|
||||||
if (!event->name)
|
if (!event->name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
evsel = perf_evlist__find_by_index(evlist, event->idx);
|
evsel = evlist__find_by_index(evlist, event->idx);
|
||||||
if (!evsel)
|
if (!evsel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue