summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/scripting-engines/trace-event-python.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-07-19 08:44:38 +0200
committerIngo Molnar <mingo@kernel.org>2016-07-19 08:44:38 +0200
commit5048c2af078d5976895d521262a8802ea791f3b0 (patch)
treeff17370ff5f36680ca7f71df0b9444747699348c /tools/perf/util/scripting-engines/trace-event-python.c
parent09211e2530ab4905ec16edecc27022d6b247419d (diff)
parent988dd774dcbd9151c2a643fc7284c5c3c4d0adb7 (diff)
downloadop-kernel-dev-5048c2af078d5976895d521262a8802ea791f3b0.zip
op-kernel-dev-5048c2af078d5976895d521262a8802ea791f3b0.tar.gz
Merge tag 'perf-core-for-mingo-20160718' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: User visible changes: - Properly report when a function wildcard produces no matches in 'perf probe' (Masami Hiramatsu) - Balance opening and reading events in 'perf stat', which could cause it to get stuck trying to close invalid file descriptors (Mark Rutland) Infrastructure changes: - Copy more headers from the kernel, this time for headers that were just including the contents of its kernel counterparts, should help resolving the problems with linux-next, where some uapi related patches seem to be breaking tools/object/ build. (Arnaldo Carvalho de Melo) Some more combing will be done, but at least it is possible to build perf out of tree, via a detached tarball (make help | grep perf), without including kernel files in its MANIFEST (Arnaldo Carvalho de Melo) - Fix smatch found errors that were not causing problems, but are mistakes nonetheless (Dan Carpenter) - Fix string vs. byte array resolving in the python script code (Jiri Olsa) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 6ac6b7a..e0203b9 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -386,7 +386,6 @@ exit:
return pylist;
}
-
static void python_process_tracepoint(struct perf_sample *sample,
struct perf_evsel *evsel,
struct addr_location *al)
@@ -457,14 +456,26 @@ static void python_process_tracepoint(struct perf_sample *sample,
pydict_set_item_string_decref(dict, "common_callchain", callchain);
}
for (field = event->format.fields; field; field = field->next) {
- if (field->flags & FIELD_IS_STRING) {
- int offset;
+ unsigned int offset, len;
+ unsigned long long val;
+
+ if (field->flags & FIELD_IS_ARRAY) {
+ offset = field->offset;
+ len = field->size;
if (field->flags & FIELD_IS_DYNAMIC) {
- offset = *(int *)(data + field->offset);
+ val = pevent_read_number(scripting_context->pevent,
+ data + offset, len);
+ offset = val;
+ len = offset >> 16;
offset &= 0xffff;
- } else
- offset = field->offset;
- obj = PyString_FromString((char *)data + offset);
+ }
+ if (field->flags & FIELD_IS_STRING &&
+ is_printable_array(data + offset, len)) {
+ obj = PyString_FromString((char *) data + offset);
+ } else {
+ obj = PyByteArray_FromStringAndSize((const char *) data + offset, len);
+ field->flags &= ~FIELD_IS_STRING;
+ }
} else { /* FIELD_IS_NUMERIC */
obj = get_field_numeric_entry(event, field, data);
}
OpenPOWER on IntegriCloud