linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anju T <anju@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: anju@linux.vnet.ibm.com, maddy@linux.vnet.ibm.com,
	mpe@ellerman.id.au, khandual@linux.vnet.ibm.com,
	sukadev@linux.vnet.ibm.com, acme@redhat.com, dsahern@gmail.com,
	jolsa@redhat.com, hemant@linux.vnet.ibm.com,
	naveen.n.rao@linux.vnet.ibm.com
Subject: [PATCH V3 3/3] tools/perf:Map the ID values with register names
Date: Tue,  3 Nov 2015 11:40:02 +0530	[thread overview]
Message-ID: <1446531002-16582-4-git-send-email-anju@linux.vnet.ibm.com> (raw)
In-Reply-To: <1446531002-16582-1-git-send-email-anju@linux.vnet.ibm.com>

Map ID values with corresponding register names.These names are then
displayed when user issues perf record with the -I option
followed by perf report/script with -D option.

Signed-off-by: Anju T <anju@linux.vnet.ibm.com>
---
 tools/perf/arch/powerpc/include/perf_regs.h | 114 ++++++++++++++++++++++++++++
 tools/perf/config/Makefile                  |   5 ++
 2 files changed, 119 insertions(+)
 create mode 100644 tools/perf/arch/powerpc/include/perf_regs.h

diff --git a/tools/perf/arch/powerpc/include/perf_regs.h b/tools/perf/arch/powerpc/include/perf_regs.h
new file mode 100644
index 0000000..47307ca
--- /dev/null
+++ b/tools/perf/arch/powerpc/include/perf_regs.h
@@ -0,0 +1,114 @@
+#ifndef ARCH_PERF_REGS_H
+#define ARCH_PERF_REGS_H
+
+#include <stdlib.h>
+#include <linux/types.h>
+#include <asm/perf_regs.h>
+
+#define PERF_REGS_MASK  ((1ULL << PERF_REG_POWERPC_MAX) - 1)
+#define PERF_REGS_MAX   PERF_REG_POWERPC_MAX
+#define PERF_SAMPLE_REGS_ABI   PERF_SAMPLE_REGS_ABI_64
+
+#define PERF_REG_IP     PERF_REG_POWERPC_NIP
+#define PERF_REG_SP     PERF_REG_POWERPC_R1
+
+static inline const char *perf_reg_name(int id)
+{
+	switch (id) {
+	case PERF_REG_POWERPC_GPR0:
+		return "gpr0";
+	case PERF_REG_POWERPC_GPR1:
+		return "gpr1";
+	case PERF_REG_POWERPC_GPR2:
+		return "gpr2";
+	case PERF_REG_POWERPC_GPR3:
+		return "gpr3";
+	case PERF_REG_POWERPC_GPR4:
+		return "gpr4";
+	case PERF_REG_POWERPC_GPR5:
+		return "gpr5";
+	case PERF_REG_POWERPC_GPR6:
+		return "gpr6";
+	case PERF_REG_POWERPC_GPR7:
+		return "gpr7";
+	case PERF_REG_POWERPC_GPR8:
+		return "gpr8";
+	case PERF_REG_POWERPC_GPR9:
+		return "gpr9";
+	case PERF_REG_POWERPC_GPR10:
+		return "gpr10";
+	case PERF_REG_POWERPC_GPR11:
+		return "gpr11";
+	case PERF_REG_POWERPC_GPR12:
+		return "gpr12";
+	case PERF_REG_POWERPC_GPR13:
+		return "gpr13";
+	case PERF_REG_POWERPC_GPR14:
+		return "gpr14";
+	case PERF_REG_POWERPC_GPR15:
+		return "gpr15";
+	case PERF_REG_POWERPC_GPR16:
+		return "gpr16";
+	case PERF_REG_POWERPC_GPR17:
+		return "gpr17";
+	case PERF_REG_POWERPC_GPR18:
+		return "gpr18";
+	case PERF_REG_POWERPC_GPR19:
+		return "gpr19";
+	case PERF_REG_POWERPC_GPR20:
+		return "gpr20";
+	case PERF_REG_POWERPC_GPR21:
+		return "gpr21";
+	case PERF_REG_POWERPC_GPR22:
+		return "gpr22";
+	case PERF_REG_POWERPC_GPR23:
+		return "gpr23";
+	case PERF_REG_POWERPC_GPR24:
+		return "gpr24";
+	case PERF_REG_POWERPC_GPR25:
+		return "gpr25";
+	case PERF_REG_POWERPC_GPR26:
+		return "gpr26";
+	case PERF_REG_POWERPC_GPR27:
+		return "gpr27";
+	case PERF_REG_POWERPC_GPR28:
+		return "gpr28";
+	case PERF_REG_POWERPC_GPR29:
+		return "gpr29";
+	case PERF_REG_POWERPC_GPR30:
+		return "gpr30";
+	case PERF_REG_POWERPC_GPR31:
+		return "gpr31";
+	case PERF_REG_POWERPC_NIP:
+		return "nip";
+	case PERF_REG_POWERPC_MSR:
+		return "msr";
+	case PERF_REG_POWERPC_ORIG_R3:
+		return "orig_r3";
+	case PERF_REG_POWERPC_CTR:
+		return "ctr";
+	case PERF_REG_POWERPC_LNK:
+		return "link";
+	case PERF_REG_POWERPC_XER:
+		return "xer";
+	case PERF_REG_POWERPC_CCR:
+		return "ccr";
+#ifdef __powerpc64__
+	case PERF_REG_POWERPC_SOFTE:
+		return "softe";
+#else
+	case PERF_REG_POWERPC_MQ:
+		return "mq";
+#endif
+	case PERF_REG_POWERPC_TRAP:
+		return "trap";
+	case PERF_REG_POWERPC_DAR:
+		return "dar";
+	case PERF_REG_POWERPC_DSISR:
+		return "dsisr";
+	default:
+		return NULL;
+	}
+	return NULL;
+}
+#endif /*ARCH_PERF_REGS_H */
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 38a0853..3db9b5d 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -23,6 +23,11 @@ $(call detected_var,ARCH)
 
 NO_PERF_REGS := 1
 
+#Additional ARCH settings for ppc64
+ifeq ($(ARCH),powerpc)
+	NO_PERF_REGS := 0
+endif
+
 # Additional ARCH settings for x86
 ifeq ($(ARCH),x86)
   $(call detected,CONFIG_X86)
-- 
2.1.0

  parent reply	other threads:[~2015-11-03  6:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03  6:09 [PATCH V3 0/3] perf/powerpc:Add ability to sample intr machine state in powerpc Anju T
2015-11-03  6:10 ` [PATCH V3 1/3] perf/powerpc:add ability to sample intr machine state in power Anju T
2015-11-03  6:10 ` [PATCH V3 2/3] perf/powerpc :add support for sampling intr machine state Anju T
2015-11-03  9:16   ` Michael Ellerman
2015-11-04  5:08     ` Anju T
2015-11-04  5:18     ` Anju T
2015-11-04  5:45     ` Madhavan Srinivasan
2015-11-03  6:10 ` Anju T [this message]
2015-11-04  8:56 ` [PATCH V3 0/3] perf/powerpc:Add ability to sample intr machine state in powerpc Denis Kirjanov
2015-11-06  6:59   ` Anju T
2015-11-06  7:39     ` Denis Kirjanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446531002-16582-4-git-send-email-anju@linux.vnet.ibm.com \
    --to=anju@linux.vnet.ibm.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=jolsa@redhat.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=sukadev@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).