diff options
Diffstat (limited to 'tools/perf/util/debug.c')
| -rw-r--r-- | tools/perf/util/debug.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 26817daa296..299b5558650 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -11,61 +11,63 @@ #include "event.h" #include "debug.h" #include "util.h" +#include "target.h" int verbose; bool dump_trace = false, quiet = false; -int eprintf(int level, const char *fmt, ...) +static int _eprintf(int level, const char *fmt, va_list args) { - va_list args; int ret = 0; if (verbose >= level) { - va_start(args, fmt); - if (use_browser > 0) - ret = ui_helpline__show_help(fmt, args); + if (use_browser >= 1) + ui_helpline__vshow(fmt, args); else ret = vfprintf(stderr, fmt, args); - va_end(args); } return ret; } -int dump_printf(const char *fmt, ...) +int eprintf(int level, const char *fmt, ...) { va_list args; - int ret = 0; + int ret; - if (dump_trace) { - va_start(args, fmt); - ret = vprintf(fmt, args); - va_end(args); - } + va_start(args, fmt); + ret = _eprintf(level, fmt, args); + va_end(args); return ret; } -#ifdef NO_NEWT_SUPPORT -int ui__warning(const char *format, ...) +/* + * Overloading libtraceevent standard info print + * function, display with -v in perf. + */ +void pr_stat(const char *fmt, ...) { va_list args; - va_start(args, format); - vfprintf(stderr, format, args); + va_start(args, fmt); + _eprintf(1, fmt, args); va_end(args); - return 0; + eprintf(1, "\n"); } -#endif -int ui__error_paranoid(void) +int dump_printf(const char *fmt, ...) { - return ui__error("Permission error - are you root?\n" - "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n" - " -1 - Not paranoid at all\n" - " 0 - Disallow raw tracepoint access for unpriv\n" - " 1 - Disallow cpu events for unpriv\n" - " 2 - Disallow kernel profiling for unpriv\n"); + va_list args; + int ret = 0; + + if (dump_trace) { + va_start(args, fmt); + ret = vprintf(fmt, args); + va_end(args); + } + + return ret; } void trace_event(union perf_event *event) |
