ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #03966
Re: Catching CPU run-aways on Touch
On Wed, Sep 4, 2013 at 12:25 PM, Thomas Voß <thomas.voss@xxxxxxxxxxxxx> wrote:
>
> True, but to determine the CPU percentage, we would need to have the
> CPU usage of all processes for a certain amount of time available.
> That is, essentially parsing all of proc iiuc. I'm hopefully wrong,
> but if not, could we resort to an approach that just considers the
> per-process user and system CPU time consumed in a given time
> interval?
I might be missing something, but the load average (from
/proc/loadavg) is the overall CPU usage for three given amounts of
time (a minute, five minutes, fifteen minutes). Much faster than
parsing all of proc:
/proc/loadavg
The first three fields in this file are load average
figures giving the number of jobs in the run queue
(state R) or waiting for disk I/O (state D) averaged
over 1, 5, and 15 minutes. They are the same as the
load average numbers given by uptime(1) and other pro‐
grams. The fourth field consists of two numbers sepa‐
rated by a slash (/). The first of these is the num‐
ber of currently runnable kernel scheduling entities
(processes, threads). The value after the slash is
the number of kernel scheduling entities that cur‐
rently exist on the system. The fifth field is the
PID of the process that was most recently created on
the system.
(from 'man proc')
Follow ups
References