blob: 8a8ceb3ccde9924e6882e22466eb60580cac0c52 [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;
Frederic Weisbeckercd84c2a2009-08-12 10:03:49 +020013
Jiri Olsa84f5d362014-07-14 23:46:48 +020014#ifndef pr_fmt
15#define pr_fmt(fmt) fmt
16#endif
17
18#define pr_err(fmt, ...) \
19 eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)
20#define pr_warning(fmt, ...) \
21 eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)
22#define pr_info(fmt, ...) \
23 eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)
24#define pr_debug(fmt, ...) \
25 eprintf(1, pr_fmt(fmt), ##__VA_ARGS__)
26#define pr_debugN(n, fmt, ...) \
27 eprintf(n, pr_fmt(fmt), ##__VA_ARGS__)
28#define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
29#define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
30#define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
31
Frederic Weisbecker2cec19d2009-08-16 19:24:21 +020032int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo8115d602011-01-29 14:01:45 -020033void trace_event(union perf_event *event);
Arnaldo Carvalho de Melo567e5472010-03-12 21:05:10 -030034
Namhyung Kimf9f526e2012-09-28 18:32:03 +090035int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020036int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo068ffaa2010-11-27 02:41:01 -020037
Jiri Olsaf772abc2013-12-03 14:09:25 +010038void pr_stat(const char *fmt, ...);
39
Jiri Olsa84f5d362014-07-14 23:46:48 +020040int eprintf(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
41
John Kacur8b40f522009-09-24 18:02:18 +020042#endif /* __PERF_DEBUG_H */