diff options
| author | Jani Nikula <jani.nikula@intel.com> | 2022-08-29 14:44:38 +0300 | 
|---|---|---|
| committer | Jani Nikula <jani.nikula@intel.com> | 2022-08-29 15:14:59 +0300 | 
| commit | 917bda9ab155032a02be1a57ebd4d949ae9e1528 (patch) | |
| tree | 7758d62783f5fb81777c37d0ad4e26eea6312c0f /tools/perf/scripts/python | |
| parent | 95086cb969b2cb8abe4984457f219ec70d24052e (diff) | |
| parent | 2c2d7a67defa198a8b8148dbaddc9e5554efebc8 (diff) | |
Merge drm/drm-next into drm-intel-next
Sync drm-intel-next with v6.0-rc as well as recent drm-intel-gt-next.
Since drm-next does not have commit f0c70d41e4e8 ("drm/i915/guc: remove
runtime info printing from time stamp logging") yet, only
drm-intel-gt-next, will need to do that as part of the merge here to
build.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'tools/perf/scripts/python')
| -rwxr-xr-x | tools/perf/scripts/python/arm-cs-trace-disasm.py | 34 | ||||
| -rw-r--r-- | tools/perf/scripts/python/intel-pt-events.py | 32 | 
2 files changed, 45 insertions, 21 deletions
| diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index 5f57d9829956..4339692a8d0b 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -61,7 +61,7 @@ def get_optional(perf_dict, field):  def get_offset(perf_dict, field):  	if field in perf_dict: -		return f"+0x{perf_dict[field]:x}" +		return "+%#x" % perf_dict[field]  	return ""  def get_dso_file_path(dso_name, dso_build_id): @@ -76,7 +76,7 @@ def get_dso_file_path(dso_name, dso_build_id):  	else:  		append = "/elf" -	dso_path = f"{os.environ['PERF_BUILDID_DIR']}/{dso_name}/{dso_build_id}{append}" +	dso_path = os.environ['PERF_BUILDID_DIR'] + "/" + dso_name + "/" + dso_build_id + append;  	# Replace duplicate slash chars to single slash char  	dso_path = dso_path.replace('//', '/', 1)  	return dso_path @@ -94,8 +94,8 @@ def read_disam(dso_fname, dso_start, start_addr, stop_addr):  		start_addr = start_addr - dso_start;  		stop_addr = stop_addr - dso_start;  		disasm = [ options.objdump_name, "-d", "-z", -			   f"--start-address=0x{start_addr:x}", -			   f"--stop-address=0x{stop_addr:x}" ] +			   "--start-address="+format(start_addr,"#x"), +			   "--stop-address="+format(stop_addr,"#x") ]  		disasm += [ dso_fname ]  		disasm_output = check_output(disasm).decode('utf-8').split('\n')  		disasm_cache[addr_range] = disasm_output @@ -109,12 +109,14 @@ def print_disam(dso_fname, dso_start, start_addr, stop_addr):  			m = disasm_re.search(line)  			if m is None:  				continue -		print(f"\t{line}") +		print("\t" + line)  def print_sample(sample): -	print(f"Sample = {{ cpu: {sample['cpu']:04} addr: 0x{sample['addr']:016x} " \ -	      f"phys_addr: 0x{sample['phys_addr']:016x} ip: 0x{sample['ip']:016x} " \ -	      f"pid: {sample['pid']} tid: {sample['tid']} period: {sample['period']} time: {sample['time']} }}") +	print("Sample = { cpu: %04d addr: 0x%016x phys_addr: 0x%016x ip: 0x%016x " \ +	      "pid: %d tid: %d period: %d time: %d }" % \ +	      (sample['cpu'], sample['addr'], sample['phys_addr'], \ +	       sample['ip'], sample['pid'], sample['tid'], \ +	       sample['period'], sample['time']))  def trace_begin():  	print('ARM CoreSight Trace Data Assembler Dump') @@ -131,7 +133,7 @@ def common_start_str(comm, sample):  	cpu = sample["cpu"]  	pid = sample["pid"]  	tid = sample["tid"] -	return f"{comm:>16} {pid:>5}/{tid:<5} [{cpu:04}] {sec:9}.{ns:09}  " +	return "%16s %5u/%-5u [%04u] %9u.%09u  " % (comm, pid, tid, cpu, sec, ns)  # This code is copied from intel-pt-events.py for printing source code  # line and symbols. @@ -171,7 +173,7 @@ def print_srccode(comm, param_dict, sample, symbol, dso):  	glb_line_number = line_number  	glb_source_file_name = source_file_name -	print(f"{start_str}{src_str}") +	print(start_str, src_str)  def process_event(param_dict):  	global cache_size @@ -188,7 +190,7 @@ def process_event(param_dict):  	symbol = get_optional(param_dict, "symbol")  	if (options.verbose == True): -		print(f"Event type: {name}") +		print("Event type: %s" % name)  		print_sample(sample)  	# If cannot find dso so cannot dump assembler, bail out @@ -197,7 +199,7 @@ def process_event(param_dict):  	# Validate dso start and end addresses  	if ((dso_start == '[unknown]') or (dso_end == '[unknown]')): -		print(f"Failed to find valid dso map for dso {dso}") +		print("Failed to find valid dso map for dso %s" % dso)  		return  	if (name[0:12] == "instructions"): @@ -244,15 +246,15 @@ def process_event(param_dict):  	# Handle CS_ETM_TRACE_ON packet if start_addr=0 and stop_addr=4  	if (start_addr == 0 and stop_addr == 4): -		print(f"CPU{cpu}: CS_ETM_TRACE_ON packet is inserted") +		print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu)  		return  	if (start_addr < int(dso_start) or start_addr > int(dso_end)): -		print(f"Start address 0x{start_addr:x} is out of range [ 0x{dso_start:x} .. 0x{dso_end:x} ] for dso {dso}") +		print("Start address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (start_addr, int(dso_start), int(dso_end), dso))  		return  	if (stop_addr < int(dso_start) or stop_addr > int(dso_end)): -		print(f"Stop address 0x{stop_addr:x} is out of range [ 0x{dso_start:x} .. 0x{dso_end:x} ] for dso {dso}") +		print("Stop address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso))  		return  	if (options.objdump_name != None): @@ -267,6 +269,6 @@ def process_event(param_dict):  		if path.exists(dso_fname):  			print_disam(dso_fname, dso_vm_start, start_addr, stop_addr)  		else: -			print(f"Failed to find dso {dso} for address range [ 0x{start_addr:x} .. 0x{stop_addr:x} ]") +			print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr, stop_addr))  	print_srccode(comm, param_dict, sample, symbol, dso) diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py index 9b7746b89381..6be7fd8fd615 100644 --- a/tools/perf/scripts/python/intel-pt-events.py +++ b/tools/perf/scripts/python/intel-pt-events.py @@ -197,7 +197,12 @@ def common_start_str(comm, sample):  	cpu = sample["cpu"]  	pid = sample["pid"]  	tid = sample["tid"] -	return "%16s %5u/%-5u [%03u] %9u.%09u  " % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000) +	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)  def print_common_start(comm, sample, name):  	flags_disp = get_optional_null(sample, "flags_disp") @@ -379,9 +384,19 @@ def process_event(param_dict):  		sys.exit(1)  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: -		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)) +		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" % +				("Trace error", pid, tid, cpu, ts / 1000000000, ts %1000000000, typ, code, msg, ip))  	except broken_pipe_exception:  		# Stop python printing broken pipe errors and traceback  		sys.stdout = open(os.devnull, 'w') @@ -396,14 +411,21 @@ def context_switch(ts, cpu, pid, tid, np_pid, np_tid, machine_pid, out, out_pree  		preempt_str = "preempt"  	else:  		preempt_str = "" +	if len(x) >= 2 and x[0]: +		machine_pid = x[0] +		vcpu = x[1] +	else: +		vcpu = None;  	if machine_pid == -1:  		machine_str = "" -	else: +	elif vcpu is None:  		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" % \  		(out_str, pid, tid, cpu, ts / 1000000000, ts %1000000000, np_pid, np_tid, machine_str, preempt_str)  	if glb_args.all_switch_events: -		print(switch_str); +		print(switch_str)  	else:  		global glb_switch_str  		glb_switch_str[cpu] = switch_str | 
