blob: caac2fdc6105f7591a225f12e65b6e1ece48d342 [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>
Masami Hiramatsub2348e12014-08-14 02:22:32 +00006#include <string.h>
Arnaldo Carvalho de Melo8f411462009-11-16 16:32:42 -02007#include "event.h"
Namhyung Kim0985a942012-08-16 17:14:54 +09008#include "../ui/helpline.h"
Namhyung Kim75291422012-11-15 01:47:40 +09009#include "../ui/progress.h"
10#include "../ui/util.h"
Arnaldo Carvalho de Melo8f411462009-11-16 16:32:42 -020011
Frederic Weisbeckercd84c2a2009-08-12 10:03:49 +020012extern int verbose;
Arnaldo Carvalho de Melob44308f2010-10-26 15:20:09 -020013extern bool quiet, dump_trace;
Jiri Olsacee3ab92014-07-11 14:49:54 +020014extern int debug_ordered_events;
Jiri Olsaedbe9812015-02-20 23:17:00 +010015extern int debug_data_convert;
Frederic Weisbeckercd84c2a2009-08-12 10:03:49 +020016
Jiri Olsa84f5d362014-07-14 23:46:48 +020017#ifndef pr_fmt
18#define pr_fmt(fmt) fmt
19#endif
20
21#define pr_err(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_warning(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_info(fmt, ...) \
Jiri Olsac95688a2014-07-14 23:46:49 +020026 eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
Jiri Olsa84f5d362014-07-14 23:46:48 +020027#define pr_debug(fmt, ...) \
Jiri Olsac95688a2014-07-14 23:46:49 +020028 eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__)
Jiri Olsa84f5d362014-07-14 23:46:48 +020029#define pr_debugN(n, fmt, ...) \
Jiri Olsac95688a2014-07-14 23:46:49 +020030 eprintf(n, verbose, pr_fmt(fmt), ##__VA_ARGS__)
Jiri Olsa84f5d362014-07-14 23:46:48 +020031#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
Jiri Olsacee3ab92014-07-11 14:49:54 +020035#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
Masami Hiramatsub2348e12014-08-14 02:22:32 +000041#define STRERR_BUFSIZE 128 /* For the buffer size of strerror_r */
42
Frederic Weisbecker2cec19d2009-08-16 19:24:21 +020043int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo8115d602011-01-29 14:01:45 -020044void trace_event(union perf_event *event);
Arnaldo Carvalho de Melo567e5472010-03-12 21:05:10 -030045
Namhyung Kimf9f526e2012-09-28 18:32:03 +090046int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020047int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
Arnaldo Carvalho de Melo068ffaa2010-11-27 02:41:01 -020048
Jiri Olsaf772abc2013-12-03 14:09:25 +010049void pr_stat(const char *fmt, ...);
50
Jiri Olsac95688a2014-07-14 23:46:49 +020051int eprintf(int level, int var, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
Jiri Olsacee3ab92014-07-11 14:49:54 +020052int eprintf_time(int level, int var, u64 t, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
Jiri Olsa84f5d362014-07-14 23:46:48 +020053
Jiri Olsabbb2cea2014-07-17 12:55:00 +020054int perf_debug_option(const char *str);
55
John Kacur8b40f522009-09-24 18:02:18 +020056#endif /* __PERF_DEBUG_H */