bin/128177: wrong CPU usage reported by top/ps with SCHED_ULE
shoesoft at gmx.net
Fri Oct 17 12:30:05 UTC 2008
>Synopsis: wrong CPU usage reported by top/ps with SCHED_ULE
>Arrival-Date: Fri Oct 17 12:30:04 UTC 2008
>Originator: Stefan Ehmann
>Release: FreeBSD 7.1-PRERELEASE i386
System: FreeBSD 7.1-PRERELEASE #64: Fri Oct 17 11:04:45 CEST 2008
stefan at taxman.pepperland:/usr/obj/usr/src/sys/TAXMAN
If a process runs in a busy loop, the CPU usage reported in top/ps is wrong. It starts at ~20% and goes down to 0% within a few seconds. The overall CPU usage is reported correctly.
Here's the top output:
last pid: 22916; load averages: 0.71, 0.48, 0.39 up 0+00:25:47 11:32:57
87 processes: 4 running, 83 sleeping
CPU: 96.3% user, 0.0% nice, 3.4% system, 0.4% interrupt, 0.0% idle
Mem: 261M Active, 110M Inact, 134M Wired, 1656K Cache, 110M Buf, 482M Free
Swap: 1280M Total, 1280M Free
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
22916 stefan 1 98 0 3500K 1684K RUN 0:02 11.18% sh <-- this should be ~100%
22719 stefan 1 44 0 103M 57444K RUN 1:10 0.00% Xorg
Only happens with SCHED_ULE. With SCHED_4BSD the reported values look sane. I didn't see this on 8-CURRENT on the same machine when I've tested it about 2 weeks ago.
Run a program that uses all available CPU cycles, e.g.
$ while true; do true; done
Look at CPU usage reported by top or ps.
More information about the freebsd-bugs