MemTotal: 2034284 kBMemFree: 1432728 kBBuffers: 16568 kBCached: 324864 kBSwapCached: 0 kBActive: 307344 kBInactive: 256916 kBActive(anon): 223020 kBInactive(anon): 74372 kBActive(file): 84324 kBInactive(file): 182544 kBUnevictable: 0 kBmlocked: 0 kBHighTotal: 1152648 kBHighFree: 600104 kBLowTotal: 881636 kBLowFree: 832624 kBSwapTotal: 4200960 kBSwapFree: 4200960 kBDirty: 60 kBWriteback: 0 kBAnonPages: 222868 kBMapped: 80596 kBShmem: 74564 kBSlab: 24268 kBSReclaimable: 14024 kBSUnreclaim: 10244 kBKernelStack: 1672 kBPagetables: 2112 kBNFS_Unstable: 0 kBBounce: 0 kBWritebackTmp: 0 kBCommitlimit: 5218100 kBCommitted_AS: 833352 kBVmallocTotal: 122880 kBVmallocUsed: 13916 kBVmallocChunk: 50540 kBHugePages_Total: 0HugePages_Free: 0HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 4096 kBDirectMap4k: 20472 kBDirectMap4M: 888832 kB
我有一个公式来计算Memtotal:
Memtotal = MemFree Cached Active Inactive Mapped Shmem Slab Pagetables VmallocUsed
但我不知道公式是否正确,任何人都可以帮助澄清它?
解决方法 我认为很难达到meminfo的确切值(基于总内存验证的加法).尽管如此,在我看来,接下来应该会让你接近TotalMemory数字.
TotalMemory = MemFree Buffers Cached Dirty AnonPages Slab VmAllocUsed
在您的示例中
1432728 16568 324864 60 222868 24268 13916 = 2035272
一些参考:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/proc.txt?id=HEAD#l451(来自上面建议的另一个stackoverflow文章)除此之外,我认为波动是因为VmAllocUsed.
以上是内存溢出为你收集整理的linux-kernel – 如何在/ proc / meminfo中计算MemTotal全部内容,希望文章能够帮你解决linux-kernel – 如何在/ proc / meminfo中计算MemTotal所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)