Not strictly a Ruby question, but I figure someone around here will know
the answer…
I’m using the sys-proctable gem to gather process load information on a
Debian machine (kernel 2.6.15 if it’s relevant), because I’m trying to
do some load-balancing between machines and processes on those machines.
However, I can’t seem to find any documentation on what the numbers
returned actually represent - specifically, the units of the utime,
stime, cutime and cstime fields, and precisely what they represent.
The numbers are lifted straight from /proc/PID/stat, so any
documentation on that would be handy. I’ve checked the documentation in
the kernel source tree, but it was singularly unenlightening - unless I
missed something.
For example:
– konsole_ps.rb –
require ‘proctable’
require ‘yaml’
konsole = Sys::ProcTable.ps.find{|p| p.name == ‘konsole’}
y({‘utime’ => konsole.utime, ‘stime’ => konsole.stime, ‘cutime’ =>
konsole.cutime, ‘cstime’ => konsole.cstime})
– output –
cutime: 0
utime: 82
stime: 9
cstime: 0
I don’t understand what the numbers that come out represent, and I can’t
really tie them up with what comes out of ps
. Can anyone point me in
the right direction?