[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120704120155.GE960@krava.redhat.com>
Date: Wed, 4 Jul 2012 14:01:55 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: acme@...hat.com, mingo@...e.hu, paulus@...ba.org,
cjashfor@...ux.vnet.ibm.com, fweisbec@...il.com,
eranian@...gle.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 04/10] perf, x86: Making hardware events translations
available in sysfs
On Wed, Jul 04, 2012 at 12:38:31PM +0200, Peter Zijlstra wrote:
> On Wed, 2012-07-04 at 12:22 +0200, Peter Zijlstra wrote:
> > How about something like:
> >
> > u64 config = x86_pmu.event_map(_id);
> > u64 event = (config & ARCH_PERFMON_EVENTSEL_EVENT) |
> > (config & AMD64_EVENTSEL_EVENT) >> 24;
> > u64 umask = (config & ARCH_PERFMON_EVENTSEL_UMASK) >> 8;
> >
> > WARN_ON_ONCE(config & (ARCH_PERFMON_EVENTSEL_INV |
> > ARCH_PERFMON_EVENTSEL_CMASK));
> >
> > sprintf("event=0x%02llx,umask=0x%02llx\n", event, umask);
>
> Oh wait, silly me, we actually need the inv and cmask too.
>
> So that gets to be something like:
>
> u64 config = x86_pmu.event_map(_id);
> u64 event = (config & ARCH_PERFMON_EVENTSEL_EVENT) |
> (config & AMD64_EVENTSEL_EVENT) >> 24;
> u64 umask = (config & ARCH_PERFMON_EVENTSEL_UMASK) >> 8;
> u64 inv = (config & ARCH_PERFMON_EVENTSEL_INV) >> 23;
> u64 cmask = (config & ARCH_PERFMON_EVENTSEL_CMASK) >> 24;
> ssize_t ret;
>
> ret = sprintf(page, "event=0x%02llx", event);
> if (umask)
> ret += sprintf(page + ret, ",umask=0x%02llx", umask);
> if (inv)
> ret += sprintf(page + ret, ",inv");
> if (cmask)
> ret += sprintf(page + ret, ",cmask=0x%02llx", cmask);
> sprintf(page + ret, "\n");
>
> return ret;
>
ok
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists