LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] memory listing tool ?

[ILUG] memory listing tool ?

P at draigBrady.com P at draigBrady.com
Tue Jul 5 16:40:04 IST 2005


P at draigBrady.com wrote:
> John P. Looney wrote:
> 
>> Is there a good tool out there for telling you what each app is using ?
>> For instance, say apache has 250 processes...I want to
>> know how much memory is being used by apache vs. by MySQL and it's 100 
>> odd threads.
> 
> Ah you want to combine process counts and ignored
> multiple thread listsings. Is this of any use?
> 
> #!/usr/bin/env python
> #This scripts assumes threads are already merged by ps
> 
> import sys, os
> 
> cmds={}
> for line in os.popen("ps -Al | tr -s ' ' | cut -d' ' -f10,14 | sed 1d | 
> sort -k1,1n").readlines():
>     size, cmd = line.split()
>     cmds[cmd]=cmds.setdefault(cmd,0)+int(size)
> 
> sort_list = cmds.items()
> sort_list.sort(lambda x,y:cmp(x[1],y[1]))
> 
> for cmd in sort_list:
>     print "%20s %s" % (cmd[0], cmd[1])

Well 16 months and 1 job later I'm not sure you'd
appreciate an update :-) But I needed this myself so...

The previous was less than useful as it counted the
virtual size and didn't handle shared mem at all.

This script should be a lot more accurate:

http://www.pixelbeat.org/scripts/ps_mem.py

-- 
Pádraig Brady - http://www.pixelbeat.org
--



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell