Moving perf_evsel__(alloc|free)_prev_raw_counts into evsel object,
so it could be used in following patches.

Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
 tools/perf/builtin-stat.c | 18 ------------------
 tools/perf/util/evsel.c   | 18 ++++++++++++++++++
 tools/perf/util/evsel.h   |  4 ++++
 3 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index d6f23c3436ae..b15fc47aa673 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__alloc(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__free(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/evsel.c b/tools/perf/util/evsel.c
index 7375dcc634da..d5680f210fc4 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -852,6 +852,24 @@ int perf_evsel__alloc_id(struct perf_evsel *evsel, int 
ncpus, int nthreads)
        return 0;
 }
 
+int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
+                                     int ncpus, int nthreads)
+{
+       struct perf_counts *counts;
+
+       counts = perf_counts__alloc(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__free(evsel->prev_raw_counts);
+       evsel->prev_raw_counts = NULL;
+}
+
 void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
 {
        int i;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 051175098f0b..d16ed197c00a 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -193,6 +193,10 @@ int perf_evsel__group_desc(struct perf_evsel *evsel, char 
*buf, size_t size);
 int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads);
 int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int 
nthreads);
 
+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);
+
 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);
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to