Date: Sat, 24 Oct 2020 18:31:17 +0700 From: Eugene Grosbein <eugen@grosbein.net> To: Wojciech Puchar <wojtek@puchar.net> Cc: freebsd-hackers@freebsd.org Subject: Re: displaying total CPU usage Message-ID: <2eb77b40-99a5-c4cf-3df4-ceead23ad218@grosbein.net> In-Reply-To: <alpine.BSF.2.20.2010240957330.29620@puchar.net> References: <alpine.BSF.2.20.2010231301550.3469@puchar.net> <20201023112030.GF1427@albert.catwhisker.org> <20201023114557.GX2643@kib.kiev.ua> <alpine.BSF.2.20.2010240957330.29620@puchar.net>
next in thread | previous in thread | raw e-mail | index | archive | help
24.10.2020 14:57, Wojciech Puchar wrote: >>> be the denominator for each state. Multiply each fraction by 100 if you >>> want percentages. >> >> `vmstat 1' readily provides the measurements. Please note that for multi-core CPU averaging might yield misleading results indicating lots of available/under-loaded CPU power when one of cores it already 100% bound. You can see real picture with per-core counters obtained with sysctl kern.cp_times that shows 5 values for each CPU core: user/nice/system/interrupts/idle. For each core, exactly one of counters is incremented every "tick" at "stathz" frequency, see sysctl kern.clockrate. I use these counters to compute diffs between samples then normalize diffs to sampling interval and stathz to obtain resulting percents. They are useful for graphs. For example, mrtg performs such computations and normalization all by itself.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2eb77b40-99a5-c4cf-3df4-ceead23ad218>