mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
e876f6d052
more obvious imprecision in the previous top changes. Specifically, top uses a delta of clock_gettime() calls right after invoking the kern.proc sysctl to fetch the process/thread list to compute the time delta between the fetches. However, the kern.proc sysctl handler does not run in constant time. It can spin on locks, be preempted by an interrupt handler, etc. As a result, the time between the gathering of stats for individual processes or threads between subsequent kern.proc handlers can vary. If a "slow" kern.proc run is followed by a "fast" kern.proc run, then the threads/processes at the start of the "slow" run will have a longer time delta than the threads/processes at the end. If the clock_gettime() time delta is not itself skewed by preemption, then the delta may be too short for a given thread/process resulting in a higher percent CPU than actual. However, there is no good way to calculate the exact amount of overage, nor to know which threads to subtract the overage from. Instead, just punt and fix the definitely-wrong case of an individual thread having more than 100% CPU. Discussed with: zonk |
||
---|---|---|
.. | ||
machine.c | ||
Makefile | ||
top.local.1 |