diff options
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
| -rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 19 | 
1 files changed, 14 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 9ef2406e0ede..1f2040f36d4e 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -642,15 +642,19 @@ exit:  	return pylist;  } -static PyObject *get_sample_value_as_tuple(struct sample_read_value *value) +static PyObject *get_sample_value_as_tuple(struct sample_read_value *value, +					   u64 read_format)  {  	PyObject *t; -	t = PyTuple_New(2); +	t = PyTuple_New(3);  	if (!t)  		Py_FatalError("couldn't create Python tuple");  	PyTuple_SetItem(t, 0, PyLong_FromUnsignedLongLong(value->id));  	PyTuple_SetItem(t, 1, PyLong_FromUnsignedLongLong(value->value)); +	if (read_format & PERF_FORMAT_LOST) +		PyTuple_SetItem(t, 2, PyLong_FromUnsignedLongLong(value->lost)); +  	return t;  } @@ -681,12 +685,17 @@ static void set_sample_read_in_dict(PyObject *dict_sample,  		Py_FatalError("couldn't create Python list");  	if (read_format & PERF_FORMAT_GROUP) { -		for (i = 0; i < sample->read.group.nr; i++) { -			PyObject *t = get_sample_value_as_tuple(&sample->read.group.values[i]); +		struct sample_read_value *v = sample->read.group.values; + +		i = 0; +		sample_read_group__for_each(v, sample->read.group.nr, read_format) { +			PyObject *t = get_sample_value_as_tuple(v, read_format);  			PyList_SET_ITEM(values, i, t); +			i++;  		}  	} else { -		PyObject *t = get_sample_value_as_tuple(&sample->read.one); +		PyObject *t = get_sample_value_as_tuple(&sample->read.one, +							read_format);  		PyList_SET_ITEM(values, 0, t);  	}  	pydict_set_item_string_decref(dict_sample, "values", values);  | 
