perf counts: Rename perf_evsel__*counts() to evsel__*counts()

As these are 'struct evsel' methods, not part of tools/lib/perf/, aka
libperf, to whom the perf_ prefix belongs.

Cc: Adrian Hunter <adrian.hunter@intel.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 c64e85e1
...@@ -90,8 +90,8 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int ...@@ -90,8 +90,8 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int
* we use the auto allocation it will allocate just for 1 cpu, * we use the auto allocation it will allocate just for 1 cpu,
* as we start by cpu 0. * as we start by cpu 0.
*/ */
if (perf_evsel__alloc_counts(evsel, cpus->nr, 1) < 0) { if (evsel__alloc_counts(evsel, cpus->nr, 1) < 0) {
pr_debug("perf_evsel__alloc_counts(ncpus=%d)\n", cpus->nr); pr_debug("evsel__alloc_counts(ncpus=%d)\n", cpus->nr);
goto out_close_fd; goto out_close_fd;
} }
...@@ -117,7 +117,7 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int ...@@ -117,7 +117,7 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int
} }
} }
perf_evsel__free_counts(evsel); evsel__free_counts(evsel);
out_close_fd: out_close_fd:
perf_evsel__close_fd(&evsel->core); perf_evsel__close_fd(&evsel->core);
out_evsel_delete: out_evsel_delete:
......
...@@ -48,18 +48,18 @@ static void perf_counts__reset(struct perf_counts *counts) ...@@ -48,18 +48,18 @@ static void perf_counts__reset(struct perf_counts *counts)
xyarray__reset(counts->values); xyarray__reset(counts->values);
} }
void perf_evsel__reset_counts(struct evsel *evsel) void evsel__reset_counts(struct evsel *evsel)
{ {
perf_counts__reset(evsel->counts); perf_counts__reset(evsel->counts);
} }
int perf_evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads) int evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads)
{ {
evsel->counts = perf_counts__new(ncpus, nthreads); evsel->counts = perf_counts__new(ncpus, nthreads);
return evsel->counts != NULL ? 0 : -ENOMEM; return evsel->counts != NULL ? 0 : -ENOMEM;
} }
void perf_evsel__free_counts(struct evsel *evsel) void evsel__free_counts(struct evsel *evsel)
{ {
perf_counts__delete(evsel->counts); perf_counts__delete(evsel->counts);
evsel->counts = NULL; evsel->counts = NULL;
......
...@@ -38,8 +38,8 @@ perf_counts__set_loaded(struct perf_counts *counts, int cpu, int thread, bool lo ...@@ -38,8 +38,8 @@ perf_counts__set_loaded(struct perf_counts *counts, int cpu, int thread, bool lo
struct perf_counts *perf_counts__new(int ncpus, int nthreads); struct perf_counts *perf_counts__new(int ncpus, int nthreads);
void perf_counts__delete(struct perf_counts *counts); void perf_counts__delete(struct perf_counts *counts);
void perf_evsel__reset_counts(struct evsel *evsel); void evsel__reset_counts(struct evsel *evsel);
int perf_evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads); int evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads);
void perf_evsel__free_counts(struct evsel *evsel); void evsel__free_counts(struct evsel *evsel);
#endif /* __PERF_COUNTS_H */ #endif /* __PERF_COUNTS_H */
...@@ -1252,7 +1252,7 @@ void evsel__exit(struct evsel *evsel) ...@@ -1252,7 +1252,7 @@ void evsel__exit(struct evsel *evsel)
{ {
assert(list_empty(&evsel->core.node)); assert(list_empty(&evsel->core.node));
assert(evsel->evlist == NULL); assert(evsel->evlist == NULL);
perf_evsel__free_counts(evsel); evsel__free_counts(evsel);
perf_evsel__free_fd(&evsel->core); perf_evsel__free_fd(&evsel->core);
perf_evsel__free_id(&evsel->core); perf_evsel__free_id(&evsel->core);
evsel__free_config_terms(evsel); evsel__free_config_terms(evsel);
...@@ -1420,7 +1420,7 @@ int __evsel__read_on_cpu(struct evsel *evsel, int cpu, int thread, bool scale) ...@@ -1420,7 +1420,7 @@ int __evsel__read_on_cpu(struct evsel *evsel, int cpu, int thread, bool scale)
if (FD(evsel, cpu, thread) < 0) if (FD(evsel, cpu, thread) < 0)
return -EINVAL; return -EINVAL;
if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0) if (evsel->counts == NULL && evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0)
return -ENOMEM; return -ENOMEM;
if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0) if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0)
......
...@@ -115,7 +115,7 @@ static void perf_stat_evsel_id_init(struct evsel *evsel) ...@@ -115,7 +115,7 @@ static void perf_stat_evsel_id_init(struct evsel *evsel)
} }
} }
static void perf_evsel__reset_stat_priv(struct evsel *evsel) static void evsel__reset_stat_priv(struct evsel *evsel)
{ {
int i; int i;
struct perf_stat_evsel *ps = evsel->stats; struct perf_stat_evsel *ps = evsel->stats;
...@@ -126,16 +126,16 @@ static void perf_evsel__reset_stat_priv(struct evsel *evsel) ...@@ -126,16 +126,16 @@ static void perf_evsel__reset_stat_priv(struct evsel *evsel)
perf_stat_evsel_id_init(evsel); perf_stat_evsel_id_init(evsel);
} }
static int perf_evsel__alloc_stat_priv(struct evsel *evsel) static int evsel__alloc_stat_priv(struct evsel *evsel)
{ {
evsel->stats = zalloc(sizeof(struct perf_stat_evsel)); evsel->stats = zalloc(sizeof(struct perf_stat_evsel));
if (evsel->stats == NULL) if (evsel->stats == NULL)
return -ENOMEM; return -ENOMEM;
perf_evsel__reset_stat_priv(evsel); evsel__reset_stat_priv(evsel);
return 0; return 0;
} }
static void perf_evsel__free_stat_priv(struct evsel *evsel) static void evsel__free_stat_priv(struct evsel *evsel)
{ {
struct perf_stat_evsel *ps = evsel->stats; struct perf_stat_evsel *ps = evsel->stats;
...@@ -144,8 +144,7 @@ static void perf_evsel__free_stat_priv(struct evsel *evsel) ...@@ -144,8 +144,7 @@ static void perf_evsel__free_stat_priv(struct evsel *evsel)
zfree(&evsel->stats); zfree(&evsel->stats);
} }
static int perf_evsel__alloc_prev_raw_counts(struct evsel *evsel, static int evsel__alloc_prev_raw_counts(struct evsel *evsel, int ncpus, int nthreads)
int ncpus, int nthreads)
{ {
struct perf_counts *counts; struct perf_counts *counts;
...@@ -156,13 +155,13 @@ static int perf_evsel__alloc_prev_raw_counts(struct evsel *evsel, ...@@ -156,13 +155,13 @@ static int perf_evsel__alloc_prev_raw_counts(struct evsel *evsel,
return counts ? 0 : -ENOMEM; return counts ? 0 : -ENOMEM;
} }
static void perf_evsel__free_prev_raw_counts(struct evsel *evsel) static void evsel__free_prev_raw_counts(struct evsel *evsel)
{ {
perf_counts__delete(evsel->prev_raw_counts); perf_counts__delete(evsel->prev_raw_counts);
evsel->prev_raw_counts = NULL; evsel->prev_raw_counts = NULL;
} }
static void perf_evsel__reset_prev_raw_counts(struct evsel *evsel) static void evsel__reset_prev_raw_counts(struct evsel *evsel)
{ {
if (evsel->prev_raw_counts) { if (evsel->prev_raw_counts) {
evsel->prev_raw_counts->aggr.val = 0; evsel->prev_raw_counts->aggr.val = 0;
...@@ -171,14 +170,14 @@ static void perf_evsel__reset_prev_raw_counts(struct evsel *evsel) ...@@ -171,14 +170,14 @@ static void perf_evsel__reset_prev_raw_counts(struct evsel *evsel)
} }
} }
static int perf_evsel__alloc_stats(struct evsel *evsel, bool alloc_raw) static int evsel__alloc_stats(struct evsel *evsel, bool alloc_raw)
{ {
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);
if (perf_evsel__alloc_stat_priv(evsel) < 0 || if (evsel__alloc_stat_priv(evsel) < 0 ||
perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 || evsel__alloc_counts(evsel, ncpus, nthreads) < 0 ||
(alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0)) (alloc_raw && evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0))
return -ENOMEM; return -ENOMEM;
return 0; return 0;
...@@ -189,7 +188,7 @@ int perf_evlist__alloc_stats(struct evlist *evlist, bool alloc_raw) ...@@ -189,7 +188,7 @@ int perf_evlist__alloc_stats(struct evlist *evlist, bool alloc_raw)
struct evsel *evsel; struct evsel *evsel;
evlist__for_each_entry(evlist, evsel) { evlist__for_each_entry(evlist, evsel) {
if (perf_evsel__alloc_stats(evsel, alloc_raw)) if (evsel__alloc_stats(evsel, alloc_raw))
goto out_free; goto out_free;
} }
...@@ -205,9 +204,9 @@ void perf_evlist__free_stats(struct evlist *evlist) ...@@ -205,9 +204,9 @@ void perf_evlist__free_stats(struct evlist *evlist)
struct evsel *evsel; struct evsel *evsel;
evlist__for_each_entry(evlist, evsel) { evlist__for_each_entry(evlist, evsel) {
perf_evsel__free_stat_priv(evsel); evsel__free_stat_priv(evsel);
perf_evsel__free_counts(evsel); evsel__free_counts(evsel);
perf_evsel__free_prev_raw_counts(evsel); evsel__free_prev_raw_counts(evsel);
} }
} }
...@@ -216,8 +215,8 @@ void perf_evlist__reset_stats(struct evlist *evlist) ...@@ -216,8 +215,8 @@ void perf_evlist__reset_stats(struct evlist *evlist)
struct evsel *evsel; struct evsel *evsel;
evlist__for_each_entry(evlist, evsel) { evlist__for_each_entry(evlist, evsel) {
perf_evsel__reset_stat_priv(evsel); evsel__reset_stat_priv(evsel);
perf_evsel__reset_counts(evsel); evsel__reset_counts(evsel);
} }
} }
...@@ -226,7 +225,7 @@ void perf_evlist__reset_prev_raw_counts(struct evlist *evlist) ...@@ -226,7 +225,7 @@ void perf_evlist__reset_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__reset_prev_raw_counts(evsel); evsel__reset_prev_raw_counts(evsel);
} }
static void zero_per_pkg(struct evsel *counter) static void zero_per_pkg(struct evsel *counter)
......
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