[users at i-scream] freebsd user sg_get_cpu_percent very different than top output.

Jens Rehsack rehsack at gmail.com
Tue Mar 14 10:35:36 GMT 2017


Hi Jesper,



> Am 14.03.2017 um 10:58 schrieb Jesper Schmitz Mouridsen <jesper at schmitz.computer>:
> 
> Hi.
> This is on FreeBSD 11.0-RELEASE-p8
> I'm trying to get libstatgrab to report the cpu-usage correctly (e.g with values like top).
> 
> When I max out the cpu use of libstatsgrab and statgrab still reports < 10%
> for cpu userspace percent.
> TOP:
> CPU: 82.7% user,  0.0% nice, 13.2% system,  0.0% interrupt,  4.0% idle
> Statgrab:
> cpu.ctxsw: 0
> cpu.idle: 88.292770
> cpu.intrs: 0
> cpu.iowait: 0.000000
> cpu.kernel: 6.643582
> cpu.nice: 0.000000
> cpu.nvctxsw: 0
> cpu.softintrs: 0
> cpu.swap: 0.000000
> cpu.syscalls: 0
> cpu.time_taken: 1489484539
> cpu.user: 5.039125
> 
> On Linux (in a vm, I also find significant difference between top and statgrab)
> What am I missing?

I have no clue.

top:

> Processes: 450 total, 9 running, 15 stuck, 426 sleeping, 3093 threads    11:28:19
> Load Avg: 1.53, 1.97, 2.02  CPU usage: 6.35% user, 4.35% sys, 89.29% idle

saidar:

> Hostname  : ernie-t        Uptime : 4d 23:53:31       Date : 2017-03-14 11:28:33
>
> Load 1    :   1.72   CPU Idle  :  93.46%  Running   :   450   Zombie    :     0
> Load 5    :   1.99   CPU System:   2.99%  Sleeping  :     0   Total     :   450
> Load 15   :   2.03   CPU User  :   3.55%  Stopped   :     0   No. Users :    17

It's a FreeBSD 5 based Darwin system ;)

Ever tried `statgrab -p` - your output looks like, but since I don't know what you
really do, I can just help by guessing ...
Maybe top and statgrab aren't reasonable comparable - try compare vmstat/sar/... vs.
statgrab and top/iotop/nmon/... vs. saidar.

Cheers
--
Jens Rehsack - rehsack at gmail.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.i-scream.org/pipermail/users/attachments/20170314/1bd6049e/attachment.bin>


More information about the users mailing list