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 | 17 | 
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index adba01b7d9dd..9ef2406e0ede 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -131,7 +131,7 @@ static void handler_call_die(const char *handler_name)  }  /* - * Insert val into into the dictionary and decrement the reference counter. + * Insert val into the dictionary and decrement the reference counter.   * This is necessary for dictionaries since PyDict_SetItemString() does not   * steal a reference, as opposed to PyTuple_SetItem().   */ @@ -861,6 +861,13 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,  	brstacksym = python_process_brstacksym(sample, al->thread);  	pydict_set_item_string_decref(dict, "brstacksym", brstacksym); +	if (sample->machine_pid) { +		pydict_set_item_string_decref(dict_sample, "machine_pid", +				_PyLong_FromLong(sample->machine_pid)); +		pydict_set_item_string_decref(dict_sample, "vcpu", +				_PyLong_FromLong(sample->vcpu)); +	} +  	pydict_set_item_string_decref(dict_sample, "cpumode",  			_PyLong_FromLong((unsigned long)sample->cpumode)); @@ -1509,7 +1516,7 @@ static void python_do_process_switch(union perf_event *event,  		np_tid = event->context_switch.next_prev_tid;  	} -	t = tuple_new(9); +	t = tuple_new(11);  	if (!t)  		return; @@ -1522,6 +1529,8 @@ static void python_do_process_switch(union perf_event *event,  	tuple_set_s32(t, 6, machine->pid);  	tuple_set_bool(t, 7, out);  	tuple_set_bool(t, 8, out_preempt); +	tuple_set_s32(t, 9, sample->machine_pid); +	tuple_set_s32(t, 10, sample->vcpu);  	call_object(handler, t, handler_name); @@ -1559,7 +1568,7 @@ static void python_process_auxtrace_error(struct perf_session *session __maybe_u  		msg = (const char *)&e->time;  	} -	t = tuple_new(9); +	t = tuple_new(11);  	tuple_set_u32(t, 0, e->type);  	tuple_set_u32(t, 1, e->code); @@ -1570,6 +1579,8 @@ static void python_process_auxtrace_error(struct perf_session *session __maybe_u  	tuple_set_u64(t, 6, tm);  	tuple_set_string(t, 7, msg);  	tuple_set_u32(t, 8, cpumode); +	tuple_set_s32(t, 9, e->machine_pid); +	tuple_set_s32(t, 10, e->vcpu);  	call_object(handler, t, handler_name);  | 
