Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Aug 2014 09:53:50 -0700
From:      David Wolfskill <david@catwhisker.org>
To:        Stefan Parvu <sparvu@systemdatarecorder.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: cpu utilization break down via sysctl
Message-ID:  <20140804165350.GQ1228@albert.catwhisker.org>
In-Reply-To: <20140804194036.be325ee5822bbcb2623db358@systemdatarecorder.org>
References:  <20140804190923.95fec6a00d175ffee89c4af5@systemdatarecorder.org> <20140804162056.GP1228@albert.catwhisker.org> <20140804194036.be325ee5822bbcb2623db358@systemdatarecorder.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140804165350.GQ1228>