diff options
author | James Morris <jmorris@namei.org> | 2010-05-06 10:56:07 +1000 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-05-06 10:56:07 +1000 |
commit | 0ffbe2699cda6afbe08501098dff8a8c2fe6ae09 (patch) | |
tree | 81b1a2305d16c873371b65c5a863c0268036cefe /tools/perf/util/scripting-engines/trace-event-python.c | |
parent | 4e5d6f7ec3833c0da9cf34fa5c53c6058c5908b6 (diff) | |
parent | 7ebd467551ed6ae200d7835a84bbda0dcadaa511 (diff) | |
download | blackbird-op-linux-0ffbe2699cda6afbe08501098dff8a8c2fe6ae09.tar.gz blackbird-op-linux-0ffbe2699cda6afbe08501098dff8a8c2fe6ae09.zip |
Merge branch 'master' into next
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 33a414bbba3e..6a72f14c5986 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -208,7 +208,7 @@ static void python_process_event(int cpu, void *data, int size __unused, unsigned long long nsecs, char *comm) { - PyObject *handler, *retval, *context, *t; + PyObject *handler, *retval, *context, *t, *obj; static char handler_name[256]; struct format_field *field; unsigned long long val; @@ -256,16 +256,23 @@ static void python_process_event(int cpu, void *data, offset &= 0xffff; } else offset = field->offset; - PyTuple_SetItem(t, n++, - PyString_FromString((char *)data + offset)); + obj = PyString_FromString((char *)data + offset); } else { /* FIELD_IS_NUMERIC */ val = read_size(data + field->offset, field->size); if (field->flags & FIELD_IS_SIGNED) { - PyTuple_SetItem(t, n++, PyInt_FromLong(val)); + if ((long long)val >= LONG_MIN && + (long long)val <= LONG_MAX) + obj = PyInt_FromLong(val); + else + obj = PyLong_FromLongLong(val); } else { - PyTuple_SetItem(t, n++, PyInt_FromLong(val)); + if (val <= LONG_MAX) + obj = PyInt_FromLong(val); + else + obj = PyLong_FromUnsignedLongLong(val); } } + PyTuple_SetItem(t, n++, obj); } if (_PyTuple_Resize(&t, n) == -1) |