debug.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* For debugging general purposes */
  2. #ifndef __PERF_DEBUG_H
  3. #define __PERF_DEBUG_H
  4. #include <stdbool.h>
  5. #include "event.h"
  6. #include "../ui/helpline.h"
  7. #include "../ui/progress.h"
  8. #include "../ui/util.h"
  9. extern int verbose;
  10. extern bool quiet, dump_trace;
  11. #ifndef pr_fmt
  12. #define pr_fmt(fmt) fmt
  13. #endif
  14. #define pr_err(fmt, ...) \
  15. eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
  16. #define pr_warning(fmt, ...) \
  17. eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
  18. #define pr_info(fmt, ...) \
  19. eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
  20. #define pr_debug(fmt, ...) \
  21. eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__)
  22. #define pr_debugN(n, fmt, ...) \
  23. eprintf(n, verbose, pr_fmt(fmt), ##__VA_ARGS__)
  24. #define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
  25. #define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
  26. #define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
  27. int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
  28. void trace_event(union perf_event *event);
  29. int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
  30. int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
  31. void pr_stat(const char *fmt, ...);
  32. int eprintf(int level, int var, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
  33. int perf_debug_option(const char *str);
  34. #endif /* __PERF_DEBUG_H */