memory

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 19 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// DEPRECATED: Please use CacheTypeUnified
	CACHE_TYPE_UNIFIED = CacheTypeUnified
	// DEPRECATED: Please use CacheTypeUnified
	CACHE_TYPE_INSTRUCTION = CacheTypeInstruction
	// DEPRECATED: Please use CacheTypeUnified
	CACHE_TYPE_DATA = CacheTypeData
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Area added in v0.9.0

type Area struct {
	TotalPhysicalBytes int64 `json:"total_physical_bytes"`
	TotalUsableBytes   int64 `json:"total_usable_bytes"`
	// An array of sizes, in bytes, of memory pages supported in this area
	SupportedPageSizes []uint64  `json:"supported_page_sizes"`
	Modules            []*Module `json:"modules"`
}

Area describes a set of physical memory on a host system. Non-NUMA systems will almost always have a single memory area containing all memory the system can use. NUMA systems will have multiple memory areas, one or more for each NUMA node/cell in the system.

func AreaForNode added in v0.9.0

func AreaForNode(ctx *context.Context, nodeID int) (*Area, error)

func (*Area) String added in v0.9.0

func (a *Area) String() string

String returns a short string with a summary of information for this memory area

type Cache

type Cache struct {
	// Level is a 1-based numeric level that indicates the relative closeness
	// of this cache to processing cores on the physical package. Lower numbers
	// are "closer" to the processing cores and therefore have faster access
	// times.
	Level uint8 `json:"level"`
	// Type indicates what type of memory is stored in the cache. Can be
	// instruction (executable bytecodes), data or both.
	Type CacheType `json:"type"`
	// SizeBytes indicates the size of the cache in bytes.
	SizeBytes uint64 `json:"size_bytes"`
	// The set of logical processors (hardware threads) that have access to
	// this cache.
	LogicalProcessors []uint32 `json:"logical_processors"`
}

Cache contains information about a single memory cache on a physical CPU package. Caches have a 1-based numeric level, with lower numbers indicating the cache is "closer" to the processing cores and reading memory from the cache will be faster relative to caches with higher levels. Note that this has nothing to do with RAM or memory modules like DIMMs.

func CachesForNode

func CachesForNode(ctx *context.Context, nodeID int) ([]*Cache, error)

func (*Cache) String

func (c *Cache) String() string

type CacheType

type CacheType int

CacheType indicates the type of memory stored in a memory cache.

const (
	// CacheTypeUnified indicates the memory cache stores both instructions and
	// data.
	CacheTypeUnified CacheType = iota
	// CacheTypeInstruction indicates the memory cache stores only instructions
	// (executable bytecode).
	CacheTypeInstruction
	// CacheTypeData indicates the memory cache stores only data
	// (non-executable bytecode).
	CacheTypeData
)

func (CacheType) MarshalJSON

func (a CacheType) MarshalJSON() ([]byte, error)

NOTE(jaypipes): since serialized output is as "official" as we're going to get, let's lowercase the string output when serializing, in order to "normalize" the expected serialized output

func (CacheType) String

func (a CacheType) String() string

func (*CacheType) UnmarshalJSON added in v0.9.0

func (a *CacheType) UnmarshalJSON(b []byte) error

type Info

type Info struct {
	Area
	// contains filtered or unexported fields
}

Info contains information about the memory on a host system.

func New

func New(opts ...*option.Option) (*Info, error)

New returns an Info struct that describes the memory on a host system.

func (*Info) JSONString

func (i *Info) JSONString(indent bool) string

JSONString returns a string with the memory information formatted as JSON under a top-level "memory:" key

func (*Info) String

func (i *Info) String() string

String returns a short string with a summary of memory information

func (*Info) YAMLString

func (i *Info) YAMLString() string

YAMLString returns a string with the memory information formatted as YAML under a top-level "memory:" key

type Module

type Module struct {
	Label        string `json:"label"`
	Location     string `json:"location"`
	SerialNumber string `json:"serial_number"`
	SizeBytes    int64  `json:"size_bytes"`
	Vendor       string `json:"vendor"`
}

Module describes a single physical memory module for a host system. Pretty much all modern systems contain dual in-line memory modules (DIMMs).

See https://en.wikipedia.org/wiki/DIMM

type SortByCacheLevelTypeFirstProcessor

type SortByCacheLevelTypeFirstProcessor []*Cache

func (SortByCacheLevelTypeFirstProcessor) Len

func (SortByCacheLevelTypeFirstProcessor) Less

func (SortByCacheLevelTypeFirstProcessor) Swap

type SortByLogicalProcessorId

type SortByLogicalProcessorId []uint32

func (SortByLogicalProcessorId) Len

func (a SortByLogicalProcessorId) Len() int

func (SortByLogicalProcessorId) Less

func (a SortByLogicalProcessorId) Less(i, j int) bool

func (SortByLogicalProcessorId) Swap

func (a SortByLogicalProcessorId) Swap(i, j int)

Jump to

Keyboard shortcuts

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