perf stat: Move perf_evsel__(alloc|free|reset)_stat_priv into stat object
authorJiri Olsa <jolsa@kernel.org>
Fri, 26 Jun 2015 09:29:14 +0000 (11:29 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 26 Jun 2015 14:26:44 +0000 (11:26 -0300)
Moving perf_evsel__(alloc|free|reset)_stat_priv into stat object, so it
could be used outside stat command in following patches.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1435310967-14570-10-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c
tools/perf/util/stat.c
tools/perf/util/stat.h

index 188cd98a4ab3b7b2ab86a747d9d5477f23e62dbb..8a7fd0c60ab1a04c39aa7e78fbb39bd96288d3fa 100644 (file)
@@ -141,31 +141,6 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a,
        }
 }
 
-static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
-{
-       int i;
-       struct perf_stat *ps = evsel->priv;
-
-       for (i = 0; i < 3; i++)
-               init_stats(&ps->res_stats[i]);
-
-       perf_stat_evsel_id_init(evsel);
-}
-
-static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
-{
-       evsel->priv = zalloc(sizeof(struct perf_stat));
-       if (evsel->priv == NULL)
-               return -ENOMEM;
-       perf_evsel__reset_stat_priv(evsel);
-       return 0;
-}
-
-static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
-{
-       zfree(&evsel->priv);
-}
-
 static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
                                             int ncpus, int nthreads)
 {
index 197a2db5f2c4f18bc24852bad269b14f78beca47..b8c329f41f13f7a4f5f423942fe5a62e46ef8d60 100644 (file)
@@ -143,3 +143,28 @@ void perf_evsel__free_counts(struct perf_evsel *evsel)
        perf_counts__delete(evsel->counts);
        evsel->counts = NULL;
 }
+
+void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
+{
+       int i;
+       struct perf_stat *ps = evsel->priv;
+
+       for (i = 0; i < 3; i++)
+               init_stats(&ps->res_stats[i]);
+
+       perf_stat_evsel_id_init(evsel);
+}
+
+int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
+{
+       evsel->priv = zalloc(sizeof(struct perf_stat));
+       if (evsel->priv == NULL)
+               return -ENOMEM;
+       perf_evsel__reset_stat_priv(evsel);
+       return 0;
+}
+
+void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
+{
+       zfree(&evsel->priv);
+}
index 295d1e29d3d617276747de92b538813a0c0ab5b6..c441cb312565f2c1e19597abc601ae6ca885a75d 100644 (file)
@@ -92,4 +92,8 @@ void perf_counts__delete(struct perf_counts *counts);
 void perf_evsel__reset_counts(struct perf_evsel *evsel);
 int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int nthreads);
 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);
 #endif