[tip:perf/urgent] perf stat: Move perf_evsel__(alloc|free|reset) _stat_priv into stat object

From: tip-bot for Jiri Olsa
Date: Tue Jun 30 2015 - 00:55:22 EST


Commit-ID: 9689edfabc1547155a7cdd1304fd294107054291
Gitweb: http://git.kernel.org/tip/9689edfabc1547155a7cdd1304fd294107054291
Author: Jiri Olsa <jolsa@xxxxxxxxxx>
AuthorDate: Fri, 26 Jun 2015 11:29:14 +0200
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Fri, 26 Jun 2015 11:26:44 -0300

perf stat: Move perf_evsel__(alloc|free|reset)_stat_priv into stat object

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@xxxxxxxxxx>
Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/1435310967-14570-10-git-send-email-jolsa@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/builtin-stat.c | 25 -------------------------
tools/perf/util/stat.c | 25 +++++++++++++++++++++++++
tools/perf/util/stat.h | 4 ++++
3 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 188cd98a..8a7fd0c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -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)
{
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 197a2db..b8c329f 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -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);
+}
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index 295d1e2..c441cb3 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/