memory

package
v0.0.0-...-87c4152 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

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

func Format(m uint64) string

Format formats a memory value for humans. It uses a B, K, M or G suffix and rounds to two decimal places.

func ReadCgroupStats

func ReadCgroupStats() (map[string]uint64, error)

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

func ReadRuntimeStats() runtime.MemStats

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL