aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-06-26 05:29:15 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-06-26 10:34:43 -0400
commita939512d10a5583a32ae85c1bff6c4ae63a8a517 (patch)
tree744fd2af041df742ff3c320dfa1ef2ae69e18255
parent9689edfabc1547155a7cdd1304fd294107054291 (diff)
perf stat: Move perf_evsel__(alloc|free)_prev_raw_counts into stat object
Moving perf_evsel__(alloc|free)_prev_raw_counts into stat object, so it could be used 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-11-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-stat.c18
-rw-r--r--tools/perf/util/stat.c18
-rw-r--r--tools/perf/util/stat.h4
3 files changed, 22 insertions, 18 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8a7fd0c60ab1..0ccba5c6b61d 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,
141 } 141 }
142} 142}
143 143
144static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
145 int ncpus, int nthreads)
146{
147 struct perf_counts *counts;
148
149 counts = perf_counts__new(ncpus, nthreads);
150 if (counts)
151 evsel->prev_raw_counts = counts;
152
153 return counts ? 0 : -ENOMEM;
154}
155
156static void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel)
157{
158 perf_counts__delete(evsel->prev_raw_counts);
159 evsel->prev_raw_counts = NULL;
160}
161
162static void perf_evlist__free_stats(struct perf_evlist *evlist) 144static void perf_evlist__free_stats(struct perf_evlist *evlist)
163{ 145{
164 struct perf_evsel *evsel; 146 struct perf_evsel *evsel;
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index b8c329f41f13..6221c3898397 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)
168{ 168{
169 zfree(&evsel->priv); 169 zfree(&evsel->priv);
170} 170}
171
172int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
173 int ncpus, int nthreads)
174{
175 struct perf_counts *counts;
176
177 counts = perf_counts__new(ncpus, nthreads);
178 if (counts)
179 evsel->prev_raw_counts = counts;
180
181 return counts ? 0 : -ENOMEM;
182}
183
184void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel)
185{
186 perf_counts__delete(evsel->prev_raw_counts);
187 evsel->prev_raw_counts = NULL;
188}
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index c441cb312565..454b26875aef 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);
96void perf_evsel__reset_stat_priv(struct perf_evsel *evsel); 96void perf_evsel__reset_stat_priv(struct perf_evsel *evsel);
97int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel); 97int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel);
98void perf_evsel__free_stat_priv(struct perf_evsel *evsel); 98void perf_evsel__free_stat_priv(struct perf_evsel *evsel);
99
100int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
101 int ncpus, int nthreads);
102void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel);
99#endif 103#endif