Re: How do you accurately determine a process' RAM usage?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mauricio Lin wrote:
Hi Brady,

On 7/20/05, [email protected] <[email protected]> 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
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux