Lines Matching +full:sample +full:- +full:time
1 # SPDX-License-Identifier: GPL-2.0
2 # arm-cs-trace-disasm.py: ARM CoreSight Trace Dump With Disassember
20 # Note a --kcore recording is required for accurate decode
29 # +-----------+-----------------+------------------+------------------+
31 # +-----------+-----------------+------------------+------------------+
32 # | --kcore | yes | no | yes |
34 # +-----------+-----------------+------------------+------------------+
38 # perf script -s scripts/python/arm-cs-trace-disasm.py -d
40 # Output disassembly with llvm-objdump:
41 # perf script -s scripts/python/arm-cs-trace-disasm.py \
42 # -- -d llvm-objdump-11 -k path/to/vmlinux
45 # perf script -s scripts/python/arm-cs-trace-disasm.py
59 args.add_argument("-k", "--vmlinux",
61 args.add_argument("-d", "--objdump", nargs="?", const=default_objdump(),
63 args.add_argument("-v", "--verbose", action="store_true", help="Enable debugging log")
64 args.add_argument("--start-time", type=int_arg, help="Monotonic clock time of sample to start from.…
65 "See 'time' field on samples in -v mode.")
66 args.add_argument("--stop-time", type=int_arg, help="Monotonic clock time of sample to stop at. "
67 "See 'time' field on samples in -v mode.")
68 args.add_argument("--start-sample", type=int_arg, help="Index of sample to start from. "
69 "See 'index' field on samples in -v mode.")
70 args.add_argument("--stop-sample", type=int_arg, help="Index of sample to stop at. "
71 "See 'index' field on samples in -v mode.")
76 print("--start-time must less than --stop-time")
80 print("--start-sample must less than --stop-sample")
86 disasm_re = re.compile(r"^\s*([0-9a-fA-F]+):")
87 disasm_func_re = re.compile(r"^\s*([0-9a-fA-F]+)\s.*:")
89 sample_idx = -1
97 f"/usr/lib/debug/boot/vmlinux-{kver}.debug",
100 f"/usr/lib/debug/boot/vmlinux-{kver}",
101 f"/boot/vmlinux-{kver}",
156 start_addr = start_addr - dso_start;
157 stop_addr = stop_addr - dso_start;
158 disasm = [ options.objdump, "-d", "-z",
159 "--start-address="+format(start_addr,"#x"),
160 "--stop-address="+format(stop_addr,"#x") ]
162 disasm_output = check_output(disasm).decode('utf-8').split('\n')
176 def print_sample(sample): argument
177 print("Sample = { cpu: %04d addr: 0x%016x phys_addr: 0x%016x ip: 0x%016x " \
178 "pid: %d tid: %d period: %d time: %d index: %d}" % \
179 (sample['cpu'], sample['addr'], sample['phys_addr'], \
180 sample['ip'], sample['pid'], sample['tid'], \
181 sample['period'], sample['time'], sample_idx))
192 def common_start_str(comm, sample): argument
193 sec = int(sample["time"] / 1000000000)
194 ns = sample["time"] % 1000000000
195 cpu = sample["cpu"]
196 pid = sample["pid"]
197 tid = sample["tid"]
198 return "%16s %5u/%-5u [%04u] %9u.%09u " % (comm, pid, tid, cpu, sec, ns)
200 # This code is copied from intel-pt-events.py for printing source code
202 def print_srccode(comm, param_dict, sample, symbol, dso): argument
203 ip = sample["ip"]
205 start_str = common_start_str(comm, sample) + ("%x" % ip).rjust(16).ljust(40)
208 start_str = common_start_str(comm, sample) + (symbol + offs).ljust(40)
220 src_file = ("..." + source_file_name[-37:]) + " "
245 sample = param_dict["sample"]
259 cpu = sample["cpu"]
260 ip = sample["ip"]
261 addr = sample["addr"]
265 if (options.start_time and sample["time"] < options.start_time):
267 if (options.stop_time and sample["time"] > options.stop_time):
276 print_sample(sample)
294 print_srccode(comm, param_dict, sample, symbol, dso)
297 # Don't proceed if this event is not a branch sample, .
303 # +------------+------------+------------+
305 # +------------+------------+------------+
307 # +------------+------------+------------+
322 # Record for previous sample packet
355 print_srccode(comm, param_dict, sample, symbol, dso)