aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2014-07-14 17:46:49 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-07-17 11:58:59 -0400
commitc95688aac7723c17b2badc23233706b2f02e58ed (patch)
tree78d9bebc31fac45faf4e5255cbc93dbd632ecf8a /tools
parent84f5d36f486609277801e827241396334185d11c (diff)
perf tools: Factor eprintf to allow different debug variables
This way we can easily reuse current debug functions for another debug variables other than verbose. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1405374411-29012-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/debug.c12
-rw-r--r--tools/perf/util/debug.h12
-rw-r--r--tools/perf/util/python.c4
3 files changed, 14 insertions, 14 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 299b55586502..c208d6f56e63 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -16,11 +16,11 @@
16int verbose; 16int verbose;
17bool dump_trace = false, quiet = false; 17bool dump_trace = false, quiet = false;
18 18
19static int _eprintf(int level, const char *fmt, va_list args) 19static int _eprintf(int level, int var, const char *fmt, va_list args)
20{ 20{
21 int ret = 0; 21 int ret = 0;
22 22
23 if (verbose >= level) { 23 if (var >= level) {
24 if (use_browser >= 1) 24 if (use_browser >= 1)
25 ui_helpline__vshow(fmt, args); 25 ui_helpline__vshow(fmt, args);
26 else 26 else
@@ -30,13 +30,13 @@ static int _eprintf(int level, const char *fmt, va_list args)
30 return ret; 30 return ret;
31} 31}
32 32
33int eprintf(int level, const char *fmt, ...) 33int eprintf(int level, int var, const char *fmt, ...)
34{ 34{
35 va_list args; 35 va_list args;
36 int ret; 36 int ret;
37 37
38 va_start(args, fmt); 38 va_start(args, fmt);
39 ret = _eprintf(level, fmt, args); 39 ret = _eprintf(level, var, fmt, args);
40 va_end(args); 40 va_end(args);
41 41
42 return ret; 42 return ret;
@@ -51,9 +51,9 @@ void pr_stat(const char *fmt, ...)
51 va_list args; 51 va_list args;
52 52
53 va_start(args, fmt); 53 va_start(args, fmt);
54 _eprintf(1, fmt, args); 54 _eprintf(1, verbose, fmt, args);
55 va_end(args); 55 va_end(args);
56 eprintf(1, "\n"); 56 eprintf(1, verbose, "\n");
57} 57}
58 58
59int dump_printf(const char *fmt, ...) 59int dump_printf(const char *fmt, ...)
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index 8a8ceb3ccde9..1cb808123242 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -16,15 +16,15 @@ extern bool quiet, dump_trace;
16#endif 16#endif
17 17
18#define pr_err(fmt, ...) \ 18#define pr_err(fmt, ...) \
19 eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) 19 eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
20#define pr_warning(fmt, ...) \ 20#define pr_warning(fmt, ...) \
21 eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) 21 eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
22#define pr_info(fmt, ...) \ 22#define pr_info(fmt, ...) \
23 eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) 23 eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
24#define pr_debug(fmt, ...) \ 24#define pr_debug(fmt, ...) \
25 eprintf(1, pr_fmt(fmt), ##__VA_ARGS__) 25 eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__)
26#define pr_debugN(n, fmt, ...) \ 26#define pr_debugN(n, fmt, ...) \
27 eprintf(n, pr_fmt(fmt), ##__VA_ARGS__) 27 eprintf(n, verbose, pr_fmt(fmt), ##__VA_ARGS__)
28#define pr_debug2(fmt, ...) pr_debugN(2, 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__) 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__) 30#define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
@@ -37,6 +37,6 @@ int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
37 37
38void pr_stat(const char *fmt, ...); 38void pr_stat(const char *fmt, ...);
39 39
40int eprintf(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); 40int eprintf(int level, int var, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
41 41
42#endif /* __PERF_DEBUG_H */ 42#endif /* __PERF_DEBUG_H */
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 122669c18ff4..12aa9b0d0ba1 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -14,12 +14,12 @@
14 */ 14 */
15int verbose; 15int verbose;
16 16
17int eprintf(int level, const char *fmt, ...) 17int eprintf(int level, int var, const char *fmt, ...)
18{ 18{
19 va_list args; 19 va_list args;
20 int ret = 0; 20 int ret = 0;
21 21
22 if (verbose >= level) { 22 if (var >= level) {
23 va_start(args, fmt); 23 va_start(args, fmt);
24 ret = vfprintf(stderr, fmt, args); 24 ret = vfprintf(stderr, fmt, args);
25 va_end(args); 25 va_end(args);