From owner-freebsd-current@FreeBSD.ORG Thu Nov 18 13:38:16 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7745106566B for ; Thu, 18 Nov 2010 13:38:16 +0000 (UTC) (envelope-from dnebdal@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3884D8FC0A for ; Thu, 18 Nov 2010 13:38:15 +0000 (UTC) Received: by gyg13 with SMTP id 13so1874051gyg.13 for ; Thu, 18 Nov 2010 05:38:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=rSripufxnW3W+X/Ig1gTgvvhSpznakKfthQVxZohjSU=; b=ZNmeIzfeEtiJky0GLyFZLtuRMNWGlkhhrvA7Kw/qc7lLe9ggrT/q5J1y4nXrPMlmJ8 7WuU4CSnQpVDfRA15OJY/PdLVvS6BAk+7uvY7833JundtdQtnQrGNAm4N0MZ7OKNx/o3 xTrjDGBRS+JaOXPhC3rPHYkGic9ouLtvdXEro= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=qoNjQtoDHkb3yFqKxcbfLPEf0DO3hE8GHOSDY/xt7d71NmEzeKU7leOJfk0+Is5svS uuuipRCMJtk6K8UB8Q7gDr/SLHWEVxUjSqRwYuzI2jSVHJxTJurG8hJFwOM9dh+pgPzz HCoQLRHxpcT8AIqeqx0pqN+S2akz5LpOdJyLk= MIME-Version: 1.0 Received: by 10.151.42.16 with SMTP id u16mr1313341ybj.97.1290087495436; Thu, 18 Nov 2010 05:38:15 -0800 (PST) Received: by 10.151.114.4 with HTTP; Thu, 18 Nov 2010 05:38:15 -0800 (PST) In-Reply-To: <4CE51CDA.6010202@freebsd.org> References: <4CE29718.2050508@freebsd.org> <4CE51CDA.6010202@freebsd.org> Date: Thu, 18 Nov 2010 15:38:15 +0200 Message-ID: From: Daniel Nebdal To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: George Neville-Neil , freebsd-current@freebsd.org, freebsd-acpi@freebsd.org Subject: Re: aperf/mperf X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Nov 2010 13:38:16 -0000 On Thu, Nov 18, 2010 at 2:32 PM, Andriy Gapon 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