Cheaters never win

djberg96 on 2002-11-08T04:30:17

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.


RSS, huh?

chromatic on 2002-11-08T18:30:24

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!)