blob: 6944ea3a119b5f784adf9b02b755f06ea3f5ae6a [file] [log] [blame]
Frederic Weisbeckercd84c2a2009-08-12 10:03:49 +02001/* For debugging general purposes */
John Kacur8b40f522009-09-24 18:02:18 +02002#ifndef __PERF_DEBUG_H
3#define __PERF_DEBUG_H
Frederic Weisbeckercd84c2a2009-08-12 10:03:49 +02004
Ian Munsiec0555642010-04-13 18:37:33 +10005#include <stdbool.h>
Arnaldo Carvalho de Melo8f411462009-11-16 16:32:42 -02006#include "event.h"
Namhyung Kim0985a942012-08-16 17:14:54 +09007#include "../ui/helpline.h"
Namhyung Kim75291422012-11-15 01:47:40 +09008#include "../ui/progress.h"
9#include "../ui/util.h"
Arnaldo Carvalho de Melo8f411462009-11-16 16:32:42 -020010
Frederic Weisbeckercd84c2a2009-08-12 10:03:49 +020011extern int verbose;
Arnaldo Carvalho de Melob44308f2010-10-26 15:20:09 -020012extern bool quiet, dump_trace;
Jiri Olsacee3ab92014-07-11 14:49:54 +020013extern int debug_ordered_events;
Frederic Weisbeckercd84c2a2009-08-12 10:03:49 +020014
Jiri Olsa84f5d362014-07-14 23:46:48 +020015#ifndef pr_fmt
16#define pr_fmt(fmt) fmt
17#endif
18
19#define pr_err(fmt, ...) \
Jiri Olsac95688a2014-07-14 23:46:49 +020020 eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
Jiri Olsa84f5d362014-07-14 23:46:48 +020021#define pr_warning(fmt, ...) \
Jiri Olsac95688a2014-07-14 23:46:49 +020022 eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
Jiri Olsa84f5d362014-07-14 23:46:48 +020023#define pr_info(fmt, ...) \
Jiri Olsac95688a2014-07-14 23:46:49 +020024 eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
Jiri Olsa84f5d362014-07-14 23:46:48 +020025#define pr_debug(fmt, ...) \
Jiri Olsac95688a2014-07-14 23:46:49 +020026 eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__)
Jiri Olsa84f5d362014-07-14 23:46:48 +020027#define pr_debugN(n, fmt, ...) \
Jiri Olsac95688a2014-07-14 23:46:49 +020028 eprintf(n, verbose, pr_fmt(fmt), ##__VA_ARGS__)
Jiri Olsa84f5d362014-07-14 23:46:48 +020029#define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
30#define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
31#define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
32
Jiri Olsacee3ab92014-07-11 14:49:54 +020033#define pr_time_N(n, var, t, fmt, ...) \
34 eprintf_time(n, var, t, fmt, ##__VA_ARGS__)
35
36#define pr_oe_time(t, fmt, ...) pr_time_N(1, debug_ordered_events, t, pr_fmt(fmt), ##__VA_ARGS__)
37#define pr_oe_time2(t, fmt, ...) pr_time_N(2, debug_ordered_events, t, pr_fmt(fmt), ##__VA_ARGS__)
38
Frederic Weisbecker2cec19d2009-08-16 19:24:21 +020039int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo8115d602011-01-29 14:01:45 -020040void trace_event(union perf_event *event);
Arnaldo Carvalho de Melo567e5472010-03-12 21:05:10 -030041
Namhyung Kimf9f526e2012-09-28 18:32:03 +090042int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020043int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo068ffaa2010-11-27 02:41:01 -020044
Jiri Olsaf772abc2013-12-03 14:09:25 +010045void pr_stat(const char *fmt, ...);
46
Jiri Olsac95688a2014-07-14 23:46:49 +020047int eprintf(int level, int var, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
Jiri Olsacee3ab92014-07-11 14:49:54 +020048int eprintf_time(int level, int var, u64 t, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
Jiri Olsa84f5d362014-07-14 23:46:48 +020049
Jiri Olsabbb2cea2014-07-17 12:55:00 +020050int perf_debug_option(const char *str);
51
John Kacur8b40f522009-09-24 18:02:18 +020052#endif /* __PERF_DEBUG_H */