diff options
25 files changed, 43 insertions, 21 deletions
diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c index 9f89f899ccc7..d8bbf7ad1681 100644 --- a/tools/perf/arch/x86/tests/dwarf-unwind.c +++ b/tools/perf/arch/x86/tests/dwarf-unwind.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "thread.h" | 3 | #include "thread.h" |
4 | #include "map.h" | 4 | #include "map.h" |
5 | #include "event.h" | 5 | #include "event.h" |
6 | #include "debug.h" | ||
6 | #include "tests/tests.h" | 7 | #include "tests/tests.h" |
7 | 8 | ||
8 | #define STACK_SIZE 8192 | 9 | #define STACK_SIZE 8192 |
diff --git a/tools/perf/arch/x86/util/unwind-libunwind.c b/tools/perf/arch/x86/util/unwind-libunwind.c index 3261f68c6a7c..db25e93d989c 100644 --- a/tools/perf/arch/x86/util/unwind-libunwind.c +++ b/tools/perf/arch/x86/util/unwind-libunwind.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <libunwind.h> | 3 | #include <libunwind.h> |
4 | #include "perf_regs.h" | 4 | #include "perf_regs.h" |
5 | #include "../../util/unwind.h" | 5 | #include "../../util/unwind.h" |
6 | #include "../../util/debug.h" | ||
6 | 7 | ||
7 | #ifdef HAVE_ARCH_X86_64_SUPPORT | 8 | #ifdef HAVE_ARCH_X86_64_SUPPORT |
8 | int libunwind__arch_reg_id(int regnum) | 9 | int libunwind__arch_reg_id(int regnum) |
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c index c99e0de7e54a..66e12f55c052 100644 --- a/tools/perf/builtin-evlist.c +++ b/tools/perf/builtin-evlist.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "util/parse-options.h" | 15 | #include "util/parse-options.h" |
16 | #include "util/session.h" | 16 | #include "util/session.h" |
17 | #include "util/data.h" | 17 | #include "util/data.h" |
18 | #include "util/debug.h" | ||
18 | 19 | ||
19 | static int __cmd_evlist(const char *file_name, struct perf_attr_details *details) | 20 | static int __cmd_evlist(const char *file_name, struct perf_attr_details *details) |
20 | { | 21 | { |
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 178b88ae3d2f..0384d930480b 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "util/parse-options.h" | 11 | #include "util/parse-options.h" |
12 | #include "util/run-command.h" | 12 | #include "util/run-command.h" |
13 | #include "util/help.h" | 13 | #include "util/help.h" |
14 | #include "util/debug.h" | ||
14 | 15 | ||
15 | static struct man_viewer_list { | 16 | static struct man_viewer_list { |
16 | struct man_viewer_list *next; | 17 | struct man_viewer_list *next; |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 04c9c53becad..2f1a5220c090 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "util/svghelper.h" | 37 | #include "util/svghelper.h" |
38 | #include "util/tool.h" | 38 | #include "util/tool.h" |
39 | #include "util/data.h" | 39 | #include "util/data.h" |
40 | #include "util/debug.h" | ||
40 | 41 | ||
41 | #define SUPPORT_OLD_POWER_EVENTS 1 | 42 | #define SUPPORT_OLD_POWER_EVENTS 1 |
42 | #define PWR_EVENT_EXIT -1 | 43 | #define PWR_EVENT_EXIT -1 |
diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index 630808cd7cc2..caaf37f079b1 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "machine.h" | 10 | #include "machine.h" |
11 | #include "symbol.h" | 11 | #include "symbol.h" |
12 | #include "tests.h" | 12 | #include "tests.h" |
13 | #include "debug.h" | ||
13 | 14 | ||
14 | static char *test_file(int size) | 15 | static char *test_file(int size) |
15 | { | 16 | { |
diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evsel-roundtrip-name.c index 465cdbc345cf..b8d8341b383e 100644 --- a/tools/perf/tests/evsel-roundtrip-name.c +++ b/tools/perf/tests/evsel-roundtrip-name.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include "evsel.h" | 2 | #include "evsel.h" |
3 | #include "parse-events.h" | 3 | #include "parse-events.h" |
4 | #include "tests.h" | 4 | #include "tests.h" |
5 | #include "debug.h" | ||
5 | 6 | ||
6 | static int perf_evsel__roundtrip_cache_name_test(void) | 7 | static int perf_evsel__roundtrip_cache_name_test(void) |
7 | { | 8 | { |
diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c index 35d7fdb2328d..52162425c969 100644 --- a/tools/perf/tests/evsel-tp-sched.c +++ b/tools/perf/tests/evsel-tp-sched.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <traceevent/event-parse.h> | 1 | #include <traceevent/event-parse.h> |
2 | #include "evsel.h" | 2 | #include "evsel.h" |
3 | #include "tests.h" | 3 | #include "tests.h" |
4 | #include "debug.h" | ||
4 | 5 | ||
5 | static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, | 6 | static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, |
6 | int size, bool should_be_signed) | 7 | int size, bool should_be_signed) |
diff --git a/tools/perf/tests/open-syscall-tp-fields.c b/tools/perf/tests/open-syscall-tp-fields.c index c505ef2af245..0785b64ffd6c 100644 --- a/tools/perf/tests/open-syscall-tp-fields.c +++ b/tools/perf/tests/open-syscall-tp-fields.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "evsel.h" | 3 | #include "evsel.h" |
4 | #include "thread_map.h" | 4 | #include "thread_map.h" |
5 | #include "tests.h" | 5 | #include "tests.h" |
6 | #include "debug.h" | ||
6 | 7 | ||
7 | int test__syscall_open_tp_fields(void) | 8 | int test__syscall_open_tp_fields(void) |
8 | { | 9 | { |
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index deba66955f8c..5941927a4b7f 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <api/fs/fs.h> | 5 | #include <api/fs/fs.h> |
6 | #include <api/fs/debugfs.h> | 6 | #include <api/fs/debugfs.h> |
7 | #include "tests.h" | 7 | #include "tests.h" |
8 | #include "debug.h" | ||
8 | #include <linux/hw_breakpoint.h> | 9 | #include <linux/hw_breakpoint.h> |
9 | 10 | ||
10 | #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \ | 11 | #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \ |
diff --git a/tools/perf/tests/parse-no-sample-id-all.c b/tools/perf/tests/parse-no-sample-id-all.c index 905019f9b740..2c63ea658541 100644 --- a/tools/perf/tests/parse-no-sample-id-all.c +++ b/tools/perf/tests/parse-no-sample-id-all.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "evlist.h" | 7 | #include "evlist.h" |
8 | #include "header.h" | 8 | #include "header.h" |
9 | #include "util.h" | 9 | #include "util.h" |
10 | #include "debug.h" | ||
10 | 11 | ||
11 | static int process_event(struct perf_evlist **pevlist, union perf_event *event) | 12 | static int process_event(struct perf_evlist **pevlist, union perf_event *event) |
12 | { | 13 | { |
diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c index 7ae8d17db3d9..ca292f9a4ae2 100644 --- a/tools/perf/tests/sample-parsing.c +++ b/tools/perf/tests/sample-parsing.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "util.h" | 4 | #include "util.h" |
5 | #include "event.h" | 5 | #include "event.h" |
6 | #include "evsel.h" | 6 | #include "evsel.h" |
7 | #include "debug.h" | ||
7 | 8 | ||
8 | #include "tests.h" | 9 | #include "tests.h" |
9 | 10 | ||
diff --git a/tools/perf/tests/thread-mg-share.c b/tools/perf/tests/thread-mg-share.c index 2b2e0dbe114f..b028499dd3cf 100644 --- a/tools/perf/tests/thread-mg-share.c +++ b/tools/perf/tests/thread-mg-share.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include "machine.h" | 2 | #include "machine.h" |
3 | #include "thread.h" | 3 | #include "thread.h" |
4 | #include "map.h" | 4 | #include "map.h" |
5 | #include "debug.h" | ||
5 | 6 | ||
6 | int test__thread_mg_share(void) | 7 | int test__thread_mg_share(void) |
7 | { | 8 | { |
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index ee370a7f2444..29d720cf5844 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include "data.h" | 8 | #include "data.h" |
9 | #include "util.h" | 9 | #include "util.h" |
10 | #include "debug.h" | ||
10 | 11 | ||
11 | static bool check_pipe(struct perf_data_file *file) | 12 | static bool check_pipe(struct perf_data_file *file) |
12 | { | 13 | { |
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index 443694c36b03..8a8ceb3ccde9 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h | |||
@@ -11,6 +11,24 @@ | |||
11 | extern int verbose; | 11 | extern int verbose; |
12 | extern bool quiet, dump_trace; | 12 | extern bool quiet, dump_trace; |
13 | 13 | ||
14 | #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 | |||
14 | int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); | 32 | int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); |
15 | void trace_event(union perf_event *event); | 33 | void trace_event(union perf_event *event); |
16 | 34 | ||
@@ -19,4 +37,6 @@ int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); | |||
19 | 37 | ||
20 | void pr_stat(const char *fmt, ...); | 38 | void pr_stat(const char *fmt, ...); |
21 | 39 | ||
40 | int eprintf(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); | ||
41 | |||
22 | #endif /* __PERF_DEBUG_H */ | 42 | #endif /* __PERF_DEBUG_H */ |
diff --git a/tools/perf/util/include/linux/kernel.h b/tools/perf/util/include/linux/kernel.h index 9844c31b7c2b..09e8e7aea7c6 100644 --- a/tools/perf/util/include/linux/kernel.h +++ b/tools/perf/util/include/linux/kernel.h | |||
@@ -94,27 +94,6 @@ static inline int scnprintf(char * buf, size_t size, const char * fmt, ...) | |||
94 | return (i >= ssize) ? (ssize - 1) : i; | 94 | return (i >= ssize) ? (ssize - 1) : i; |
95 | } | 95 | } |
96 | 96 | ||
97 | int eprintf(int level, | ||
98 | const char *fmt, ...) __attribute__((format(printf, 2, 3))); | ||
99 | |||
100 | #ifndef pr_fmt | ||
101 | #define pr_fmt(fmt) fmt | ||
102 | #endif | ||
103 | |||
104 | #define pr_err(fmt, ...) \ | ||
105 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) | ||
106 | #define pr_warning(fmt, ...) \ | ||
107 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) | ||
108 | #define pr_info(fmt, ...) \ | ||
109 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) | ||
110 | #define pr_debug(fmt, ...) \ | ||
111 | eprintf(1, pr_fmt(fmt), ##__VA_ARGS__) | ||
112 | #define pr_debugN(n, fmt, ...) \ | ||
113 | eprintf(n, pr_fmt(fmt), ##__VA_ARGS__) | ||
114 | #define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__) | ||
115 | #define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__) | ||
116 | #define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__) | ||
117 | |||
118 | /* | 97 | /* |
119 | * This looks more complex than it should be. But we need to | 98 | * This looks more complex than it should be. But we need to |
120 | * get the type for the ~ right in round_down (it needs to be | 99 | * get the type for the ~ right in round_down (it needs to be |
diff --git a/tools/perf/util/pstack.c b/tools/perf/util/pstack.c index daa17aeb6c63..a126e6cc6e73 100644 --- a/tools/perf/util/pstack.c +++ b/tools/perf/util/pstack.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include "util.h" | 7 | #include "util.h" |
8 | #include "pstack.h" | 8 | #include "pstack.h" |
9 | #include "debug.h" | ||
9 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
10 | #include <stdlib.h> | 11 | #include <stdlib.h> |
11 | 12 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index af7da565a750..b2dba9c0a3a1 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "../event.h" | 34 | #include "../event.h" |
35 | #include "../trace-event.h" | 35 | #include "../trace-event.h" |
36 | #include "../evsel.h" | 36 | #include "../evsel.h" |
37 | #include "../debug.h" | ||
37 | 38 | ||
38 | void boot_Perf__Trace__Context(pTHX_ CV *cv); | 39 | void boot_Perf__Trace__Context(pTHX_ CV *cv); |
39 | void boot_DynaLoader(pTHX_ CV *cv); | 40 | void boot_DynaLoader(pTHX_ CV *cv); |
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index b366b48646ca..cbce2545da45 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | #include "../../perf.h" | 29 | #include "../../perf.h" |
30 | #include "../debug.h" | ||
30 | #include "../evsel.h" | 31 | #include "../evsel.h" |
31 | #include "../util.h" | 32 | #include "../util.h" |
32 | #include "../event.h" | 33 | #include "../event.h" |
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index c3bba883f5c3..eb72716017ac 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "trace-event.h" | 40 | #include "trace-event.h" |
41 | #include <api/fs/debugfs.h> | 41 | #include <api/fs/debugfs.h> |
42 | #include "evsel.h" | 42 | #include "evsel.h" |
43 | #include "debug.h" | ||
43 | 44 | ||
44 | #define VERSION "0.5" | 45 | #define VERSION "0.5" |
45 | 46 | ||
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c index e113e180c48f..ea3fd7fc6f5c 100644 --- a/tools/perf/util/trace-event-read.c +++ b/tools/perf/util/trace-event-read.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "../perf.h" | 36 | #include "../perf.h" |
37 | #include "util.h" | 37 | #include "util.h" |
38 | #include "trace-event.h" | 38 | #include "trace-event.h" |
39 | #include "debug.h" | ||
39 | 40 | ||
40 | static int input_fd; | 41 | static int input_fd; |
41 | 42 | ||
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index 5ec80a575b50..7419768c38b1 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <elfutils/libdwfl.h> | 3 | #include <elfutils/libdwfl.h> |
4 | #include <inttypes.h> | 4 | #include <inttypes.h> |
5 | #include <errno.h> | 5 | #include <errno.h> |
6 | #include "debug.h" | ||
6 | #include "unwind.h" | 7 | #include "unwind.h" |
7 | #include "unwind-libdw.h" | 8 | #include "unwind-libdw.h" |
8 | #include "machine.h" | 9 | #include "machine.h" |
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index 25578b98f5c5..92b56db52471 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "unwind.h" | 30 | #include "unwind.h" |
31 | #include "symbol.h" | 31 | #include "symbol.h" |
32 | #include "util.h" | 32 | #include "util.h" |
33 | #include "debug.h" | ||
33 | 34 | ||
34 | extern int | 35 | extern int |
35 | UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as, | 36 | UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as, |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index e4132aeeb780..e52e7461911b 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "../perf.h" | 1 | #include "../perf.h" |
2 | #include "util.h" | 2 | #include "util.h" |
3 | #include "debug.h" | ||
3 | #include <api/fs/fs.h> | 4 | #include <api/fs/fs.h> |
4 | #include <sys/mman.h> | 5 | #include <sys/mman.h> |
5 | #ifdef HAVE_BACKTRACE_SUPPORT | 6 | #ifdef HAVE_BACKTRACE_SUPPORT |
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c index 0ddb3b8a89ec..290582452da3 100644 --- a/tools/perf/util/vdso.c +++ b/tools/perf/util/vdso.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "util.h" | 12 | #include "util.h" |
13 | #include "symbol.h" | 13 | #include "symbol.h" |
14 | #include "linux/string.h" | 14 | #include "linux/string.h" |
15 | #include "debug.h" | ||
15 | 16 | ||
16 | static bool vdso_found; | 17 | static bool vdso_found; |
17 | static char vdso_file[] = "/tmp/perf-vdso.so-XXXXXX"; | 18 | static char vdso_file[] = "/tmp/perf-vdso.so-XXXXXX"; |