perf evlist: Use the right prefix for 'struct evlist' sample id lookup 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
fd643db5a8
commit
3ccf8a7b66
|
@ -2224,7 +2224,7 @@ static int print_event_with_time(struct perf_tool *tool,
|
|||
{
|
||||
struct perf_script *script = container_of(tool, struct perf_script, tool);
|
||||
struct perf_session *session = script->session;
|
||||
struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
|
||||
struct evsel *evsel = evlist__id2evsel(session->evlist, sample->id);
|
||||
struct thread *thread = NULL;
|
||||
|
||||
if (evsel && !evsel->core.attr.sample_id_all) {
|
||||
|
|
|
@ -1159,7 +1159,7 @@ static int deliver_event(struct ordered_events *qe,
|
|||
goto next_event;
|
||||
}
|
||||
|
||||
evsel = perf_evlist__id2evsel(session->evlist, sample.id);
|
||||
evsel = evlist__id2evsel(session->evlist, sample.id);
|
||||
assert(evsel != NULL);
|
||||
|
||||
if (event->header.type == PERF_RECORD_SAMPLE) {
|
||||
|
|
|
@ -3105,7 +3105,7 @@ static void trace__handle_event(struct trace *trace, union perf_event *event, st
|
|||
return;
|
||||
}
|
||||
|
||||
evsel = perf_evlist__id2evsel(trace->evlist, sample->id);
|
||||
evsel = evlist__id2evsel(trace->evlist, sample->id);
|
||||
if (evsel == NULL) {
|
||||
fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample->id);
|
||||
return;
|
||||
|
|
|
@ -133,7 +133,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
|
|||
}
|
||||
|
||||
err = -1;
|
||||
evsel = perf_evlist__id2evsel(evlist, sample.id);
|
||||
evsel = evlist__id2evsel(evlist, sample.id);
|
||||
if (evsel == NULL) {
|
||||
pr_debug("event with id %" PRIu64
|
||||
" doesn't map to an evsel\n", sample.id);
|
||||
|
|
|
@ -133,7 +133,7 @@ static int process_sample_event(struct evlist *evlist,
|
|||
return -1;
|
||||
}
|
||||
|
||||
evsel = perf_evlist__id2evsel(evlist, sample.id);
|
||||
evsel = evlist__id2evsel(evlist, sample.id);
|
||||
if (evsel == switch_tracking->switch_evsel) {
|
||||
next_tid = evsel__intval(evsel, &sample, "next_pid");
|
||||
prev_tid = evsel__intval(evsel, &sample, "prev_pid");
|
||||
|
|
|
@ -1017,7 +1017,7 @@ struct auxtrace_queue *auxtrace_queues__sample_queue(struct auxtrace_queues *que
|
|||
if (!id)
|
||||
return NULL;
|
||||
|
||||
sid = perf_evlist__id2sid(session->evlist, id);
|
||||
sid = evlist__id2sid(session->evlist, id);
|
||||
if (!sid)
|
||||
return NULL;
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ int auxtrace_queues__add_sample(struct auxtrace_queues *queues,
|
|||
if (!id)
|
||||
return -EINVAL;
|
||||
|
||||
sid = perf_evlist__id2sid(session->evlist, id);
|
||||
sid = evlist__id2sid(session->evlist, id);
|
||||
if (!sid)
|
||||
return -ENOENT;
|
||||
|
||||
|
|
|
@ -509,7 +509,7 @@ int evlist__poll(struct evlist *evlist, int timeout)
|
|||
return perf_evlist__poll(&evlist->core, timeout);
|
||||
}
|
||||
|
||||
struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id)
|
||||
struct perf_sample_id *evlist__id2sid(struct evlist *evlist, u64 id)
|
||||
{
|
||||
struct hlist_head *head;
|
||||
struct perf_sample_id *sid;
|
||||
|
@ -525,14 +525,14 @@ struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id)
|
||||
struct evsel *evlist__id2evsel(struct evlist *evlist, u64 id)
|
||||
{
|
||||
struct perf_sample_id *sid;
|
||||
|
||||
if (evlist->core.nr_entries == 1 || !id)
|
||||
return evlist__first(evlist);
|
||||
|
||||
sid = perf_evlist__id2sid(evlist, id);
|
||||
sid = evlist__id2sid(evlist, id);
|
||||
if (sid)
|
||||
return container_of(sid->evsel, struct evsel, core);
|
||||
|
||||
|
@ -542,23 +542,21 @@ struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,
|
||||
u64 id)
|
||||
struct evsel *evlist__id2evsel_strict(struct evlist *evlist, u64 id)
|
||||
{
|
||||
struct perf_sample_id *sid;
|
||||
|
||||
if (!id)
|
||||
return NULL;
|
||||
|
||||
sid = perf_evlist__id2sid(evlist, id);
|
||||
sid = evlist__id2sid(evlist, id);
|
||||
if (sid)
|
||||
return container_of(sid->evsel, struct evsel, core);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int perf_evlist__event2id(struct evlist *evlist,
|
||||
union perf_event *event, u64 *id)
|
||||
static int evlist__event2id(struct evlist *evlist, union perf_event *event, u64 *id)
|
||||
{
|
||||
const __u64 *array = event->sample.array;
|
||||
ssize_t n;
|
||||
|
@ -578,8 +576,7 @@ static int perf_evlist__event2id(struct evlist *evlist,
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
|
||||
union perf_event *event)
|
||||
struct evsel *evlist__event2evsel(struct evlist *evlist, union perf_event *event)
|
||||
{
|
||||
struct evsel *first = evlist__first(evlist);
|
||||
struct hlist_head *head;
|
||||
|
@ -594,7 +591,7 @@ struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
|
|||
event->header.type != PERF_RECORD_SAMPLE)
|
||||
return first;
|
||||
|
||||
if (perf_evlist__event2id(evlist, event, &id))
|
||||
if (evlist__event2id(evlist, event, &id))
|
||||
return NULL;
|
||||
|
||||
/* Synthesized events have an id of zero */
|
||||
|
@ -1427,7 +1424,7 @@ int evlist__start_workload(struct evlist *evlist)
|
|||
|
||||
int evlist__parse_sample(struct evlist *evlist, union perf_event *event, struct perf_sample *sample)
|
||||
{
|
||||
struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
|
||||
struct evsel *evsel = evlist__event2evsel(evlist, event);
|
||||
|
||||
if (!evsel)
|
||||
return -EFAULT;
|
||||
|
@ -1436,7 +1433,7 @@ int evlist__parse_sample(struct evlist *evlist, union perf_event *event, struct
|
|||
|
||||
int evlist__parse_sample_timestamp(struct evlist *evlist, union perf_event *event, u64 *timestamp)
|
||||
{
|
||||
struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
|
||||
struct evsel *evsel = evlist__event2evsel(evlist, event);
|
||||
|
||||
if (!evsel)
|
||||
return -EFAULT;
|
||||
|
|
|
@ -144,11 +144,10 @@ int evlist__filter_pollfd(struct evlist *evlist, short revents_and_mask);
|
|||
|
||||
int evlist__poll(struct evlist *evlist, int timeout);
|
||||
|
||||
struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id);
|
||||
struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,
|
||||
u64 id);
|
||||
struct evsel *evlist__id2evsel(struct evlist *evlist, u64 id);
|
||||
struct evsel *evlist__id2evsel_strict(struct evlist *evlist, u64 id);
|
||||
|
||||
struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id);
|
||||
struct perf_sample_id *evlist__id2sid(struct evlist *evlist, u64 id);
|
||||
|
||||
void evlist__toggle_bkw_mmap(struct evlist *evlist, enum bkw_mmap_state state);
|
||||
|
||||
|
@ -325,8 +324,7 @@ bool evsel__cpu_iter_skip_no_inc(struct evsel *ev, int cpu);
|
|||
|
||||
struct evsel *evlist__find_evsel_by_str(struct evlist *evlist, const char *str);
|
||||
|
||||
struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
|
||||
union perf_event *event);
|
||||
struct evsel *evlist__event2evsel(struct evlist *evlist, union perf_event *event);
|
||||
|
||||
bool perf_evlist__exclude_kernel(struct evlist *evlist);
|
||||
|
||||
|
|
|
@ -1469,7 +1469,7 @@ static int evsel__process_group_data(struct evsel *leader, int cpu, int thread,
|
|||
for (i = 1; i < nr; i++) {
|
||||
struct evsel *counter;
|
||||
|
||||
counter = perf_evlist__id2evsel(leader->evlist, v[i].id);
|
||||
counter = evlist__id2evsel(leader->evlist, v[i].id);
|
||||
if (!counter)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -4030,7 +4030,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused,
|
|||
|
||||
evlist = *pevlist;
|
||||
|
||||
evsel = perf_evlist__id2evsel(evlist, ev->id);
|
||||
evsel = evlist__id2evsel(evlist, ev->id);
|
||||
if (evsel == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -2520,11 +2520,10 @@ static int intel_pt_sync_switch(struct intel_pt *pt, int cpu, pid_t tid,
|
|||
static int intel_pt_process_switch(struct intel_pt *pt,
|
||||
struct perf_sample *sample)
|
||||
{
|
||||
struct evsel *evsel;
|
||||
pid_t tid;
|
||||
int cpu, ret;
|
||||
struct evsel *evsel = evlist__id2evsel(pt->session->evlist, sample->id);
|
||||
|
||||
evsel = perf_evlist__id2evsel(pt->session->evlist, sample->id);
|
||||
if (evsel != pt->switch_evsel)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -1055,7 +1055,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
|
|||
if (pyevent == NULL)
|
||||
return PyErr_NoMemory();
|
||||
|
||||
evsel = perf_evlist__event2evsel(evlist, event);
|
||||
evsel = evlist__event2evsel(evlist, event);
|
||||
if (!evsel) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
|
|
@ -932,7 +932,7 @@ s390_cpumsf_process_event(struct perf_session *session,
|
|||
if (event->header.type == PERF_RECORD_SAMPLE &&
|
||||
sample->raw_size) {
|
||||
/* Handle event with raw data */
|
||||
ev_bc000 = perf_evlist__event2evsel(session->evlist, event);
|
||||
ev_bc000 = evlist__event2evsel(session->evlist, event);
|
||||
if (ev_bc000 &&
|
||||
ev_bc000->core.attr.config == PERF_EVENT_CPUM_CF_DIAG)
|
||||
err = s390_cpumcf_dumpctr(sf, sample);
|
||||
|
|
|
@ -205,7 +205,7 @@ void perf_evlist__s390_sample_raw(struct evlist *evlist, union perf_event *event
|
|||
if (event->header.type != PERF_RECORD_SAMPLE)
|
||||
return;
|
||||
|
||||
ev_bc000 = perf_evlist__event2evsel(evlist, event);
|
||||
ev_bc000 = evlist__event2evsel(evlist, event);
|
||||
if (ev_bc000 == NULL ||
|
||||
ev_bc000->core.attr.config != PERF_EVENT_CPUM_CF_DIAG)
|
||||
return;
|
||||
|
|
|
@ -1364,7 +1364,7 @@ static int deliver_sample_value(struct evlist *evlist,
|
|||
struct sample_read_value *v,
|
||||
struct machine *machine)
|
||||
{
|
||||
struct perf_sample_id *sid = perf_evlist__id2sid(evlist, v->id);
|
||||
struct perf_sample_id *sid = evlist__id2sid(evlist, v->id);
|
||||
struct evsel *evsel;
|
||||
|
||||
if (sid) {
|
||||
|
@ -1445,7 +1445,7 @@ static int machines__deliver_event(struct machines *machines,
|
|||
|
||||
dump_event(evlist, event, file_offset, sample);
|
||||
|
||||
evsel = perf_evlist__id2evsel(evlist, sample->id);
|
||||
evsel = evlist__id2evsel(evlist, sample->id);
|
||||
|
||||
machine = machines__find_for_cpumode(machines, event, sample);
|
||||
|
||||
|
@ -2476,7 +2476,7 @@ int perf_event__process_id_index(struct perf_session *session,
|
|||
fprintf(stdout, " tid: %"PRI_ld64"\n", e->tid);
|
||||
}
|
||||
|
||||
sid = perf_evlist__id2sid(evlist, e->id);
|
||||
sid = evlist__id2sid(evlist, e->id);
|
||||
if (!sid)
|
||||
return -ENOENT;
|
||||
sid->idx = e->idx;
|
||||
|
|
|
@ -62,7 +62,7 @@ static void *perf_evlist__poll_thread(void *arg)
|
|||
if (perf_mmap__read_init(&map->core))
|
||||
continue;
|
||||
while ((event = perf_mmap__read_event(&map->core)) != NULL) {
|
||||
struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
|
||||
struct evsel *evsel = evlist__event2evsel(evlist, event);
|
||||
|
||||
if (evsel && evsel->side_band.cb)
|
||||
evsel->side_band.cb(event, evsel->side_band.data);
|
||||
|
|
|
@ -458,7 +458,7 @@ int perf_event__process_stat_event(struct perf_session *session,
|
|||
count.ena = st->ena;
|
||||
count.run = st->run;
|
||||
|
||||
counter = perf_evlist__id2evsel(session->evlist, st->id);
|
||||
counter = evlist__id2evsel(session->evlist, st->id);
|
||||
if (!counter) {
|
||||
pr_err("Failed to resolve counter for stat event.\n");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -1643,7 +1643,7 @@ int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_
|
|||
|
||||
e->id = evsel->core.id[j];
|
||||
|
||||
sid = perf_evlist__id2sid(evlist, e->id);
|
||||
sid = evlist__id2sid(evlist, e->id);
|
||||
if (!sid) {
|
||||
free(ev);
|
||||
return -ENOENT;
|
||||
|
|
Loading…
Reference in New Issue