From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 18 21:56:19 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29438106577C for ; Wed, 18 Feb 2009 21:56:19 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from albert.catwhisker.org (adsl-63-193-123-122.dsl.snfc21.pacbell.net [63.193.123.122]) by mx1.freebsd.org (Postfix) with ESMTP id DC9D88FC2F for ; Wed, 18 Feb 2009 21:56:18 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from albert.catwhisker.org (localhost [127.0.0.1]) by albert.catwhisker.org (8.14.3/8.14.3) with ESMTP id n1ILuIGw029523; Wed, 18 Feb 2009 13:56:18 -0800 (PST) (envelope-from david@albert.catwhisker.org) Received: (from david@localhost) by albert.catwhisker.org (8.14.3/8.14.3/Submit) id n1ILuI8h029522; Wed, 18 Feb 2009 13:56:18 -0800 (PST) (envelope-from david) Date: Wed, 18 Feb 2009 13:56:18 -0800 From: David Wolfskill To: Nikola Kne??evi?? Message-ID: <20090218215618.GV81076@albert.catwhisker.org> Mail-Followup-To: David Wolfskill , Nikola Kne??evi?? , freebsd-hackers@freebsd.org References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xoUDadTz98C4LPSf" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-hackers@freebsd.org Subject: Re: Obtaining l2 misses and cpu utilization in a module X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2009 21:56:20 -0000 --xoUDadTz98C4LPSf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 18, 2009 at 08:18:20PM +0100, Nikola Kne??evi?? wrote: > Hi, >=20 > I would like to obtain fore mentioned data from within my module. I =20 > need these performance metrics to see how certain code executes, and =20 > make decisions during the runtime. pmc(3) seems complete, but it also =20 > seems to be intended for use in the userland. >=20 > How to use pmc from modules? Is there any other way? Also, module is =20 > amd64 only, so I don't care about portability. I'm not sure what you mean by "module" ini this context. But CPU utilization my be found in the kern.cp_time sysctl value; per-core utilization may be found in the kern.cp_times sysctl value. Note that these are arrays of counters; a given set of values will be foir "user", "nice", "system", "interrupt", and "idle" CPU time (in that order). The differences between respective counters at each end of a time interval of interest will be informative. Peace, david --=20 David H. Wolfskill david@catwhisker.org Depriving a girl or boy of an opportunity for education is evil. See http://www.catwhisker.org/~david/publickey.gpg for my public key. --xoUDadTz98C4LPSf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkmchAEACgkQmprOCmdXAD1L/gCfVn828SouTXKgSeGGlxtTS6Fq 6KEAn2fQJKeFDilI/8Ca6wxpHjulB8G9 =Za0g -----END PGP SIGNATURE----- --xoUDadTz98C4LPSf--