0

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?

2
  • Search for "how does linux top work" gives the following as the top (pun intended) result where does top gets real-time data
    – DavidPostill
    Commented Oct 27, 2014 at 20:19
  • @DavidPostill, right. So is it based on idle and non-idle times read ever since the CPU started? The link doesn't mention that, forgive me.
    – learner
    Commented Oct 27, 2014 at 20:23

1 Answer 1

0

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).

1
  • does this mean that these values are measured since when the process/CPU started?
    – learner
    Commented Oct 27, 2014 at 20:32

Not the answer you're looking for? Browse other questions tagged .