From owner-svn-src-head@freebsd.org Wed Mar 16 04:40:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31114AD2CA6; Wed, 16 Mar 2016 04:40:06 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id EFC491119; Wed, 16 Mar 2016 04:40:05 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-229-231.lns20.per1.internode.on.net [121.45.229.231]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id u2G4drV5013964 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 15 Mar 2016 21:39:56 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys To: Gleb Smirnoff , Ravi Pokala References: <201603150005.u2F050ps086390@repo.freebsd.org> <20160315191229.GU1328@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Julian Elischer Message-ID: <56E8E394.7090100@freebsd.org> Date: Wed, 16 Mar 2016 12:39:48 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160315191229.GU1328@FreeBSD.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Mar 2016 04:40:06 -0000 On 16/03/2016 3:12 AM, Gleb Smirnoff wrote: > Ravi, > > On Mon, Mar 14, 2016 at 05:33:06PM -0700, Ravi Pokala wrote: > R> To make sure I'm reading this correctly: > R> > R> (1) The sysctl operates on an opaque array of (uint64_t)s. The elements of the array are not individually accessible. > > On array of counter_u64_t. The elements are individually accessible of course, > but not by this sysctl API. > > R> (2) Reading the sysctl populates each element of the userspace array by calling counter_u64_fetch() on the corresponding element of the kernelspace array. > > Right. > > R> (3) Writing the sysctl clears the kernelspace array by calling counter_u64_zero() on each element. > > Right. > but it is not atomic. since the user process decides the time delay between a read and write (zero) there could be a lot of missed counts if you are resetting to zero after each read. better to just read in a loop and not zero.. here are somethings I've wanted at various times: read/zero atomic read timestamp as part of imported struct. (because you really can't do accurate timing from user space, but knowing when the data was read is a good replacement). read a "mib" (for want of a better term) for each set, giving individual field names.