kproc_info system and user time is broken for processes with threads

Phil Kulin schors at gmail.com
Sat Jan 7 22:37:18 UTC 2012


kproc_info system and user time is broken for processes with threads,
when fetch then by kvm_getprocs() function call.
For example, modern 'ps' on server running mysqld (145 precached threads)

# ps -ax -o comm,cputime,systime,usertime | grep mysqld
mysqld        16872:35.39 5249:07.68 3353:36.79
# ps -ax -o comm,cputime,systime,usertime | grep httpd
httpd        0:00.02   0:00.00   0:00.02
httpd        0:00.00   0:00.00   0:00.00
httpd        0:02.51   0:01.77   0:00.75

Sum systime+usertime=cputime for httpd, but different for mysqld.
systime and usertime for mysqld not changed many times, but cputime increased.
Modern ps uses ki_rusage.ru_stime and ki_rusage.ru_utime from
kproc_info for systime and usertime statistic.

What wrong?

-- 
Non nobis Domine non nobis sed Nomini Tuo da gloriam
Phil Kulin


More information about the freebsd-stable mailing list