From 09e1b6ffeb1b6706c441f9369be027e7ad5d56c1 Mon Sep 17 00:00:00 2001 From: Mathieu Poirier Date: Thu, 26 May 2016 10:31:47 -0600 Subject: cs-etm: associating output packet with CPU they executed on This patch adds the required mechanic to quickly lookup the CPU number associated with a traceID. That way the CPU that executed the code conveyed by a decoded packet can be identified, without having to do unecessary translations. Using this new functionality the "cs-trace-disasm.py" script is enhanced to output the file and CPU number the code has been executed on: FILE: /lib/aarch64-linux-gnu/ld-2.21.so CPU: 3 7fab57fd80: 910003e0 mov x0, sp 7fab57fd84: 94000d53 bl 7fab5832d0 FILE: /lib/aarch64-linux-gnu/ld-2.21.so CPU: 3 7fab5832d0: d11203ff sub sp, sp, #0x480 FILE: /lib/aarch64-linux-gnu/ld-2.21.so CPU: 3 7fab5832d4: a9ba7bfd stp x29, x30, [sp,#-96]! 7fab5832d8: 910003fd mov x29, sp 7fab5832dc: a90363f7 stp x23, x24, [sp,#48] 7fab5832e0: 9101e3b7 add x23, x29, #0x78 7fab5832e4: a90573fb stp x27, x28, [sp,#80] 7fab5832e8: a90153f3 stp x19, x20, [sp,#16] 7fab5832ec: aa0003fb mov x27, x0 7fab5832f0: 910a82e1 add x1, x23, #0x2a0 7fab5832f4: a9025bf5 stp x21, x22, [sp,#32] 7fab5832f8: a9046bf9 stp x25, x26, [sp,#64] 7fab5832fc: 910102e0 add x0, x23, #0x40 7fab583300: f800841f str xzr, [x0],#8 7fab583304: eb01001f cmp x0, x1 7fab583308: 54ffffc1 b.ne 7fab583300 Signed-off-by: Mathieu Poirier --- tools/perf/scripts/python/cs-trace-disasm.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/perf/scripts/python/cs-trace-disasm.py') diff --git a/tools/perf/scripts/python/cs-trace-disasm.py b/tools/perf/scripts/python/cs-trace-disasm.py index 175ae4bfa732..429d0d2d7a23 100644 --- a/tools/perf/scripts/python/cs-trace-disasm.py +++ b/tools/perf/scripts/python/cs-trace-disasm.py @@ -82,6 +82,7 @@ def process_event(t): if (len(disasm_cache) > cache_size): disasm_cache.clear(); + cpu = format(sample['cpu'], "d"); addr_range = format(sample['ip'],"x") + ":" + format(sample['addr'],"x"); try: @@ -103,6 +104,7 @@ def process_event(t): disasm_output = check_output(disasm).split('\n') disasm_cache[addr_range] = disasm_output; + print "FILE: %s\tCPU: %s" % (dso, cpu); for line in disasm_output: m = disasm_re.search(line) if (m != None) : -- cgit v1.2.3