Re: [RFC][PATCH 0/6] perf: x86 RDPMC and RDTSC support

From: Peter Zijlstra
Date: Wed Dec 21 2011 - 07:59:23 EST


On Fri, 2011-12-16 at 17:36 -0500, Vince Weaver wrote:
> Is it possible to read multiple counters at once with this
> interface, i.e. using FORMAT_GROUP?

No, that's not something that I had considered, I'll see if I can make
that happen by making an array inside the control page instead of a
single version.

For now you'll have to mmap() the control page for each counter
individually.

> Also, am I correct that the counters are set to always counting, so you
> always have to do a rdpmc() before and a rdpmc() after?

Depending on how you use it, but yes that's how I'd use it, avoids
having to do ioctl()s

> I used the mmap_read_self() routine from your example as the "read"
> performance that I measured.

Yeah that's about it, if you want to discard the overload scenario, eg
you use pinned counters or so, you can optimize it further by stripping
out the tsc and scaling muck.

> If start/stop are truly unnecessary when run with your patch then the
> "total" results shift in your favor. Otherwise perfmon2 and perfctr still
> win the self-monitoring overhead race by a lot.

You can of course also do the start/stop/reset in userspace by keeping
an offset to the counter, avoiding the ioctl()s and simply keeping the
counter running.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/