perf script python: intel-pt-events: Add machine_pid and vcpu
Add machine_pid and vcpu to the intel-pt-events.py script. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Acked-by: Ian Rogers <irogers@google.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: kvm@vger.kernel.org Link: https://lore.kernel.org/r/20220711093218.10967-20-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
6de306b7a5
commit
13a133b255
@@ -197,6 +197,11 @@ def common_start_str(comm, sample):
|
|||||||
cpu = sample["cpu"]
|
cpu = sample["cpu"]
|
||||||
pid = sample["pid"]
|
pid = sample["pid"]
|
||||||
tid = sample["tid"]
|
tid = sample["tid"]
|
||||||
|
if "machine_pid" in sample:
|
||||||
|
machine_pid = sample["machine_pid"]
|
||||||
|
vcpu = sample["vcpu"]
|
||||||
|
return "VM:%5d VCPU:%03d %16s %5u/%-5u [%03u] %9u.%09u " % (machine_pid, vcpu, comm, pid, tid, cpu, ts / 1000000000, ts %1000000000)
|
||||||
|
else:
|
||||||
return "%16s %5u/%-5u [%03u] %9u.%09u " % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000)
|
return "%16s %5u/%-5u [%03u] %9u.%09u " % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000)
|
||||||
|
|
||||||
def print_common_start(comm, sample, name):
|
def print_common_start(comm, sample, name):
|
||||||
@@ -379,7 +384,17 @@ def process_event(param_dict):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def auxtrace_error(typ, code, cpu, pid, tid, ip, ts, msg, cpumode, *x):
|
def auxtrace_error(typ, code, cpu, pid, tid, ip, ts, msg, cpumode, *x):
|
||||||
|
if len(x) >= 2 and x[0]:
|
||||||
|
machine_pid = x[0]
|
||||||
|
vcpu = x[1]
|
||||||
|
else:
|
||||||
|
machine_pid = 0
|
||||||
|
vcpu = -1
|
||||||
try:
|
try:
|
||||||
|
if machine_pid:
|
||||||
|
print("VM:%5d VCPU:%03d %16s %5u/%-5u [%03u] %9u.%09u error type %u code %u: %s ip 0x%16x" %
|
||||||
|
(machine_pid, vcpu, "Trace error", pid, tid, cpu, ts / 1000000000, ts %1000000000, typ, code, msg, ip))
|
||||||
|
else:
|
||||||
print("%16s %5u/%-5u [%03u] %9u.%09u error type %u code %u: %s ip 0x%16x" %
|
print("%16s %5u/%-5u [%03u] %9u.%09u error type %u code %u: %s ip 0x%16x" %
|
||||||
("Trace error", pid, tid, cpu, ts / 1000000000, ts %1000000000, typ, code, msg, ip))
|
("Trace error", pid, tid, cpu, ts / 1000000000, ts %1000000000, typ, code, msg, ip))
|
||||||
except broken_pipe_exception:
|
except broken_pipe_exception:
|
||||||
@@ -396,14 +411,21 @@ def context_switch(ts, cpu, pid, tid, np_pid, np_tid, machine_pid, out, out_pree
|
|||||||
preempt_str = "preempt"
|
preempt_str = "preempt"
|
||||||
else:
|
else:
|
||||||
preempt_str = ""
|
preempt_str = ""
|
||||||
|
if len(x) >= 2 and x[0]:
|
||||||
|
machine_pid = x[0]
|
||||||
|
vcpu = x[1]
|
||||||
|
else:
|
||||||
|
vcpu = None;
|
||||||
if machine_pid == -1:
|
if machine_pid == -1:
|
||||||
machine_str = ""
|
machine_str = ""
|
||||||
else:
|
elif vcpu is None:
|
||||||
machine_str = "machine PID %d" % machine_pid
|
machine_str = "machine PID %d" % machine_pid
|
||||||
|
else:
|
||||||
|
machine_str = "machine PID %d VCPU %d" % (machine_pid, vcpu)
|
||||||
switch_str = "%16s %5d/%-5d [%03u] %9u.%09u %5d/%-5d %s %s" % \
|
switch_str = "%16s %5d/%-5d [%03u] %9u.%09u %5d/%-5d %s %s" % \
|
||||||
(out_str, pid, tid, cpu, ts / 1000000000, ts %1000000000, np_pid, np_tid, machine_str, preempt_str)
|
(out_str, pid, tid, cpu, ts / 1000000000, ts %1000000000, np_pid, np_tid, machine_str, preempt_str)
|
||||||
if glb_args.all_switch_events:
|
if glb_args.all_switch_events:
|
||||||
print(switch_str);
|
print(switch_str)
|
||||||
else:
|
else:
|
||||||
global glb_switch_str
|
global glb_switch_str
|
||||||
glb_switch_str[cpu] = switch_str
|
glb_switch_str[cpu] = switch_str
|
||||||
|
|||||||
Reference in New Issue
Block a user