Re: output of top on a linux box

2007-04-13 Thread Pradnyesh Sawant
> 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

Re: output of top on a linux box

2007-04-09 Thread Jeff McNeil
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

Re: output of top on a linux box

2007-04-09 Thread Gabriel Genellina
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

Re: output of top on a linux box

2007-04-09 Thread Pradnyesh Sawant
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

Re: output of top on a linux box

2007-04-09 Thread Jeff McNeil
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

output of top on a linux box

2007-04-09 Thread Pradnyesh Sawant
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