Top gives me an output like:
%Cpu(s): 4.7 us, 1.3 sy, 0.0 ni, 93.9 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
if my CPU has spent 4.7% of its time on user processes, how much of time history has it considered before coming up with such a result?
Top gives me an output like:
%Cpu(s): 4.7 us, 1.3 sy, 0.0 ni, 93.9 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
if my CPU has spent 4.7% of its time on user processes, how much of time history has it considered before coming up with such a result?
From where does top gets real-time data, answer by bdonlan:
As documented in proc(5), in the file
/proc/(pid)/stat
you have the fields:
utime %lu
Amount of time that this process has been scheduled in user mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK). This includes guest time, guest_time (time spent running a virtual CPU, see below), so that applications that are not aware of the guest time field do not lose that time from their calculations.
stime %lu
Amount of time that this process has been scheduled in kernel mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK).