From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Jiri Olsa <jolsa@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v3] powerpc/perf: Implement get_cpu_str()
Date: Mon, 18 Aug 2014 17:08:22 -0700 [thread overview]
Message-ID: <20140819000822.GA9391@us.ibm.com> (raw)
powerpc/perf: Implement get_cpu_str()
With a file ~/.cache/pmu-events/004d0100-core.json describing Power8
PMU events we would need to run:
perf stat \
--events-file ~/.cache/pmu-events/004d0100-core.json \
-e PM_CYC sleep 1
With this get_cpu_str(), On Powerpc, we can skip the --events-file option
and run:
perf stat -e PM_CYC sleep 1
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
Changelog[v3]:
[Tobias Klauser]: Fix some changelog damage to patch.
Changelog[v2]:
[Michael Ellerman]: Use PVR instead of AUXV variables
| 12 ++++++++++++
1 file changed, 12 insertions(+)
--git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
index 6c1b8a7..306bf35 100644
--- a/tools/perf/arch/powerpc/util/header.c
+++ b/tools/perf/arch/powerpc/util/header.c
@@ -6,6 +6,7 @@
#include "../../util/header.h"
#include "../../util/util.h"
+#include "../../util/jevents.h"
#define mfspr(rn) ({unsigned long rval; \
asm volatile("mfspr %0," __stringify(rn) \
@@ -32,3 +33,14 @@ get_cpuid(char *buffer, size_t sz)
}
return -1;
}
+
+char *
+get_cpu_str(void)
+{
+ char *bufp;
+
+ if (asprintf(&bufp, "%.8lx-core", mfspr(SPRN_PVR)) < 0)
+ bufp = NULL;
+
+ return bufp;
+}
--
1.8.3.1
next reply other threads:[~2014-08-19 0:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-19 0:08 Sukadev Bhattiprolu [this message]
2014-08-20 6:21 ` [PATCH v3] powerpc/perf: Implement get_cpu_str() Michael Ellerman
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=20140819000822.GA9391@us.ibm.com \
--to=sukadev@linux.vnet.ibm.com \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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