diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2013-08-14 08:48:23 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-16 16:17:58 -0400 |
commit | 8afb4c018e21c882c8fad196772ef74d494185e2 (patch) | |
tree | 773d8d460fa1d51d9e86d6f419196827ad1d0c38 /tools | |
parent | bec196720431db2fd6a9b03cbd77eb336e6f52de (diff) |
perf tools: Re-implement debug print function for linking python/perf.so
The python/perf.so python binding links a subset of objects.
Re-implement 'verbose' and 'eprintf' so they (and consequently
'pr_debug') can be used in objects linked into pythin/perf.so.
Note 'eprintf' must be re-implemented because the full version links the
browser ui.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1376484517-5339-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/python.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 925e0c3e6d91..381f4fda9654 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -8,6 +8,26 @@ | |||
8 | #include "cpumap.h" | 8 | #include "cpumap.h" |
9 | #include "thread_map.h" | 9 | #include "thread_map.h" |
10 | 10 | ||
11 | /* | ||
12 | * Support debug printing even though util/debug.c is not linked. That means | ||
13 | * implementing 'verbose' and 'eprintf'. | ||
14 | */ | ||
15 | int verbose; | ||
16 | |||
17 | int eprintf(int level, const char *fmt, ...) | ||
18 | { | ||
19 | va_list args; | ||
20 | int ret = 0; | ||
21 | |||
22 | if (verbose >= level) { | ||
23 | va_start(args, fmt); | ||
24 | ret = vfprintf(stderr, fmt, args); | ||
25 | va_end(args); | ||
26 | } | ||
27 | |||
28 | return ret; | ||
29 | } | ||
30 | |||
11 | /* Define PyVarObject_HEAD_INIT for python 2.5 */ | 31 | /* Define PyVarObject_HEAD_INIT for python 2.5 */ |
12 | #ifndef PyVarObject_HEAD_INIT | 32 | #ifndef PyVarObject_HEAD_INIT |
13 | # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, | 33 | # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, |