xref: /linux/tools/tracing/rtla/src/timerlat_bpf.h (revision 5172a777248e56dbae22b55231d24c7ecc6393f9)
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 cpus);
27 int timerlat_bpf_get_summary_value(enum summary_field key,
28 				   long long *value_irq,
29 				   long long *value_thread,
30 				   long long *value_user,
31 				   int cpus);
32 
have_libbpf_support(void)33 static inline int have_libbpf_support(void) { return 1; }
34 #else
timerlat_bpf_init(struct timerlat_params * params)35 static inline int timerlat_bpf_init(struct timerlat_params *params)
36 {
37 	return -1;
38 }
timerlat_bpf_attach(void)39 static inline int timerlat_bpf_attach(void) { return -1; }
timerlat_bpf_detach(void)40 static inline void timerlat_bpf_detach(void) { };
timerlat_bpf_destroy(void)41 static inline void timerlat_bpf_destroy(void) { };
timerlat_bpf_wait(int timeout)42 static inline int timerlat_bpf_wait(int timeout) { return -1; }
timerlat_bpf_restart_tracing(void)43 static inline int timerlat_bpf_restart_tracing(void) { return -1; };
timerlat_bpf_get_hist_value(int key,long long * value_irq,long long * value_thread,long long * value_user,int cpus)44 static inline int timerlat_bpf_get_hist_value(int key,
45 					      long long *value_irq,
46 					      long long *value_thread,
47 					      long long *value_user,
48 					      int cpus)
49 {
50 	return -1;
51 }
timerlat_bpf_get_summary_value(enum summary_field key,long long * value_irq,long long * value_thread,long long * value_user,int cpus)52 static inline int timerlat_bpf_get_summary_value(enum summary_field key,
53 						 long long *value_irq,
54 						 long long *value_thread,
55 						 long long *value_user,
56 						 int cpus)
57 {
58 	return -1;
59 }
have_libbpf_support(void)60 static inline int have_libbpf_support(void) { return 0; }
61 #endif /* HAVE_BPF_SKEL */
62 #endif /* __bpf__ */
63