这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Conversation

@kylebrandt
Copy link
Member

This mimics the free command: "cache Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)"

This mimics the free command: "cache Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)"
@kylebrandt
Copy link
Member Author

Add(&md, osMemTotal, int(mem["MemTotal"])*1024, nil, metadata.Gauge, metadata.Bytes, osMemTotalDesc)
Add(&md, osMemFree, (int(mem["MemFree"])+int(mem["Buffers"])+int(mem["Cached"]))*1024, nil, metadata.Gauge, metadata.Bytes, osMemFreeDesc)
Add(&md, osMemUsed, (int(mem["MemTotal"])-(int(mem["MemFree"])+int(mem["Buffers"])+int(mem["Cached"])))*1024, nil, metadata.Gauge, metadata.Bytes, osMemUsedDesc)
bufferCacheSlab := mem["Buffers"] + mem["Cached"] + mem["Slab"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of repetition of mem["stringConstant"] here. Would it make sense to define a few variables and reuse them?

@kylebrandt kylebrandt merged commit 98f88d6 into master May 16, 2018
@kylebrandt kylebrandt deleted the linux_mem branch June 28, 2018 12:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants