counts.h 843 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __PERF_COUNTS_H
  3. #define __PERF_COUNTS_H
  4. #include "xyarray.h"
  5. struct perf_counts_values {
  6. union {
  7. struct {
  8. u64 val;
  9. u64 ena;
  10. u64 run;
  11. };
  12. u64 values[3];
  13. };
  14. bool loaded;
  15. };
  16. struct perf_counts {
  17. s8 scaled;
  18. struct perf_counts_values aggr;
  19. struct xyarray *values;
  20. };
  21. static inline struct perf_counts_values*
  22. perf_counts(struct perf_counts *counts, int cpu, int thread)
  23. {
  24. return xyarray__entry(counts->values, cpu, thread);
  25. }
  26. struct perf_counts *perf_counts__new(int ncpus, int nthreads);
  27. void perf_counts__delete(struct perf_counts *counts);
  28. void perf_evsel__reset_counts(struct perf_evsel *evsel);
  29. int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int nthreads);
  30. void perf_evsel__free_counts(struct perf_evsel *evsel);
  31. #endif /* __PERF_COUNTS_H */