#566255 whislist: cpu percent usage in status bar

Package:
byobu
Source:
byobu
Submitter:
Jose Miguel Martinez
Date:
2011-08-12 10:12:57 UTC
Severity:
wishlist
#566255#5
Date:
2010-01-22 13:40:52 UTC
From:
To:
I love byobu status bar. It is nice seeing system load, but I would appreciate seeing cpu usage too.
I did not find this in screen manual so this wishlist will probably have to be fordwarded to screen project.

#566255#10
Date:
2010-01-26 04:06:02 UTC
From:
To:
Thanks for the input.  I'll gladly add a cpu_usage status item, if you
can suggest how to make such a calculation (ideally from some file
in /proc or /sys).

Cheers,
:-Dustin

#566255#15
Date:
2010-01-26 04:06:02 UTC
From:
To:
Thanks for the input.  I'll gladly add a cpu_usage status item, if you
can suggest how to make such a calculation (ideally from some file
in /proc or /sys).

Cheers,
:-Dustin

#566255#20
Date:
2010-01-29 00:40:38 UTC
From:
To:
It is easy to do from /proc/stat. I thougt that the dificulty was not
how to do it, that if it was not included in screen byobu could not
add it instead.

From /proc/stat

host:~$ cat /proc/stat | egrep ^cpu
cpu  1027415 128298 707661 10450261 335521 29714 53902 0 0
cpu0 1027415 128298 707661 10450261 335521 29714 53902 0 0

These are allways increasing counters that stands for time cpu spent
in iddle, running or wait.
If you read it periodically and make the difference you get how CPUs
spent time in this period. You do not need to worry about unit of
these numbers because you are calculating a percentage.

Searching at google for "linux cpu usage /proc/stat" throws a examples
and comments, but I am looking for documentation for the meaning of
each column. I do not remember wich column was idle or waiting. I
think I saw this in kernel doc, I think there is a similar per process
file in later kernels.

I will send you this info if I find.

Thanks,
txemi.

#566255#25
Date:
2010-01-29 00:40:38 UTC
From:
To:
It is easy to do from /proc/stat. I thougt that the dificulty was not
how to do it, that if it was not included in screen byobu could not
add it instead.

From /proc/stat

host:~$ cat /proc/stat | egrep ^cpu
cpu  1027415 128298 707661 10450261 335521 29714 53902 0 0
cpu0 1027415 128298 707661 10450261 335521 29714 53902 0 0

These are allways increasing counters that stands for time cpu spent
in iddle, running or wait.
If you read it periodically and make the difference you get how CPUs
spent time in this period. You do not need to worry about unit of
these numbers because you are calculating a percentage.

Searching at google for "linux cpu usage /proc/stat" throws a examples
and comments, but I am looking for documentation for the meaning of
each column. I do not remember wich column was idle or waiting. I
think I saw this in kernel doc, I think there is a similar per process
file in later kernels.

I will send you this info if I find.

Thanks,
txemi.

#566255#30
Date:
2011-08-12 10:10:26 UTC
From:
To:
 From "man proc":

cpu 3357 0 4313 1362393
The amount of time, measured in units of USER_HZ (1/100ths of a second
on most architectures, use sysconf(_SC_CLK_TCK) to obtain the right
value), that the system spent in user mode, user mode with low priority
(nice), system mode, and the idle task, respectively. The last value
should be USER_HZ times the second entry in the uptime pseudo-file.

In Linux 2.6 this line includes three additional columns:
iowait - time waiting for I/O to complete (since 2.5.41);
irq - time servicing interrupts (since 2.6.0-test4);
softirq - time servicing softirqs (since 2.6.0-test4).

Since Linux 2.6.11, there is an eighth column, steal - stolen time,
which is the time spent in other operating systems when running in a
virtualized environment

Since Linux 2.6.24, there is a ninth column, guest, which is the time
spent running a virtual CPU for guest operat‐ing systems under the
control of the Linux kernel.