]>
Commit | Line | Data |
---|---|---|
a074865e WN |
1 | #ifndef PERF_UTIL_PERF_HOOKS_H |
2 | #define PERF_UTIL_PERF_HOOKS_H | |
3 | ||
4 | #ifdef __cplusplus | |
5 | extern "C" { | |
6 | #endif | |
7 | ||
8ad85e9e | 8 | typedef void (*perf_hook_func_t)(void *ctx); |
a074865e WN |
9 | struct perf_hook_desc { |
10 | const char * const hook_name; | |
11 | perf_hook_func_t * const p_hook_func; | |
8ad85e9e | 12 | void *hook_ctx; |
a074865e WN |
13 | }; |
14 | ||
15 | extern void perf_hooks__invoke(const struct perf_hook_desc *); | |
16 | extern void perf_hooks__recover(void); | |
17 | ||
18 | #define PERF_HOOK(name) \ | |
19 | extern struct perf_hook_desc __perf_hook_desc_##name; \ | |
20 | static inline void perf_hooks__invoke_##name(void) \ | |
21 | { \ | |
22 | perf_hooks__invoke(&__perf_hook_desc_##name); \ | |
23 | } | |
24 | ||
25 | #include "perf-hooks-list.h" | |
26 | #undef PERF_HOOK | |
27 | ||
28 | extern int | |
29 | perf_hooks__set_hook(const char *hook_name, | |
8ad85e9e WN |
30 | perf_hook_func_t hook_func, |
31 | void *hook_ctx); | |
a074865e WN |
32 | |
33 | extern perf_hook_func_t | |
34 | perf_hooks__get_hook(const char *hook_name); | |
35 | ||
36 | #ifdef __cplusplus | |
37 | } | |
38 | #endif | |
39 | #endif |