All of lore.kernel.org
 help / color / mirror / Atom feed
From: P@draigBrady.com
To: Mauricio Lin <mauriciolin@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: How do you accurately determine a process' RAM usage?
Date: Wed, 20 Jul 2005 16:48:25 +0100	[thread overview]
Message-ID: <42DE7249.6090102@draigBrady.com> (raw)
In-Reply-To: <3f250c7105072008321c128deb@mail.gmail.com>

Mauricio Lin wrote:
> Hi Brady,
> 
> On 7/20/05, P@draigbrady.com <P@draigbrady.com> wrote:
> 
>>The following shell gets the shared values for the
>>first httpd process:
>>
>>FIRST_HTTPD=`ps -C httpd -o pid= | head -1 | tr -d ' '`
>>HTTPD_STATM_SHARED=$(expr 4 '*' `cut -f3 -d' ' /proc/$FIRST_HTTPD/statm`)
>>HTTPD_SMAPS_SHARED=$(grep Shared /proc/$FIRST_HTTPD/smaps | tr -s ' '
>>| cut -f2 -d' ' | ( tr '\n' +; echo 0 ) | bc)
>>
>>
>>This shows that "smaps" reports 3060 KB more shared mem than "statm".
>>However adding up all the anon sections in smaps only gives 2456 KB?
> 
> 
> You are adding up all Shared_Clean and Shared_Dirty as Shared, right?

yes. Look at the command I posted.

>>When doing this I also noticed that there are duplicate
>>entries in smaps. Any ideas why?
> 
> 
> Each pair of address per line indicates the start and end address of a
> memory area (VMA) such as:
> 
> b7f7d000-b7f7e000 
> 
> This means that an specific memory area start on virtual address 
> b7f7d000 and end on b7f7e000 .
> 
> An mapped file like /lib/ld-2.3.3.so is organized in different memory
> areas. The memory area can be a text section, data section or bss. So
> it is normal you find the same filename mapped in more than one memory
> area.

yes. Look at the command I posted.
There are multiple entries with the _same addresses_

>>grep -F - /proc/$FIRST_HTTPD/smaps | sort | uniq -d -c

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

      reply	other threads:[~2005-07-20 15:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-06 18:55 How do you accurately determine a process' RAM usage? P
2005-07-07  1:16 ` 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 [this message]

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=42DE7249.6090102@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mauriciolin@gmail.com \
    /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.