memory

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ReadMemInterval = 300 * time.Millisecond

ReadMemInterval controls the interval to read memory stats.

Variables

View Source
var (
	ServerMemoryLimitOriginText  = atomicutil.NewString("0")
	ServerMemoryLimit            = atomicutil.NewUint64(0)
	ServerMemoryLimitSessMinSize = atomicutil.NewUint64(128 << 20)

	QueryForceDisk       = atomicutil.NewInt64(0)
	TriggerMemoryLimitGC = atomicutil.NewBool(false)
	MemoryLimitGCLast    = atomicutil.NewTime(time.Time{})
	MemoryLimitGCTotal   = atomicutil.NewInt64(0)
)

Process global variables for memory limit.

View Source
var MemTotal func() (uint64, error)

MemTotal returns the total amount of RAM on this system

View Source
var MemUsed func() (uint64, error)

MemUsed returns the total used amount of RAM on this system

Functions

func ForceReadMemStats

func ForceReadMemStats() *runtime.MemStats

ForceReadMemStats is to force read memory stats.

func GetMemTotalIgnoreErr

func GetMemTotalIgnoreErr() uint64

GetMemTotalIgnoreErr returns the total amount of RAM on this system/container. If error occurs, return 0.

func InstanceMemUsed

func InstanceMemUsed() (uint64, error)

InstanceMemUsed returns the memory usage of this process

func MemTotalCGroup

func MemTotalCGroup() (uint64, error)

MemTotalCGroup returns the total amount of RAM on this system in container environment.

func MemTotalNormal

func MemTotalNormal() (uint64, error)

MemTotalNormal returns the total amount of RAM on this system in non-container environment.

func MemUsedCGroup

func MemUsedCGroup() (uint64, error)

MemUsedCGroup returns the total used amount of RAM on this system in container environment.

func MemUsedNormal

func MemUsedNormal() (uint64, error)

MemUsedNormal returns the total used amount of RAM on this system in non-container environment.

func ReadMemStats

func ReadMemStats() (memStats *runtime.MemStats)

ReadMemStats read the mem stats from runtime.ReadMemStats

Types

This section is empty.

Jump to

Keyboard shortcuts

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