1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #pragma once 3 4 enum summary_field { 5 SUMMARY_CURRENT, 6 SUMMARY_MIN, 7 SUMMARY_MAX, 8 SUMMARY_COUNT, 9 SUMMARY_SUM, 10 SUMMARY_OVERFLOW, 11 SUMMARY_FIELD_N 12 }; 13 14 #ifndef __bpf__ 15 #ifdef HAVE_BPF_SKEL 16 int timerlat_bpf_init(struct timerlat_params *params); 17 int timerlat_bpf_attach(void); 18 void timerlat_bpf_detach(void); 19 void timerlat_bpf_destroy(void); 20 int timerlat_bpf_wait(int timeout); 21 int timerlat_bpf_restart_tracing(void); 22 int timerlat_bpf_get_hist_value(int key, 23 long long *value_irq, 24 long long *value_thread, 25 long long *value_user); 26 int timerlat_bpf_get_summary_value(enum summary_field key, 27 long long *value_irq, 28 long long *value_thread, 29 long long *value_user); 30 int timerlat_load_bpf_action_program(const char *program_path); 31 static inline int have_libbpf_support(void) { return 1; } 32 #else 33 static inline int timerlat_bpf_init(struct timerlat_params *params) 34 { 35 return -1; 36 } 37 static inline int timerlat_bpf_attach(void) { return -1; } 38 static inline void timerlat_bpf_detach(void) { }; 39 static inline void timerlat_bpf_destroy(void) { }; 40 static inline int timerlat_bpf_wait(int timeout) { return -1; } 41 static inline int timerlat_bpf_restart_tracing(void) { return -1; }; 42 static inline int timerlat_bpf_get_hist_value(int key, 43 long long *value_irq, 44 long long *value_thread, 45 long long *value_user) 46 { 47 return -1; 48 } 49 static inline int timerlat_bpf_get_summary_value(enum summary_field key, 50 long long *value_irq, 51 long long *value_thread, 52 long long *value_user) 53 { 54 return -1; 55 } 56 static inline int timerlat_load_bpf_action_program(const char *program_path) 57 { 58 return -1; 59 } 60 static inline int have_libbpf_support(void) { return 0; } 61 #endif /* HAVE_BPF_SKEL */ 62 #endif /* __bpf__ */ 63