Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: How to limit CPU utilization by ANY process with a perl script?

by Lawliet (Curate)
on Feb 24, 2009 at 01:45 UTC ( #745875=note: print w/ replies, xml ) Need Help??


in reply to Re: How to limit CPU utilization by ANY process with a perl script?
in thread How to limit CPU utilization by ANY process with a perl script?

Hmm, I think I might be misunderstanding what your one-liner is doing, but isn't the fourth element of @F %MEM, not %CPU?

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND marc 9764 0.0 1.9 85544 40380 ? S 15:47 0:07 pidgin
$ ps aux | perl -lane 'print if $F[3] == 1.9' marc 9764 0.0 1.9 85500 40376 ? S 15:47 0:07 pidgin

And you didn't even know bears could type.


Comment on Re^2: How to limit CPU utilization by ANY process with a perl script?
Select or Download Code
Re^3: How to limit CPU utilization by ANY process with a perl script?
by bichonfrise74 (Vicar) on Feb 24, 2009 at 04:25 UTC
    That's true. In my case, the 4th element is for the CPU. I guess ps gives a different output depending on your Linux flavor.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://745875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2014-08-02 05:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (54 votes), past polls