From: Andi Kleen <andi@firstfloor.org>
To: sukadev@linux.vnet.ibm.com
Cc: jolsa@redhat.com, acme@kernel.org, namhyung@kernel.org,
linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 3/6] perf, tools: Support CPU id matching for x86
Date: Wed, 20 May 2015 21:11:30 -0700 [thread overview]
Message-ID: <1432181493-18743-4-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1432181493-18743-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Implement the code to match CPU types to mapfile types for x86
based on CPUID. This extends an existing similar function,
but changes it to use the x86 mapfile cpu description.
This allows to resolve event lists generated by jevents.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
| 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
--git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c
index 146d12a..28d8c08 100644
--- a/tools/perf/arch/x86/util/header.c
+++ b/tools/perf/arch/x86/util/header.c
@@ -19,8 +19,8 @@ cpuid(unsigned int op, unsigned int *a, unsigned int *b, unsigned int *c,
: "a" (op));
}
-int
-get_cpuid(char *buffer, size_t sz)
+static int
+__get_cpuid(char *buffer, size_t sz, const char *fmt)
{
unsigned int a, b, c, d, lvl;
int family = -1, model = -1, step = -1;
@@ -48,7 +48,7 @@ get_cpuid(char *buffer, size_t sz)
if (family >= 0x6)
model += ((a >> 16) & 0xf) << 4;
}
- nb = scnprintf(buffer, sz, "%s,%u,%u,%u$", vendor, family, model, step);
+ nb = scnprintf(buffer, sz, fmt, vendor, family, model, step);
/* look for end marker to ensure the entire data fit */
if (strchr(buffer, '$')) {
@@ -57,3 +57,20 @@ get_cpuid(char *buffer, size_t sz)
}
return -1;
}
+
+int
+get_cpuid(char *buffer, size_t sz)
+{
+ return __get_cpuid(buffer, sz, "%s,%u,%u,%u$");
+}
+
+bool arch_pmu_events_match_cpu(const char *vfm,
+ const char *version __maybe_unused,
+ const char *type __maybe_unused)
+{
+ char buf[128];
+
+ if (__get_cpuid(buf, sizeof buf, "%s-%u-%X$") < 0)
+ return false;
+ return !strcmp(vfm, buf);
+}
--
2.1.0
next prev parent reply other threads:[~2015-05-21 4:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 4:11 perf, tools: Event files for Intel x86 Andi Kleen
2015-05-21 4:11 ` [PATCH 1/6] perf, tools: Handle header line in mapfile Andi Kleen
2015-05-21 4:11 ` [PATCH 2/6] perf, tools: Allow events with dot Andi Kleen
2015-05-21 4:11 ` Andi Kleen [this message]
2015-05-21 4:11 ` [PATCH 4/6] perf, tools: Support alias descriptions Andi Kleen
2015-05-21 4:11 ` [PATCH 5/6] perf, tools: Query terminal width and use in perf list Andi Kleen
2015-05-21 4:11 ` [PATCH 6/6] perf, tools: Add a --no-desc flag to " Andi Kleen
2015-05-22 15:02 ` perf, tools: Event files for Intel x86 Jiri Olsa
2015-05-22 15:20 ` Andi Kleen
2015-05-22 17:27 ` Jiri Olsa
2015-05-22 16:00 ` Sukadev Bhattiprolu
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=1432181493-18743-4-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--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