Bug 220690 - sysctl(8) value kern.cp_times (current CPU utilization) is inconsistent with top(1)
Summary: sysctl(8) value kern.cp_times (current CPU utilization) is inconsistent with ...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2017-07-12 19:38 UTC by Yuri Victorovich
Modified: 2018-05-20 18:28 UTC (History)
1 user (show)

See Also:

cpu-consumption-kern.cp_times.sh (2.59 KB, text/plain)
2017-07-12 19:38 UTC, Yuri Victorovich
no flags Details
cpu-consumption-kern.cp_times.sh (2.59 KB, text/plain)
2017-07-12 19:45 UTC, Yuri Victorovich
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer 2017-07-12 19:38:54 UTC
Created attachment 184310 [details]

I have a process that uses 100% CPU, pinned to one CPU, according to top(1).
kern.cp_times, however, shows that CPU use frequently changes from one CPU to another. No specific CPU appears to be in use consistently, according to kern.cp_times.

Please see the attached program.

This program follows the algorithm used by xfce4 CPU use plugin sysutils/xfce4-cpugraph-plugin, which also shows incorrect CPU use as a result.

kern.cp_times CPU use data appears to not match top(1), which seems to be correct.
Comment 1 Yuri Victorovich freebsd_committer 2017-07-12 19:41:32 UTC
FreeBSD 11.1-PRERELEASE #1 r320820

The attached program is for the case of 8 CPUs.
Comment 2 Yuri Victorovich freebsd_committer 2017-07-12 19:45:23 UTC
Created attachment 184311 [details]
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2017-07-12 20:22:21 UTC
Shouldn't this instead be reclassified as "base system" ?
Comment 4 Yuri Victorovich freebsd_committer 2017-07-12 20:33:36 UTC
(In reply to Mark Linimon from comment #3)

Yes, sorry.