cache

package
v0.2.2-0...-aec2f31 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SysCPUPath is patch of cpu device
	SysCPUPath = "/sys/devices/system/cpu/"
	// MaxMBAPercentage max value for MBA in percentage mode (just 100%)
	MaxMBAPercentage = 100
	// MaxMBAMbps max value for MBA in controller (mbps) mode
	MaxMBAMbps = 4294967290
)
View Source
const (
	// OS is os resource group name
	OS = "os"
	// Infra is infra resource group name
	Infra = "infra"
	// Guarantee is guarantee resource group name
	Guarantee = "guarantee"
	// Besteffort is besteffort resource group name
	Besteffort = "besteffort"
	// Shared is shared resource group name
	Shared = "shared"
)

Variables

View Source
var ReservedInfo map[string]*Reserved

ReservedInfo is all reserved resource group information

View Source
var SizeMap = map[string]uint32{
	"K": 1024,
	"M": 1024 * 1024,
}

SizeMap is the map to bits of unit

Functions

func AvailableCacheLevel

func AvailableCacheLevel() ([]string, error)

AvailableCacheLevel returns the L2 and L3 level cache, strip L1 cache. By default, get the info from cpu0 path, any issue? The type of return should be string or int?

func BitmapsCPUWrapper

func BitmapsCPUWrapper(cpuids interface{}) (*util.Bitmap, error)

BitmapsCPUWrapper is a wrapper for Bitmap

func BitmapsCacheWrapper

func BitmapsCacheWrapper(bitmask interface{}) (*util.Bitmap, error)

BitmapsCacheWrapper is a wrapper for Cache bitmap

func Get

func Get(request *restful.Request, response *restful.Response)

Get handles GET /v1/cache

func GetAvailableCacheSchemata

func GetAvailableCacheSchemata(allres map[string]*resctrl.ResAssociation,
	ignoreGroups []string,
	pool string,
	cacheLevel string) (map[string]*libutil.Bitmap, error)

GetAvailableCacheSchemata returns available schemata of caches from specific pool: guarantee, besteffort, shared or just none

func GetCPUPools

func GetCPUPools() (map[string]map[string]*util.Bitmap, error)

GetCPUPools is helper function to get Reserved CPUs

func GetCachePoolLayout

func GetCachePoolLayout() (map[string]*Reserved, error)

GetCachePoolLayout returns cache pool layout based on configuration

func GetCachePoolName

func GetCachePoolName(MaxWays, MinWays uint32) (string, error)

GetCachePoolName will return pool name based on MaxCache, MinCache

func GetLLC

func GetLLC() uint32

GetLLC return the last level of the cache on the host

func GetReservedInfo

func GetReservedInfo() map[string]*Reserved

GetReservedInfo returns all reserved information

func GetSpecifiedCache

func GetSpecifiedCache(request *restful.Request, response *restful.Response)

GetSpecifiedCache handles GET /v1/cache/l[2, 3]/{id}

func GetSysCaches

func GetSysCaches(level int) (map[string]SysCache, error)

GetSysCaches traverse all sys cache file for a specify level

func LevelGet

func LevelGet(request *restful.Request, response *restful.Response)

LevelGet handles GET /v1/cache/l[2|3|lc]

func Register

func Register(prefix string, container *restful.Container)

Register handlers

func SetInfraGroup

func SetInfraGroup() error

SetInfraGroup sets infra resource group based on configuration

func SetOSGroup

func SetOSGroup() error

SetOSGroup sets os group

Types

type CachesSummary

type CachesSummary struct {
	Rdt    bool               `json:"rdt"`
	Cqm    bool               `json:"cqm"`
	Cdp    bool               `json:"cdp"`
	CdpOn  bool               `json:"cdp_enable"`
	Cat    bool               `json:"cat"`
	CatOn  bool               `json:"cat_enable"`
	Caches map[string]Summary `json:"caches"`
}

CachesSummary Cat, Cqm seems CPU's feature. Should be better

type Rdt struct {
	Cat   bool
	CatOn bool
	Cdp   bool
	CdpOn bool
}

func (*CachesSummary) Get

func (c *CachesSummary) Get() error

Get returns summary of cache

type CosInfo

type CosInfo struct {
	CbmMaskLen int
	MinCbmBits int
	NumClosids int
	CbmMask    string
}

CosInfo contains info about Class Of Service

func GetCosInfo

func GetCosInfo() CosInfo

GetCosInfo is Concurrency-safe.

type Info

type Info struct {
	ID                uint32 `json:"cache_id"`
	NumWays           uint32
	NumSets           uint32
	NumPartitions     uint32
	LineSize          uint32
	TotalSize         uint32 `json:"total_size"`
	WaySize           uint32
	NumClasses        uint32
	WayContention     uint64
	CacheLevel        uint32
	Location          string            `json:"location_on_socket"`
	Node              string            `json:"location_on_node"`
	ShareCPUList      string            `json:"share_cpu_list"`
	AvailableWays     string            `json:"available_ways"`
	AvailableCPUs     string            `json:"available_cpus"`
	AvailableIsoCPUs  string            `json:"available_isolated_cpus"`
	AvailablePolicy   map[string]uint32 `json:"available_policy"` // should move out here
	AvailableWaysPool map[string]string `json:"available_ways_pool"`
}

Info is details of cache

type Infos

type Infos struct {
	Num    uint32          `json:"number"`
	Caches map[uint32]Info `json:"Caches"`
}

Infos is group of cache info

func (*Infos) GetByLevel

func (c *Infos) GetByLevel(level uint32) error

GetByLevel returns cache info by cache level

type Reserved

type Reserved struct {
	AllCPUs     *util.Bitmap            //cpu bit mask
	SchemaNum   int                     // Numbers of schema
	Name        string                  // Resource group name if it is a resource group instead of pool
	Schemata    map[string]*util.Bitmap // Schema list
	CPUsPerNode map[string]*util.Bitmap // CPU bitmap
	Quota       uint                    // Max allowed usage for this resource
	Shrink      bool                    // Wether shrink in BE pool
}

Reserved schemata information

func GetInfraGroupReserve

func GetInfraGroupReserve() (Reserved, error)

GetInfraGroupReserve returns reserved infra group NOTE This group can be merged into GetOSGroupReserve

func GetOSGroupReserve

func GetOSGroupReserve() (Reserved, error)

GetOSGroupReserve returns os reserved resource group

type Summary

type Summary struct {
	Num int      `json:"number"`
	IDs []string `json:"caches_id"`
}

Summary is summary of cache

type SysCache

type SysCache struct {
	CoherencyLineSize     string
	ID                    string
	Level                 string
	NumberOfSets          string
	PhysicalLinePartition string
	SharedCPUList         string
	SharedCPUMap          string
	Size                  string
	Type                  string
	WaysOfAssociativity   string
}

SysCache is struct of cache of host

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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