Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

djberg96 (2603)

  (email not shown publicly)

Journal of djberg96 (2603)

Thursday November 07, 2002
11:30 PM

Cheaters never win

[ #8830 ]
I admit it. I broke down. I got lazy. For the one portion I hadn't finished I was going to capture the output of a ps system call for my Top module using popen (in C, that is) and no one would be the wiser. The original plan was going to be "ps -e -o 'pcpu, field2, etc' | grep -v COMMAND | sort -rn".

Much to my chagrin, the Linux version of the top command doesn't support the -o option on the command line. Seems the top interface isn't consistent across platforms. So much for that plan. Guess I'll have to do it the hard way - loop through all the processes and manually calculate which processes are the "top" ones.

Damn. Serves me right, I guess.

Update: As one side benefit to playing with this so much, I've determined that there's a bug in my version of top. Some of the SIZE values are incorrect - they're often reported as the same size as RSS, which shouldn't happen.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • You should be using the XML::RSS module. You can't parse those values by hand, you silly rabbit!

    (This post brought to you by the Kneejerk Perl Module Recommendation Squad -- we skim your post for keywords so you don't have to!)