From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 4 16:53:51 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FAB3E15 for ; Mon, 4 Aug 2014 16:53:51 +0000 (UTC) Received: from albert.catwhisker.org (mx.catwhisker.org [198.144.209.73]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AAF52AB1 for ; Mon, 4 Aug 2014 16:53:50 +0000 (UTC) Received: from albert.catwhisker.org (localhost [127.0.0.1]) by albert.catwhisker.org (8.14.9/8.14.9) with ESMTP id s74GrosT009705; Mon, 4 Aug 2014 09:53:50 -0700 (PDT) (envelope-from david@albert.catwhisker.org) Received: (from david@localhost) by albert.catwhisker.org (8.14.9/8.14.9/Submit) id s74GroT7009704; Mon, 4 Aug 2014 09:53:50 -0700 (PDT) (envelope-from david) Date: Mon, 4 Aug 2014 09:53:50 -0700 From: David Wolfskill To: Stefan Parvu Subject: Re: cpu utilization break down via sysctl Message-ID: <20140804165350.GQ1228@albert.catwhisker.org> Mail-Followup-To: David Wolfskill , Stefan Parvu , freebsd-hackers@freebsd.org References: <20140804190923.95fec6a00d175ffee89c4af5@systemdatarecorder.org> <20140804162056.GP1228@albert.catwhisker.org> <20140804194036.be325ee5822bbcb2623db358@systemdatarecorder.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5KxTQ9fdN6Op3ksq" Content-Disposition: inline In-Reply-To: <20140804194036.be325ee5822bbcb2623db358@systemdatarecorder.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Aug 2014 16:53:51 -0000 --5KxTQ9fdN6Op3ksq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 04, 2014 at 07:40:36PM +0300, Stefan Parvu wrote: > > Sure; I've done the data acquisition with sysctl & awk, then > > post-processed that with a bit of Perl. I wrote some code in R to > > generate graphs.... I did some similar stuff using RRDTool a whlie > > back. >=20 > Im planning in using BSD::Sysctl to fetch all needed values. For my data acquisition, I wasn't assuming that Perl would be available -- I therefore intentionally restricted myself to tools in base FreeBSD. Your situation is, of course, almost certainly different. :-) > ... > I see. Cool. If I understood right these will be the break down for 4 vcp= u system: >=20 > $ sysctl kern.cp_times > kern.cp_times: 28845 2060 22253 1805 1197920 27677 1477 22399 2109 119918= 0 32342 1649 19499 894 1198458 29670 1678 20324 1471 1199699 >=20 > which maps to: >=20 > time1: cpu0: user_28845: nice_2060: system_22253: intr_1805: idle_1197920 > time1: cpu1: user_27677: nice_1477 system_22399 intr_2109: idle_1199180= =20 > time1: cpu2: user_32342: nice_1649: system_19499: intr_894: idle_1198458 > time1: cpu3 user_29670: nice_1678: system_20324: intr_1471: idle_1199699 Err... Well... Maybe? The numeric values are the values of the counters at the time the information was acquired. I'd probably depict them more as: user nice system intr idle cpu0: 28845 2060 22253 1805 1197920 cpu1: 27677 1477 22399 2109 1199180 cpu2: 32342 1649 19499 894 1198458 cpu3: 29670 1678 20324 1471 1199699 > .. > Right I need to do delta between 2 readings to get the correct values. Yes. > Same as in KSTAT in Solaris perl interface.=20 It's been a long time since I did anything with Solaris. :-} > One more check here:=20 >=20 > CPU_Utilization =3D User + System + Nice + Intr ?=20 If you mean total non-idle CPU, yes. For determining available CPU, you need to include idle. > Many thanks indeed. I need to experiment with these ... Glad to help; the source for top(1) can also be instructive. Peace, david --=20 David H. Wolfskill david@catwhisker.org Taliban: Evil cowards with guns afraid of truth from a 14-year old girl. See http://www.catwhisker.org/~david/publickey.gpg for my public key. --5KxTQ9fdN6Op3ksq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQJ8BAEBCgBmBQJT37qcXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4RThEMDY4QTIxMjc1MDZFRDIzODYzRTc4 QTY3RjlDOERFRjQxOTNCAAoJEIpn+cje9Bk7UEEP/AsRYLCI3uOwWJalt/M+joZa 3xO+rNOlcyAIO7655iP8BDo0nZPZeCvtRAWVdT3QEmz3iHDTINPXHNtHu55R5CzC J/FmlMA7F8C/mEay9tZwm18KxZ5aXP1A0g1a/xGLHk2OgIphOzZlZM32RgCujqQZ EY9qF3ifkV44LSfKBA+tE8TsbtOljcSBTsLkh8t8F2I4dn6DGjm7ezBISEN7UsJS vh++zgEAUeV701Q88zlxwfZX9Yxg5KLrEtM1DQfaMa730U4DDut5oUryHi11DbEx HC7r3Ydlf5ClQbn03vgpAAu/IBHqQqVTwEbbPv6WI80v1QHMWKRu7BI01MjIYk1e FBplecrFn5z5OlkCwIYfue3/kFUHyAJkGtmlIu/HBMMv5AfsJnzDgJ48h/xgnSxR Wmty4s4CWRYlj/RJqgLcSfwPRVAxysh2DUF+UWdCRMgNasgMakx4BYOipFuedc/Z NxpjFfGZ4Jm25y/AfcfKP9GS1dDI1HcwQ/69iBIfC3xNNhB5oxy0RGobQwDKGB7O 8jxAXScUwpBURnaoQm6IYp+vDCtgecmiI1L3jyjml1u5cycd2A4d56kdz1pYlh3g h3KWGmSFy4gt7lKfzv+vM+MK4Ek+r5jz+BZwp1KNOFbe3xgE7zN9aO4zGZaRc8e3 2oFpNjUwMqK9bajvF9XH =2Ifl -----END PGP SIGNATURE----- --5KxTQ9fdN6Op3ksq--