> Can you pull the same information from /proc/stat as opposed to using
> a pipe to top? The first line(s) should contain (at least):
>
> cpu usermode, lowprio, system, idle, hz.
Thanks a lot for the help. I finally decided to go with your suggestion.
--
warm regards,
Pradnyesh Sawant
--
Be yoursel
The code snippet prints "cpu usage: us,, " on my
workstation, bumping the splt index to 3 prints the correct sys.
usage. What does the header of your 'top' command look like? There's
a very good chance it's different than what I'm testing with.
As for the slice, assuming 'splt[2]' is '0.5%sy', t
En Mon, 09 Apr 2007 14:56:03 -0300, Pradnyesh Sawant <[EMAIL PROTECTED]>
escribió:
> Thanks for the pointer to use /proc/stat
> However, that does not answer my other question about string slicing
> Any pointers in that direction would be helpful...
>
>> > top = os.popen("top -n 1")
>> > rd = to
Thanks for the pointer to use /proc/stat
However, that does not answer my other question about string slicing
Any pointers in that direction would be helpful...
Thanks a lot!
On 4/9/07, Jeff McNeil <[EMAIL PROTECTED]> wrote:
> Can you pull the same information from /proc/stat as opposed to using
Can you pull the same information from /proc/stat as opposed to using
a pipe to top? The first line(s) should contain (at least):
cpu usermode, lowprio, system, idle, hz.
The 2.6 kernel adds iowait, irq, and soft irq. It seems that this
might be a better solution than executing that additional c
Hello,
I need the cpu usage of a linux box, for which i capture the output of
"top" using "popen". However, i am facing problems during string
handling. The code snippet is:-
top = os.popen("top -n 1")
rd = top.read().split("\n")
splt = rd[2].split()
# cpu = splt[2][:-4] # why ain't this working