Skip to contentSkip to conversation

MIPS: perf: Initial annotation support

PATCH New Dengcheng Zhu 1 participant 1 message Jan 15, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 MIPS: perf: Initial annotation support

Add support for perf annotate on MIPS.

Example of ls /bin annotation:

Percent | Source code & Disassembly of libc-2.24.so for cycles (46 samples, percent: local period)
--------------------------------------------------------------------------------------------------------

         :
         :
         :
         :           Disassembly of section .text:
         :
         :           00000000000a53a0 <strlen@@GLIBC_2.0>:
    4.22 :   a53a0:  andi    v0,a0,0x7
    0.00 :   a53a4:  beqzc   v0,a54c4 <strlen@@GLIBC_2.0+0x124>
    0.00 :   a53a8:  lb      v0,0(a0)
    0.00 :   a53ac:  beqzc   v0,a54cc <strlen@@GLIBC_2.0+0x12c>
    0.00 :   a53b0:  move    v0,a0
    0.00 :   a53b4:  bc      a53c0 <strlen@@GLIBC_2.0+0x20>
    2.16 :   a53b8:  lb      v1,0(v0)
    9.07 :   a53bc:  beqzc   v1,a5468 <strlen@@GLIBC_2.0+0xc8>
    0.00 :   a53c0:  daddiu  v0,v0,1

...

---
Changes:

v2 - v1:
* Adding compact version and branch-likely version instructions.
* Adding jalx and jr.hb instructions.

 tools/perf/arch/mips/Build                   |  2 +-
 tools/perf/arch/mips/annotate/instructions.c | 41 ++++++++++++++++++++
 tools/perf/util/annotate.c                   |  8 ++++
 3 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/arch/mips/annotate/instructions.c
tools/perf/arch/mips/Build +1 -1
index 1bb8bf6d7fd4..e4e5f33c84d8 100644
@@ -1 +1 @@
-# empty
+perf-y += util/
tools/perf/arch/mips/annotate/instructions.c new file +41 -0

41 lines not on this page · raw message

tools/perf/util/annotate.c +8 -0
index f5e77ed237e8..aeae04a3ff0d 100644
@@ -153,6 +153,7 @@ static int arch__associate_ins_ops(struct arch* arch, const char *name, struct i
 #include "arch/arm/annotate/instructions.c"
 #include "arch/arm64/annotate/instructions.c"
 #include "arch/csky/annotate/instructions.c"
+#include "arch/mips/annotate/instructions.c"
 #include "arch/x86/annotate/instructions.c"
 #include "arch/powerpc/annotate/instructions.c"
 #include "arch/s390/annotate/instructions.c"
@@ -175,6 +176,13 @@ static struct arch architectures[] = {
 		.name = "csky",
 		.init = csky__annotate_init,
 	},
+	{
+		.name = "mips",
+		.init = mips__annotate_init,
+		.objdump = {
+			.comment_char = '#',
+		},
+	},
 	{
 		.name = "x86",
 		.init = x86__annotate_init,
Signature · 1 line
2.17.1