Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef PERF_UTIL_PERF_HOOKS_H
0003 #define PERF_UTIL_PERF_HOOKS_H
0004 
0005 #ifdef __cplusplus
0006 extern "C" {
0007 #endif
0008 
0009 typedef void (*perf_hook_func_t)(void *ctx);
0010 struct perf_hook_desc {
0011     const char * const hook_name;
0012     perf_hook_func_t * const p_hook_func;
0013     void *hook_ctx;
0014 };
0015 
0016 extern void perf_hooks__invoke(const struct perf_hook_desc *);
0017 extern void perf_hooks__recover(void);
0018 
0019 #define PERF_HOOK(name)                 \
0020 extern struct perf_hook_desc __perf_hook_desc_##name;   \
0021 static inline void perf_hooks__invoke_##name(void)  \
0022 {                           \
0023     perf_hooks__invoke(&__perf_hook_desc_##name);   \
0024 }
0025 
0026 #include "perf-hooks-list.h"
0027 #undef PERF_HOOK
0028 
0029 extern int
0030 perf_hooks__set_hook(const char *hook_name,
0031              perf_hook_func_t hook_func,
0032              void *hook_ctx);
0033 
0034 extern perf_hook_func_t
0035 perf_hooks__get_hook(const char *hook_name);
0036 
0037 #ifdef __cplusplus
0038 }
0039 #endif
0040 #endif