diff options
Diffstat (limited to 'include/perfcounters.h')
-rw-r--r-- | include/perfcounters.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/perfcounters.h b/include/perfcounters.h new file mode 100644 index 0000000..03f94fb --- /dev/null +++ b/include/perfcounters.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef PERFCOUNTERS_H | ||
2 | #define PERFCOUNTERS_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | |||
6 | #include "../../litmus-rt/include/linux/perf_event.h" | ||
7 | |||
8 | #define NR_PERF_COUNTERS 4 | ||
9 | |||
10 | /* | ||
11 | * Retain this information with a performance counter file descriptor. | ||
12 | */ | ||
13 | struct perf_counter { | ||
14 | int fd; | ||
15 | enum perf_type_id type; | ||
16 | uint64_t config; | ||
17 | }; | ||
18 | |||
19 | |||
20 | /* | ||
21 | * Initialize a set of counters for a CPU. | ||
22 | * | ||
23 | * This is NOT thread safe! | ||
24 | * | ||
25 | * @cpu CPU | ||
26 | * @group_leader group leader PID or -1 make a new group | ||
27 | * @perf_counter array | ||
28 | * @return 0 or error | ||
29 | */ | ||
30 | int setup_cpu_perf(const int, const int, struct perf_counter*); | ||
31 | |||
32 | const char* get_perf_name(const struct perf_counter*); | ||
33 | |||
34 | int read_perf_counter(const struct perf_counter*, uint64_t*); | ||
35 | |||
36 | #endif | ||