]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
perf tools: Overload pr_stat traceevent print function
authorJiri Olsa <jolsa@redhat.com>
Tue, 3 Dec 2013 13:09:25 +0000 (14:09 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 4 Dec 2013 18:23:55 +0000 (15:23 -0300)
The traceevent lib uses pr_stat to display all standard info. It's
defined as __weak. Overloading it with perf version plugged into perf
output system logic.

Displaying the pr_stat stuff under '-v' option.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386076182-14484-12-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/debug.c
tools/perf/util/debug.h

index 399e74c34c1aa5220ecc29bd0d33cca2d2a3ac82..8640a9121e726b794d35174d1cafd5d0bb7cb3d1 100644 (file)
 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 >= 1)
                        ui_helpline__vshow(fmt, args);
                else
@@ -33,6 +31,32 @@ int eprintf(int level, const char *fmt, ...)
        return ret;
 }
 
+int eprintf(int level, const char *fmt, ...)
+{
+       va_list args;
+       int ret;
+
+       va_start(args, fmt);
+       ret = _eprintf(level, fmt, args);
+       va_end(args);
+
+       return ret;
+}
+
+/*
+ * Overloading libtraceevent standard info print
+ * function, display with -v in perf.
+ */
+void pr_stat(const char *fmt, ...)
+{
+       va_list args;
+
+       va_start(args, fmt);
+       _eprintf(1, fmt, args);
+       va_end(args);
+       eprintf(1, "\n");
+}
+
 int dump_printf(const char *fmt, ...)
 {
        va_list args;
index efbd98805ad0b0086996298b698122a2b0ceb018..443694c36b03c50e639ac087664764200a71646c 100644 (file)
@@ -17,4 +17,6 @@ void trace_event(union perf_event *event);
 int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
 int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
 
+void pr_stat(const char *fmt, ...);
+
 #endif /* __PERF_DEBUG_H */