Date: Thu, 18 Nov 2010 15:38:15 +0200 From: Daniel Nebdal <dnebdal@gmail.com> To: Andriy Gapon <avg@freebsd.org> Cc: George Neville-Neil <gnn@neville-neil.com>, freebsd-current@freebsd.org, freebsd-acpi@freebsd.org Subject: Re: aperf/mperf Message-ID: <AANLkTimcJFL8Y47mTznKz72w0z5%2BVoc9oWrz92kE%2BwQa@mail.gmail.com> In-Reply-To: <4CE51CDA.6010202@freebsd.org> References: <4CE29718.2050508@freebsd.org> <D1DB20AD-779E-469B-BFFA-C0BA1A249858@neville-neil.com> <4CE51CDA.6010202@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 18, 2010 at 2:32 PM, Andriy Gapon <avg@freebsd.org> wrote: > on 18/11/2010 05:53 George Neville-Neil said the following: >> >> On Nov 16, 2010, at 09:37 , Andriy Gapon wrote: >> >>> >>> Many modern processors provide APERF and MPERF MSRs which allow to easi= ly and >>> reliable calculate average CPU performance level over some interval of = time. >>> This also allows to notice things like performance boost, which is gene= rally >>> hidden from software. >>> What would be a proper place to add code that would measure APERF/MPERF= ratio? >>> When should trigger such a measurement and over what interval? >>> Ideas? >> >> Can you point me at documentation for this? =A0 This sounds a lot like >> hwpmc(4) and I wonder if we can make these available in the same way. > > Actually it feels more cpufreq-ish to me. > This feature is documented in, e.g., Intel Software Developer's Manual vo= lume 3A, > section 14.2 P-STATE HARDWARE COORDINATION. > Just for the sake of gathering information here: What they offer are two (64-bit, wrapping) counters; one that increases at a constant rate, and one that increases in proportion to the current performance of the CPU, so that APERF/MPERF =3D fraction of max possible performance the CPU has offered since the last time the counters were zeroed. Intel specifically suggests multiplying that with the observed CPU load over the same time period to get an absolute CPU load number, and using that to pick a suitable P-state. On a tangent, I wonder if you can get APERF>MPERF if you're using an i5/i7 and their dynamic/automatic overclocking kicks in? As for what to do with it, it sounds like it would make sense as an alternate data source for powerd? --=20 Daniel Nebdal
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimcJFL8Y47mTznKz72w0z5%2BVoc9oWrz92kE%2BwQa>