| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef UTIL_TRACE_H |
| 3 | #define UTIL_TRACE_H |
| 4 | |
| 5 | #include <stdio.h> /* for FILE */ |
| 6 | |
| 7 | enum trace_summary_mode { |
| 8 | SUMMARY__NONE = 0, |
| 9 | SUMMARY__BY_TOTAL, |
| 10 | SUMMARY__BY_THREAD, |
| 11 | SUMMARY__BY_CGROUP, |
| 12 | }; |
| 13 | |
| 14 | #ifdef HAVE_BPF_SKEL |
| 15 | |
| 16 | int trace_prepare_bpf_summary(enum trace_summary_mode mode); |
| 17 | void trace_start_bpf_summary(void); |
| 18 | void trace_end_bpf_summary(void); |
| 19 | int trace_print_bpf_summary(FILE *fp, int max_summary); |
| 20 | void trace_cleanup_bpf_summary(void); |
| 21 | |
| 22 | #else /* !HAVE_BPF_SKEL */ |
| 23 | |
| 24 | static inline int trace_prepare_bpf_summary(enum trace_summary_mode mode __maybe_unused) |
| 25 | { |
| 26 | return -1; |
| 27 | } |
| 28 | static inline void trace_start_bpf_summary(void) {} |
| 29 | static inline void trace_end_bpf_summary(void) {} |
| 30 | static inline int trace_print_bpf_summary(FILE *fp __maybe_unused, int max_summary __maybe_unused) |
| 31 | { |
| 32 | return 0; |
| 33 | } |
| 34 | static inline void trace_cleanup_bpf_summary(void) {} |
| 35 | |
| 36 | #endif /* HAVE_BPF_SKEL */ |
| 37 | |
| 38 | #endif /* UTIL_TRACE_H */ |
| 39 | |