[ILUG] memory listing tool ?
P at draigBrady.com
P at draigBrady.com
Tue Feb 24 16:09:00 GMT 2004
John P. Looney wrote:
> On Tue, Feb 24, 2004 at 02:23:17PM +0000, P at draigBrady.com mentioned:
>
>>John P. Looney wrote:
>>
>>>Is there a good tool out there for telling you what each app is using ?
>>>
>>>Tools like "gtop", which just tot up the RSS values for each process type
>>>tells me one box, with a gig of RAM in it, is using 17GB of RAM.
>>
>>Does top not work?
>>M to sort by mem
>>H to toggle threads on and off
>
>
> No, not really. 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.
>
> john
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])
--
Pádraig Brady - http://www.pixelbeat.org
--- Following generated by rotagator ---
Changing priority of a process
The nice value (-20 to 19) represents the priority of a process.
The lower the value, the higher the priority. On a multi user
system consider running non interactive processes like:
nice low_priority_command
You can retroactively give a process less priority like:
renice 20 low_priority_pid
Root can give processes more priority.
--
More information about the ILUG
mailing list