diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 8a7fd0c60ab1a04c39aa7e78fbb39bd96288d3fa..0ccba5c6b61dc9a6e53984206b972868d563dc74 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -141,24 +141,6 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a, } } -static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, - int ncpus, int nthreads) -{ - struct perf_counts *counts; - - counts = perf_counts__new(ncpus, nthreads); - if (counts) - evsel->prev_raw_counts = counts; - - return counts ? 0 : -ENOMEM; -} - -static void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) -{ - perf_counts__delete(evsel->prev_raw_counts); - evsel->prev_raw_counts = NULL; -} - static void perf_evlist__free_stats(struct perf_evlist *evlist) { struct perf_evsel *evsel; diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index b8c329f41f13f7a4f5f423942fe5a62e46ef8d60..6221c38983974950a1a41191c8f26c053c28932d 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -168,3 +168,21 @@ void perf_evsel__free_stat_priv(struct perf_evsel *evsel) { zfree(&evsel->priv); } + +int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, + int ncpus, int nthreads) +{ + struct perf_counts *counts; + + counts = perf_counts__new(ncpus, nthreads); + if (counts) + evsel->prev_raw_counts = counts; + + return counts ? 0 : -ENOMEM; +} + +void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) +{ + perf_counts__delete(evsel->prev_raw_counts); + evsel->prev_raw_counts = NULL; +} diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index c441cb312565f2c1e19597abc601ae6ca885a75d..454b26875aef6633da1ea9ca862cf157fa745801 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -96,4 +96,8 @@ void perf_evsel__free_counts(struct perf_evsel *evsel); void perf_evsel__reset_stat_priv(struct perf_evsel *evsel); int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel); void perf_evsel__free_stat_priv(struct perf_evsel *evsel); + +int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, + int ncpus, int nthreads); +void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel); #endif