From owner-freebsd-acpi@FreeBSD.ORG Fri Nov 19 15:45:36 2010 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F7D4106566B; Fri, 19 Nov 2010 15:45:36 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6493E8FC14; Fri, 19 Nov 2010 15:45:34 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA15070; Fri, 19 Nov 2010 17:45:31 +0200 (EET) (envelope-from avg@freebsd.org) Message-ID: <4CE69B9B.60101@freebsd.org> Date: Fri, 19 Nov 2010 17:45:31 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: Daniel Nebdal References: <4CE29718.2050508@freebsd.org> <4CE51CDA.6010202@freebsd.org> <4CE533DE.7010401@freebsd.org> <4CE68C0B.1080007@freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-acpi@freebsd.org, freebsd-current@freebsd.org Subject: Re: aperf/mperf X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2010 15:45:36 -0000 [looks like I originally sent the reply only privately] on 19/11/2010 16:50 Daniel Nebdal said the following: > On Fri, Nov 19, 2010 at 4:39 PM, Andriy Gapon wrote: >> >> I am thinking about providing two APIs for this. >> >> 1. KPI >> void cpu_get_a_m_perf(u_int cpu, uint64_t *aperf, uint64_t *mperf); >> >> 2. Userland >> sysctl dev.cpu.N.aperf_mperf that returns two UQUAD values. >> >> But I am not sure where to put the code for both APIs. >> Adding another device under cpu seems like an overkill. >> >> Ideas? >> Thanks! > > No comment on where to put it, but one other detail: Since these are > measures since last reset, you probably want a similar > "cpu_zero_a_m_perf" call. As for how that interacts with the sysctl, > uhm ... maybe also offering a time-since-last-reset could be useful? > I have something else in mind - no reset, but you call cpu_get_a_m_perf() twice, take differences in the counters (accounting for possible overflows) and divide those deltas. In my opinion that should work. -- Andriy Gapon