Documentation ¶
Overview ¶
Package memory provides functions to collect memory information from a variety of places.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format formats a memory value for humans. It uses a B, K, M or G suffix and rounds to two decimal places.
func ReadCgroupStats ¶
ReadCgroupStats reads memory information for the current cgroup. (A cgroup is the sandbox in which a docker container runs.) All values are in bytes.
func ReadRuntimeStats ¶
ReadRuntimeStats is a convenience for runtime.ReadMemStats.
Types ¶
type ProcessStats ¶
type ProcessStats struct { VSize uint64 // virtual memory size RSS uint64 // resident set size (physical memory in use) }
ProcessStats holds values that describe the current process's memory. All values are in bytes.
func ReadProcessStats ¶
func ReadProcessStats() (ProcessStats, error)
ReadProcessStats reads memory stats for the process.
type SystemStats ¶
type SystemStats struct { Total uint64 Free uint64 Available uint64 Used uint64 Buffers uint64 Cached uint64 }
SystemStats holds values from the /proc/meminfo file, which describes the total system memory. All values are in bytes.
func ReadSystemStats ¶
func ReadSystemStats() (SystemStats, error)
ReadSystemStats reads the /proc/meminfo file to get information about the machine.