#ifndef PERFCOUNTERS_H #define PERFCOUNTERS_H #include #include "../../litmus-rt/include/linux/perf_event.h" #define NR_PERF_COUNTERS 4 /* * Retain this information with a performance counter file descriptor. */ struct perf_counter { int fd; enum perf_type_id type; uint64_t config; }; /* * Initialize a set of counters for a CPU. * * This is NOT thread safe! * * @cpu CPU * @group_leader group leader PID or -1 make a new group * @perf_counter array * @return 0 or error */ int setup_cpu_perf(const int, const int, struct perf_counter*); const char* get_perf_name(const struct perf_counter*); int read_perf_counter(const struct perf_counter*, uint64_t*); #endif