Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Using Perl to find Process Hogs

by Octavian (Monk)
on Apr 17, 2003 at 18:50 UTC ( [id://251292]=note: print w/replies, xml ) Need Help??


in reply to Re: Using Perl to find Process Hogs
in thread Using Perl to find Process Hogs

What operating system does this work on? -eo, or at least o is not a valid option with ps on our HPUX 11 machine... I actually did explore with ps a bit, and ps -fl or even -ef does give CPU as one of the columns, but the number it gives doesnt make sense to me...our top proccess is taking up about 11% right now, but that number shows 112...so that confused me more than helped, so I gave up on ps ;)

and to answer your update, yes, more than one proc can have 75% of a CPU, my test box has 2 CPU's, but this will eventually go on machines with 6 ;)
  • Comment on Re: Re: Using Perl to find Process Hogs

Replies are listed 'Best First'.
Re (3): Using Perl to find Process Hogs
by VSarkiss (Monsignor) on Apr 17, 2003 at 18:58 UTC

    The TIME CPU column is the total CPU time accumulated by the process. You have to be careful what you mean by "75% of the CPU", because you need to quantify that by saying "over how long of a period". I'm assuming you're going to use some number of seconds or minutes. Thus you would calculate the CPU usage for that period by subtracting the total times for any process that's still running between the two times that you looked, then get the percentage by dividing over the time period you're using.

    Notice this implies your CPU hogs are also long-running. In other words, a CPU-intensive process that goes away in a less than a minute may not register, though your users may still complain about a momentary lack of response.

    Yes, this isn't precise, but it's good enough for government work. ;-)

    Update
    Mislabelled the column name.

Re: Re: Re: Using Perl to find Process Hogs
by perlplexer (Hermit) on Apr 17, 2003 at 18:55 UTC
    According to 'man ps', -o, and many othe useful options, only work on XPG4 (X/Open Portability Guide v4) compatible boxes...

    --perlplexer
Re: Re: Re: Using Perl to find Process Hogs
by dmitri (Priest) on Apr 17, 2003 at 18:55 UTC
    Six processors... sweet!

    The ps command I'm talking about works on Linux. Of course, Linux's ps supports both BSD and SVR4-type options. On my box, -o lets user specify the columns of output.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-19 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found