From: P@draigBrady.com
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: How do you accurately determine a process' RAM usage?
Date: Wed, 06 Jul 2005 19:55:31 +0100 [thread overview]
Message-ID: <42CC2923.2030709@draigBrady.com> (raw)
I wrote a tool 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
--
next reply other threads:[~2005-07-06 22:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-06 18:55 P [this message]
2005-07-07 1:16 ` How do you accurately determine a process' RAM usage? Andrew Morton
2005-07-07 8:26 ` P
2005-07-07 8:40 ` Andrew Morton
2005-07-07 10:42 ` Hugh Dickins
2005-07-12 9:44 ` P
2005-07-19 20:09 ` Mauricio Lin
2005-07-20 14:34 ` P
2005-07-20 15:32 ` Mauricio Lin
2005-07-20 15:48 ` P
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42CC2923.2030709@draigBrady.com \
--to=p@draigbrady.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.