7 struct perf_counts *perf_counts__new(int ncpus, int nthreads)
9 struct perf_counts *counts = zalloc(sizeof(*counts));
12 struct xyarray *values;
14 values = xyarray__new(ncpus, nthreads, sizeof(struct perf_counts_values));
20 counts->values = values;
26 void perf_counts__delete(struct perf_counts *counts)
29 xyarray__delete(counts->values);
34 static void perf_counts__reset(struct perf_counts *counts)
36 xyarray__reset(counts->values);
39 void perf_evsel__reset_counts(struct perf_evsel *evsel)
41 perf_counts__reset(evsel->counts);
44 int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int nthreads)
46 evsel->counts = perf_counts__new(ncpus, nthreads);
47 return evsel->counts != NULL ? 0 : -ENOMEM;
50 void perf_evsel__free_counts(struct perf_evsel *evsel)
52 perf_counts__delete(evsel->counts);