Commit | Line | Data |
---|---|---|
cd84c2ac | 1 | /* For debugging general purposes */ |
8b40f521 JK |
2 | #ifndef __PERF_DEBUG_H |
3 | #define __PERF_DEBUG_H | |
cd84c2ac | 4 | |
c0555642 | 5 | #include <stdbool.h> |
b2348e1d | 6 | #include <string.h> |
8f41146a | 7 | #include "event.h" |
0985a948 | 8 | #include "../ui/helpline.h" |
75291420 NK |
9 | #include "../ui/progress.h" |
10 | #include "../ui/util.h" | |
8f41146a | 11 | |
cd84c2ac | 12 | extern int verbose; |
b44308f5 | 13 | extern bool quiet, dump_trace; |
cee3ab9c | 14 | extern int debug_ordered_events; |
edbe9817 | 15 | extern int debug_data_convert; |
cd84c2ac | 16 | |
84f5d36f JO |
17 | #ifndef pr_fmt |
18 | #define pr_fmt(fmt) fmt | |
19 | #endif | |
20 | ||
21 | #define pr_err(fmt, ...) \ | |
c95688aa | 22 | eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) |
84f5d36f | 23 | #define pr_warning(fmt, ...) \ |
c95688aa | 24 | eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) |
84f5d36f | 25 | #define pr_info(fmt, ...) \ |
c95688aa | 26 | eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) |
84f5d36f | 27 | #define pr_debug(fmt, ...) \ |
c95688aa | 28 | eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__) |
84f5d36f | 29 | #define pr_debugN(n, fmt, ...) \ |
c95688aa | 30 | eprintf(n, verbose, pr_fmt(fmt), ##__VA_ARGS__) |
84f5d36f JO |
31 | #define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__) |
32 | #define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__) | |
33 | #define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__) | |
34 | ||
cee3ab9c JO |
35 | #define pr_time_N(n, var, t, fmt, ...) \ |
36 | eprintf_time(n, var, t, fmt, ##__VA_ARGS__) | |
37 | ||
38 | #define pr_oe_time(t, fmt, ...) pr_time_N(1, debug_ordered_events, t, pr_fmt(fmt), ##__VA_ARGS__) | |
39 | #define pr_oe_time2(t, fmt, ...) pr_time_N(2, debug_ordered_events, t, pr_fmt(fmt), ##__VA_ARGS__) | |
40 | ||
b2348e1d MH |
41 | #define STRERR_BUFSIZE 128 /* For the buffer size of strerror_r */ |
42 | ||
2cec19d9 | 43 | int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); |
8115d60c | 44 | void trace_event(union perf_event *event); |
567e5479 | 45 | |
f9f526ec | 46 | int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); |
4610e413 | 47 | int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); |
068ffaa8 | 48 | |
f772abc6 JO |
49 | void pr_stat(const char *fmt, ...); |
50 | ||
c95688aa | 51 | int eprintf(int level, int var, const char *fmt, ...) __attribute__((format(printf, 3, 4))); |
cee3ab9c | 52 | int eprintf_time(int level, int var, u64 t, const char *fmt, ...) __attribute__((format(printf, 4, 5))); |
0af0885e | 53 | int veprintf(int level, int var, const char *fmt, va_list args); |
84f5d36f | 54 | |
bbb2cea7 | 55 | int perf_debug_option(const char *str); |
dd629cc0 | 56 | void perf_debug_setup(void); |
bbb2cea7 | 57 | |
8b40f521 | 58 | #endif /* __PERF_DEBUG_H */ |