我们如何通过总结进程占用的内存和linux中的可用内存来达到RAM大小? [英] how we can reach at RAM size by summing up the memory occupied by processes and free memory in linux?
问题描述
我想知道如何计算总RAM,如何通过汇总"cat proc/meminfo"命令的输出来达到RAM大小
Memtotal = MemFree +?...........
任何人都可以帮助
您需要一个将共享内存考虑在内的工具.
例如 smem :
# smem -t
PID User Command Swap USS PSS RSS
...
10593 root /usr/lib/chromium-browser/c 0 22868 26439 49364
11500 root /usr/lib/chromium-browser/c 0 22612 26486 49732
10474 browser /usr/lib/chromium-browser/c 0 39232 43806 61560
7777 user /usr/lib/thunderbird/thunde 0 89652 91118 102756
-------------------------------------------------------------------------------
118 4 40364 594228 653873 1153092
PSS
是有趣的一列,因为它考虑了共享内存(将RSS
加在一起将导致对共享内存段进行多次计数,因此不会累加数字).
因此,用户层进程在这里总共占用654Mb.
# smem -tw
Area Used Cache Noncache
firmware/hardware 0 0 0
kernel image 0 0 0
kernel dynamic memory 345784 297092 48692
userspace memory 654056 181076 472980
free memory 15828 15828 0
----------------------------------------------------------
1015668 493996 521672
346Mb被内核使用,并且有16Mb的空闲空间.
总体上,大约一半的内存用于缓存(494Mb).
因此1Gb的 RAM总数 = 654Mb的 userland进程,按上述方式分解 + 346Mb的 kernel mem + 16Mb的 free >
(提供或占用几Mb)
I want to know to how to calculate total RAM, how we can reach at RAM size by summing up the output of "cat proc/meminfo" command
Memtotal = MemFree+?...........
any one can help
You need a tool that takes shared memory into account to do this.
For example, smem:
# smem -t
PID User Command Swap USS PSS RSS
...
10593 root /usr/lib/chromium-browser/c 0 22868 26439 49364
11500 root /usr/lib/chromium-browser/c 0 22612 26486 49732
10474 browser /usr/lib/chromium-browser/c 0 39232 43806 61560
7777 user /usr/lib/thunderbird/thunde 0 89652 91118 102756
-------------------------------------------------------------------------------
118 4 40364 594228 653873 1153092
PSS
is the interesting column here because it takes shared memory into account (adding RSS
together will result in shared mem segments being counted multiple times so numbers won't add up).
So userland processes take up 654Mb total here.
# smem -tw
Area Used Cache Noncache
firmware/hardware 0 0 0
kernel image 0 0 0
kernel dynamic memory 345784 297092 48692
userspace memory 654056 181076 472980
free memory 15828 15828 0
----------------------------------------------------------
1015668 493996 521672
346Mb is used by the kernel and there's 16Mb free.
Overall about half of memory is used for cache (494Mb).
So 1Gb RAM total = 654Mb userland processes, broken up as above + 346Mb kernel mem + 16Mb free
(give or take a few Mb)
这篇关于我们如何通过总结进程占用的内存和linux中的可用内存来达到RAM大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!