1 // SPDX-License-Identifier: GPL-2.0
8 struct perf_counts
*perf_counts__new(int ncpus
, int nthreads
)
10 struct perf_counts
*counts
= zalloc(sizeof(*counts
));
13 struct xyarray
*values
;
15 values
= xyarray__new(ncpus
, nthreads
, sizeof(struct perf_counts_values
));
21 counts
->values
= values
;
27 void perf_counts__delete(struct perf_counts
*counts
)
30 xyarray__delete(counts
->values
);
35 static void perf_counts__reset(struct perf_counts
*counts
)
37 xyarray__reset(counts
->values
);
40 void perf_evsel__reset_counts(struct perf_evsel
*evsel
)
42 perf_counts__reset(evsel
->counts
);
45 int perf_evsel__alloc_counts(struct perf_evsel
*evsel
, int ncpus
, int nthreads
)
47 evsel
->counts
= perf_counts__new(ncpus
, nthreads
);
48 return evsel
->counts
!= NULL
? 0 : -ENOMEM
;
51 void perf_evsel__free_counts(struct perf_evsel
*evsel
)
53 perf_counts__delete(evsel
->counts
);