Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 189432
b: refs/heads/master
c: b1dcc03
h: refs/heads/master
v: v3
  • Loading branch information
Tom Zanussi authored and Ingo Molnar committed Apr 2, 2010
1 parent 809c104 commit b28a6c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8bb39f9aa068262732fe44b965d7a6eb5a5a7d67
refs/heads/master: b1dcc03cb8ee0f5718491e8c518257238dc64e00
17 changes: 12 additions & 5 deletions trunk/tools/perf/util/scripting-engines/trace-event-python.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b28a6c0

Please sign in to comment.