Phil Kulin
2012-Jan-07 22:37 UTC
kproc_info system and user time is broken for processes with threads
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
John Baldwin
2012-Jan-09 14:00 UTC
kproc_info system and user time is broken for processes with threads
On Saturday, January 07, 2012 5:06:46 pm Phil Kulin wrote:> 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 cputimeincreased.> Modern ps uses ki_rusage.ru_stime and ki_rusage.ru_utime from > kproc_info for systime and usertime statistic. > > What wrong?Hmm, I can't see anything that would explain this. What if you look at individual threads of mysqld (using 'H') flag? Also, which OS version are you using? -- John Baldwin