diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-12-13 14:43:04 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-01-24 14:40:09 -0500 |
commit | 0c6332e9d8b8f38a9d5f0cdd66c5575e76ad8995 (patch) | |
tree | a8b182c8bebe04f9aeda78bf537a1829ba5778d9 /tools/perf/util | |
parent | 54359d3340241b4cf53e42ecd5c429d7ba6fbef3 (diff) |
perf python: Fix breakage introduced by the test_attr infrastructure
The test_attr infrastructure hooks on the sys_perf_event_open call,
checking if a variable is set and if so calling a function to intercept
calls and do the checking.
But both the variable and the function aren't on objects that are
linked on the python binding, breaking it:
# perf test -v 15
15: Try 'use perf' in python, checking link problems :
--- start ---
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/acme/git/build/perf//python/perf.so: undefined symbol: test_attr__enabled
---- end ----
Try 'use perf' in python, checking link problems: FAILED!
#
Fix it by moving the variable to one of the linked object files and
providing a stub for the function in the python.o object, that is only
linked in the python binding.
Now 'perf test' is happy again:
# perf test 15
15: Try 'use perf' in python, checking link problems : Ok
#
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
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/n/tip-0rsca2kn44b38rgdpr3tz6n5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/python.c | 9 | ||||
-rw-r--r-- | tools/perf/util/util.c | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index a2657fd96837..925e0c3e6d91 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -1045,3 +1045,12 @@ error: | |||
1045 | if (PyErr_Occurred()) | 1045 | if (PyErr_Occurred()) |
1046 | PyErr_SetString(PyExc_ImportError, "perf: Init failed!"); | 1046 | PyErr_SetString(PyExc_ImportError, "perf: Init failed!"); |
1047 | } | 1047 | } |
1048 | |||
1049 | /* | ||
1050 | * Dummy, to avoid dragging all the test_attr infrastructure in the python | ||
1051 | * binding. | ||
1052 | */ | ||
1053 | void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, | ||
1054 | int fd, int group_fd, unsigned long flags) | ||
1055 | { | ||
1056 | } | ||
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 5906e8426cc7..252b889ac8c2 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -12,6 +12,8 @@ | |||
12 | */ | 12 | */ |
13 | unsigned int page_size; | 13 | unsigned int page_size; |
14 | 14 | ||
15 | bool test_attr__enabled; | ||
16 | |||
15 | bool perf_host = true; | 17 | bool perf_host = true; |
16 | bool perf_guest = false; | 18 | bool perf_guest = false; |
17 | 19 | ||