From owner-freebsd-arch@FreeBSD.ORG Tue Apr 2 23:24:11 2013 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D5EE5522; Tue, 2 Apr 2013 23:24:11 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id A30A9339; Tue, 2 Apr 2013 23:24:10 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 82E0DAAC; Wed, 3 Apr 2013 01:20:41 +0200 (CEST) Date: Wed, 3 Apr 2013 01:26:07 +0200 From: Pawel Jakub Dawidek To: Gleb Smirnoff Subject: Re: [CFR][CFT] counter(9): new API for faster and raceless counters Message-ID: <20130402232606.GC1810@garage.freebsd.pl> References: <20130401115128.GZ76816@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HG+GLK89HZ1zG0kk" Content-Disposition: inline In-Reply-To: <20130401115128.GZ76816@FreeBSD.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2013 23:24:11 -0000 --HG+GLK89HZ1zG0kk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 01, 2013 at 03:51:28PM +0400, Gleb Smirnoff wrote: > Hi! >=20 > Together with Konstantin Belousov (kib@) we developed a new API that is > initially purposed for (but not limited to) collecting statistical > data in kernel. Is there any plan to implement universal way of exporting those statistics out of the kernel? Solaris has a framework for in-kernel statistics, which are exported via kstat tool. For ZFS I export them via sysctl. If you have ZFS loaded you can try 'sysctl kstat'. It would be nice for counter_u64_alloc() to take additional argument 'name' and to create sysctl for the counter automatically. We could then slowly start migrating userland tools to use sysctls (or some wrapper userland API), but we immediately make those statistics available for use in scripts. > o Tiny API for counter(9): >=20 > counter_u64_t > counter_u64_alloc(int wait); >=20 > void > counter_u64_free(counter_u64_t cnt); >=20 > void > counter_u64_add(counter_u64_t cnt, uint64_t inc); >=20 > uint64_t > counter_u64_fetch(counter_u64_t cnt); Do you really expect other types in the future? If so, could we at least create generic counter_t that internally keeps the type? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --HG+GLK89HZ1zG0kk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlFbaQ4ACgkQForvXbEpPzSimwCeN6N1ztUz4EQrQrX9yDAouWAy bEsAoOZkQe7H7tjPAXFK3beyZjv4LD8z =qcsC -----END PGP SIGNATURE----- --HG+GLK89HZ1zG0kk--