* How do you accurately determine a process RAM usage
@ 2005-07-06 22:07 P
0 siblings, 0 replies; only message in thread
From: P @ 2005-07-06 22:07 UTC (permalink / raw)
To: linux-kernel
I wrote a tool to (try to) report how much RAM a
particular program (apache for e.g.) was using:
http://www.pixelbeat.org/scripts/ps_mem.py
I was then pointed at the following:
http://wiki.apache.org/spamassassin/TopSharedMemoryBug
which describes how copy-on-write pages are
not counted as shared since 2.6.
So how can one determine how much RAM a process is using?
Seems like a fundamental requirement to me.
Could we add a "SharedTotal" column to /proc/$$/statm for e.g. ?
Here's a little python script to demo the problem:
#!/usr/bin/python
import os, sys, time
a="\x00"*(32*1024*1024) #alloc 32MiB
pid=os.fork()
if(not pid):
time.sleep(1)
sys.exit()
sizel=map(float,open("/proc/"+str(pid)+"/statm").readlines()[0].split()[1:3])
print "only %.1f%% reported as shared" % ((sizel[1]/sizel[0])*100)
os.wait()
--
Pádraig Brady - http://www.pixelbeat.org
--
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-07-06 22:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-06 22:07 How do you accurately determine a process RAM usage P
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox