Help us shape the future of Go! Take the 2026 Go Developer Survey

memory

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2016 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package memory provides sanatized information about for Linux Memory - http://superuser.com/questions/521551/cat-proc-meminfo-what-do-all-those-numbers-mean - https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-proc-meminfo.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory struct {
	// Unit is the metric used for all the numbers returned. E.g. kb, mb, gb.
	Unit string

	// Physical memory statistics of the machine.
	Physical struct {
		// Total is the total physical memory of the system.
		Total int64
		// Free is the free physical memory in the system.
		Free int64
		// Used physical memory of the system.
		Used int64
		// Cached is the physical memory that is used for cache.
		Cached int64
		// Buffers is the amount of memory used for file buffers.
		Buffers int64
		// TotalFree is Free memory + Used + Cached which is the real
		// amount of memory that Linux has available
		TotalFree int64
	}

	// Swap is information on swap usage on the system.
	Swap struct {
		// Total swap that is available.
		Total int64
		// Free swap space.
		Free int64
		// Used swap space.
		Used int64
		// Cached is space used for cache
		Cached int64
	}

	// Virtual is the virtual memory used by the machine.
	Virtual struct {
		// Total virtual memory that has been allocated.
		Total int64
		// Used virtual memory.
		Used int64
		// Chunk is the largest chunk that is being used.
		Chunk int64
	}

	// Dirty is the memory waiting to be written back to disk.
	Dirty int64
	// Writeback is the memory currently being written back to disk.
	Writeback int64
	// Mapped is memory used my mmap files.
	Mapped int64
}

Memory returns the memory usage of the system.

func New

func New() *Memory

New returns a Memory object representing system memory information.

type ProcessMemory

type ProcessMemory struct {
	// Swap usage of the Process
	Swap struct {
		// Size of the swap used
		Size int64
		// Unit metric used
		Unit string
	}
}

ProcessMemory returns memory usage of a Process

func NewProcess

func NewProcess(proc procfs.Proc) *ProcessMemory

NewProcess returns memory information of a Linux Process

Jump to

Keyboard shortcuts

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