perf evsel: Convert last 'struct evsel' methods to the right evsel__ prefix

As 'perf_evsel__' means its a function in tools/lib/perf/.

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 94b69c61
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
#include "tests.h" #include "tests.h"
#include "debug.h" #include "debug.h"
static int perf_evsel__test_field(struct evsel *evsel, const char *name, static int evsel__test_field(struct evsel *evsel, const char *name, int size, bool should_be_signed)
int size, bool should_be_signed)
{ {
struct tep_format_field *field = evsel__field(evsel, name); struct tep_format_field *field = evsel__field(evsel, name);
int is_signed; int is_signed;
...@@ -43,25 +42,25 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes ...@@ -43,25 +42,25 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes
return -1; return -1;
} }
if (perf_evsel__test_field(evsel, "prev_comm", 16, false)) if (evsel__test_field(evsel, "prev_comm", 16, false))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "prev_pid", 4, true)) if (evsel__test_field(evsel, "prev_pid", 4, true))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "prev_prio", 4, true)) if (evsel__test_field(evsel, "prev_prio", 4, true))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "prev_state", sizeof(long), true)) if (evsel__test_field(evsel, "prev_state", sizeof(long), true))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "next_comm", 16, false)) if (evsel__test_field(evsel, "next_comm", 16, false))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "next_pid", 4, true)) if (evsel__test_field(evsel, "next_pid", 4, true))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "next_prio", 4, true)) if (evsel__test_field(evsel, "next_prio", 4, true))
ret = -1; ret = -1;
evsel__delete(evsel); evsel__delete(evsel);
...@@ -73,16 +72,16 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes ...@@ -73,16 +72,16 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes
return -1; return -1;
} }
if (perf_evsel__test_field(evsel, "comm", 16, false)) if (evsel__test_field(evsel, "comm", 16, false))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "pid", 4, true)) if (evsel__test_field(evsel, "pid", 4, true))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "prio", 4, true)) if (evsel__test_field(evsel, "prio", 4, true))
ret = -1; ret = -1;
if (perf_evsel__test_field(evsel, "target_cpu", 4, true)) if (evsel__test_field(evsel, "target_cpu", 4, true))
ret = -1; ret = -1;
evsel__delete(evsel); evsel__delete(evsel);
......
...@@ -2946,14 +2946,10 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb, ...@@ -2946,14 +2946,10 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb,
} }
} }
static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events, static int evsel__hists_browse(struct evsel *evsel, int nr_events, const char *helpline,
const char *helpline, bool left_exits, struct hist_browser_timer *hbt, float min_pcnt,
bool left_exits, struct perf_env *env, bool warn_lost_event,
struct hist_browser_timer *hbt, struct annotation_options *annotation_opts)
float min_pcnt,
struct perf_env *env,
bool warn_lost_event,
struct annotation_options *annotation_opts)
{ {
struct hists *hists = evsel__hists(evsel); struct hists *hists = evsel__hists(evsel);
struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts); struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts);
...@@ -3505,12 +3501,10 @@ static int perf_evsel_menu__run(struct evsel_menu *menu, ...@@ -3505,12 +3501,10 @@ static int perf_evsel_menu__run(struct evsel_menu *menu,
*/ */
if (hbt) if (hbt)
hbt->timer(hbt->arg); hbt->timer(hbt->arg);
key = perf_evsel__hists_browse(pos, nr_events, help, key = evsel__hists_browse(pos, nr_events, help, true, hbt,
true, hbt, menu->min_pcnt, menu->env,
menu->min_pcnt, warn_lost_event,
menu->env, menu->annotation_opts);
warn_lost_event,
menu->annotation_opts);
ui_browser__show_title(&menu->b, title); ui_browser__show_title(&menu->b, title);
switch (key) { switch (key) {
case K_TAB: case K_TAB:
...@@ -3633,10 +3627,8 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help, ...@@ -3633,10 +3627,8 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help,
single_entry: { single_entry: {
struct evsel *first = evlist__first(evlist); struct evsel *first = evlist__first(evlist);
return perf_evsel__hists_browse(first, nr_entries, help, return evsel__hists_browse(first, nr_entries, help, false, hbt, min_pcnt,
false, hbt, min_pcnt, env, warn_lost_event, annotation_opts);
env, warn_lost_event,
annotation_opts);
} }
} }
......
...@@ -497,7 +497,7 @@ static const char *__evsel__hw_name(u64 config) ...@@ -497,7 +497,7 @@ static const char *__evsel__hw_name(u64 config)
return "unknown-hardware"; return "unknown-hardware";
} }
static int perf_evsel__add_modifiers(struct evsel *evsel, char *bf, size_t size) static int evsel__add_modifiers(struct evsel *evsel, char *bf, size_t size)
{ {
int colon = 0, r = 0; int colon = 0, r = 0;
struct perf_event_attr *attr = &evsel->core.attr; struct perf_event_attr *attr = &evsel->core.attr;
...@@ -536,7 +536,7 @@ static int perf_evsel__add_modifiers(struct evsel *evsel, char *bf, size_t size) ...@@ -536,7 +536,7 @@ static int perf_evsel__add_modifiers(struct evsel *evsel, char *bf, size_t size)
static int evsel__hw_name(struct evsel *evsel, char *bf, size_t size) static int evsel__hw_name(struct evsel *evsel, char *bf, size_t size)
{ {
int r = scnprintf(bf, size, "%s", __evsel__hw_name(evsel->core.attr.config)); int r = scnprintf(bf, size, "%s", __evsel__hw_name(evsel->core.attr.config));
return r + perf_evsel__add_modifiers(evsel, bf + r, size - r); return r + evsel__add_modifiers(evsel, bf + r, size - r);
} }
const char *evsel__sw_names[PERF_COUNT_SW_MAX] = { const char *evsel__sw_names[PERF_COUNT_SW_MAX] = {
...@@ -562,7 +562,7 @@ static const char *__evsel__sw_name(u64 config) ...@@ -562,7 +562,7 @@ static const char *__evsel__sw_name(u64 config)
static int evsel__sw_name(struct evsel *evsel, char *bf, size_t size) static int evsel__sw_name(struct evsel *evsel, char *bf, size_t size)
{ {
int r = scnprintf(bf, size, "%s", __evsel__sw_name(evsel->core.attr.config)); int r = scnprintf(bf, size, "%s", __evsel__sw_name(evsel->core.attr.config));
return r + perf_evsel__add_modifiers(evsel, bf + r, size - r); return r + evsel__add_modifiers(evsel, bf + r, size - r);
} }
static int __evsel__bp_name(char *bf, size_t size, u64 addr, u64 type) static int __evsel__bp_name(char *bf, size_t size, u64 addr, u64 type)
...@@ -587,7 +587,7 @@ static int evsel__bp_name(struct evsel *evsel, char *bf, size_t size) ...@@ -587,7 +587,7 @@ static int evsel__bp_name(struct evsel *evsel, char *bf, size_t size)
{ {
struct perf_event_attr *attr = &evsel->core.attr; struct perf_event_attr *attr = &evsel->core.attr;
int r = __evsel__bp_name(bf, size, attr->bp_addr, attr->bp_type); int r = __evsel__bp_name(bf, size, attr->bp_addr, attr->bp_type);
return r + perf_evsel__add_modifiers(evsel, bf + r, size - r); return r + evsel__add_modifiers(evsel, bf + r, size - r);
} }
const char *evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX][EVSEL__MAX_ALIASES] = { const char *evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX][EVSEL__MAX_ALIASES] = {
...@@ -682,13 +682,13 @@ static int __evsel__hw_cache_name(u64 config, char *bf, size_t size) ...@@ -682,13 +682,13 @@ static int __evsel__hw_cache_name(u64 config, char *bf, size_t size)
static int evsel__hw_cache_name(struct evsel *evsel, char *bf, size_t size) static int evsel__hw_cache_name(struct evsel *evsel, char *bf, size_t size)
{ {
int ret = __evsel__hw_cache_name(evsel->core.attr.config, bf, size); int ret = __evsel__hw_cache_name(evsel->core.attr.config, bf, size);
return ret + perf_evsel__add_modifiers(evsel, bf + ret, size - ret); return ret + evsel__add_modifiers(evsel, bf + ret, size - ret);
} }
static int evsel__raw_name(struct evsel *evsel, char *bf, size_t size) static int evsel__raw_name(struct evsel *evsel, char *bf, size_t size)
{ {
int ret = scnprintf(bf, size, "raw 0x%" PRIx64, evsel->core.attr.config); int ret = scnprintf(bf, size, "raw 0x%" PRIx64, evsel->core.attr.config);
return ret + perf_evsel__add_modifiers(evsel, bf + ret, size - ret); return ret + evsel__add_modifiers(evsel, bf + ret, size - ret);
} }
static int evsel__tool_name(char *bf, size_t size) static int evsel__tool_name(char *bf, size_t size)
...@@ -850,9 +850,7 @@ void evsel__config_callchain(struct evsel *evsel, struct record_opts *opts, ...@@ -850,9 +850,7 @@ void evsel__config_callchain(struct evsel *evsel, struct record_opts *opts,
return __evsel__config_callchain(evsel, opts, param); return __evsel__config_callchain(evsel, opts, param);
} }
static void static void evsel__reset_callgraph(struct evsel *evsel, struct callchain_param *param)
perf_evsel__reset_callgraph(struct evsel *evsel,
struct callchain_param *param)
{ {
struct perf_event_attr *attr = &evsel->core.attr; struct perf_event_attr *attr = &evsel->core.attr;
...@@ -988,7 +986,7 @@ static void evsel__apply_config_terms(struct evsel *evsel, ...@@ -988,7 +986,7 @@ static void evsel__apply_config_terms(struct evsel *evsel,
/* If global callgraph set, clear it */ /* If global callgraph set, clear it */
if (callchain_param.enabled) if (callchain_param.enabled)
perf_evsel__reset_callgraph(evsel, &callchain_param); evsel__reset_callgraph(evsel, &callchain_param);
/* set perf-event callgraph */ /* set perf-event callgraph */
if (param.enabled) { if (param.enabled) {
...@@ -1434,9 +1432,7 @@ static int evsel__read_one(struct evsel *evsel, int cpu, int thread) ...@@ -1434,9 +1432,7 @@ static int evsel__read_one(struct evsel *evsel, int cpu, int thread)
return perf_evsel__read(&evsel->core, cpu, thread, count); return perf_evsel__read(&evsel->core, cpu, thread, count);
} }
static void static void evsel__set_count(struct evsel *counter, int cpu, int thread, u64 val, u64 ena, u64 run)
perf_evsel__set_count(struct evsel *counter, int cpu, int thread,
u64 val, u64 ena, u64 run)
{ {
struct perf_counts_values *count; struct perf_counts_values *count;
...@@ -1449,9 +1445,7 @@ perf_evsel__set_count(struct evsel *counter, int cpu, int thread, ...@@ -1449,9 +1445,7 @@ perf_evsel__set_count(struct evsel *counter, int cpu, int thread,
perf_counts__set_loaded(counter->counts, cpu, thread, true); perf_counts__set_loaded(counter->counts, cpu, thread, true);
} }
static int static int evsel__process_group_data(struct evsel *leader, int cpu, int thread, u64 *data)
perf_evsel__process_group_data(struct evsel *leader,
int cpu, int thread, u64 *data)
{ {
u64 read_format = leader->core.attr.read_format; u64 read_format = leader->core.attr.read_format;
struct sample_read_value *v; struct sample_read_value *v;
...@@ -1470,8 +1464,7 @@ perf_evsel__process_group_data(struct evsel *leader, ...@@ -1470,8 +1464,7 @@ perf_evsel__process_group_data(struct evsel *leader,
v = (struct sample_read_value *) data; v = (struct sample_read_value *) data;
perf_evsel__set_count(leader, cpu, thread, evsel__set_count(leader, cpu, thread, v[0].value, ena, run);
v[0].value, ena, run);
for (i = 1; i < nr; i++) { for (i = 1; i < nr; i++) {
struct evsel *counter; struct evsel *counter;
...@@ -1480,8 +1473,7 @@ perf_evsel__process_group_data(struct evsel *leader, ...@@ -1480,8 +1473,7 @@ perf_evsel__process_group_data(struct evsel *leader,
if (!counter) if (!counter)
return -EINVAL; return -EINVAL;
perf_evsel__set_count(counter, cpu, thread, evsel__set_count(counter, cpu, thread, v[i].value, ena, run);
v[i].value, ena, run);
} }
return 0; return 0;
...@@ -1514,7 +1506,7 @@ static int evsel__read_group(struct evsel *leader, int cpu, int thread) ...@@ -1514,7 +1506,7 @@ static int evsel__read_group(struct evsel *leader, int cpu, int thread)
if (readn(FD(leader, cpu, thread), data, size) <= 0) if (readn(FD(leader, cpu, thread), data, size) <= 0)
return -errno; return -errno;
return perf_evsel__process_group_data(leader, cpu, thread, data); return evsel__process_group_data(leader, cpu, thread, data);
} }
int evsel__read_counter(struct evsel *evsel, int cpu, int thread) int evsel__read_counter(struct evsel *evsel, int cpu, int thread)
...@@ -1567,9 +1559,7 @@ static int get_group_fd(struct evsel *evsel, int cpu, int thread) ...@@ -1567,9 +1559,7 @@ static int get_group_fd(struct evsel *evsel, int cpu, int thread)
return fd; return fd;
} }
static void perf_evsel__remove_fd(struct evsel *pos, static void evsel__remove_fd(struct evsel *pos, int nr_cpus, int nr_threads, int thread_idx)
int nr_cpus, int nr_threads,
int thread_idx)
{ {
for (int cpu = 0; cpu < nr_cpus; cpu++) for (int cpu = 0; cpu < nr_cpus; cpu++)
for (int thread = thread_idx; thread < nr_threads - 1; thread++) for (int thread = thread_idx; thread < nr_threads - 1; thread++)
...@@ -1588,7 +1578,7 @@ static int update_fds(struct evsel *evsel, ...@@ -1588,7 +1578,7 @@ static int update_fds(struct evsel *evsel,
evlist__for_each_entry(evsel->evlist, pos) { evlist__for_each_entry(evsel->evlist, pos) {
nr_cpus = pos != evsel ? nr_cpus : cpu_idx; nr_cpus = pos != evsel ? nr_cpus : cpu_idx;
perf_evsel__remove_fd(pos, nr_cpus, nr_threads, thread_idx); evsel__remove_fd(pos, nr_cpus, nr_threads, thread_idx);
/* /*
* Since fds for next evsel has not been created, * Since fds for next evsel has not been created,
......
...@@ -3735,8 +3735,7 @@ static int read_attr(int fd, struct perf_header *ph, ...@@ -3735,8 +3735,7 @@ static int read_attr(int fd, struct perf_header *ph,
return ret <= 0 ? -1 : 0; return ret <= 0 ? -1 : 0;
} }
static int perf_evsel__prepare_tracepoint_event(struct evsel *evsel, static int evsel__prepare_tracepoint_event(struct evsel *evsel, struct tep_handle *pevent)
struct tep_handle *pevent)
{ {
struct tep_event *event; struct tep_event *event;
char bf[128]; char bf[128];
...@@ -3774,7 +3773,7 @@ static int perf_evlist__prepare_tracepoint_events(struct evlist *evlist, ...@@ -3774,7 +3773,7 @@ static int perf_evlist__prepare_tracepoint_events(struct evlist *evlist,
evlist__for_each_entry(evlist, pos) { evlist__for_each_entry(evlist, pos) {
if (pos->core.attr.type == PERF_TYPE_TRACEPOINT && if (pos->core.attr.type == PERF_TYPE_TRACEPOINT &&
perf_evsel__prepare_tracepoint_event(pos, pevent)) evsel__prepare_tracepoint_event(pos, pevent))
return -1; return -1;
} }
......
...@@ -229,7 +229,7 @@ void perf_evlist__reset_prev_raw_counts(struct evlist *evlist) ...@@ -229,7 +229,7 @@ void perf_evlist__reset_prev_raw_counts(struct evlist *evlist)
evsel__reset_prev_raw_counts(evsel); evsel__reset_prev_raw_counts(evsel);
} }
static void perf_evsel__copy_prev_raw_counts(struct evsel *evsel) static void evsel__copy_prev_raw_counts(struct evsel *evsel)
{ {
int ncpus = evsel__nr_cpus(evsel); int ncpus = evsel__nr_cpus(evsel);
int nthreads = perf_thread_map__nr(evsel->core.threads); int nthreads = perf_thread_map__nr(evsel->core.threads);
...@@ -250,7 +250,7 @@ void perf_evlist__copy_prev_raw_counts(struct evlist *evlist) ...@@ -250,7 +250,7 @@ void perf_evlist__copy_prev_raw_counts(struct evlist *evlist)
struct evsel *evsel; struct evsel *evsel;
evlist__for_each_entry(evlist, evsel) evlist__for_each_entry(evlist, evsel)
perf_evsel__copy_prev_raw_counts(evsel); evsel__copy_prev_raw_counts(evsel);
} }
void perf_evlist__save_aggr_prev_raw_counts(struct evlist *evlist) void perf_evlist__save_aggr_prev_raw_counts(struct evlist *evlist)
......
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