rdt

package
v0.0.0-...-8b8575e Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	L2 cacheLevel = "L2"
	L3 cacheLevel = "L3"
)
View Source
const (
	// RootClassName is the name we use in our config for the special class
	// that configures the "root" resctrl group of the system
	RootClassName = "SYSTEM_DEFAULT"
)

Variables

This section is empty.

Functions

func DiscoverClasses

func DiscoverClasses(resctrlGroupPrefix string) error

DiscoverClasses discovers existing classes from the resctrl filesystem. Makes it possible to discover gropus with another prefix than was set with Initialize(). The original prefix is still used for monitoring groups.

func GetMonFeatures

func GetMonFeatures() map[MonResource][]string

GetMonFeatures returns the available monitoring stats of each available monitoring technology

func Initialize

func Initialize(resctrlGroupPrefix string) error

Initialize discovers RDT support and initializes the rdtControl singleton interface

func MonSupported

func MonSupported() bool

MonSupported returns true if RDT monitoring features are available

func NewCollector

func NewCollector() (prometheus.Collector, error)

NewCollector creates new Prometheus collector of RDT metrics

func RegisterCustomPrometheusLabels

func RegisterCustomPrometheusLabels(names ...string)

RegisterCustomPrometheusLabels registers monitor group annotations to be exported as Prometheus metrics labels

func SetConfig

func SetConfig(c *Config, force bool) error

SetConfig parses new configuration and reconfigures the resctrl filesystem accordingly

func SetLogger

func SetLogger(l Logger)

SetLogger sets the logger instance to be used by the package. This function may be called even before Initialize().

Types

type Bitmask

type Bitmask uint64

Bitmask represents a generic 64 bit wide bitmask

func ListStrToBitmask

func ListStrToBitmask(str string) (Bitmask, error)

ListStrToBitmask parses a string containing a human-readable list of bit numbers into a bitmask

func (Bitmask) ListStr

func (b Bitmask) ListStr() string

ListStr prints the bitmask in human-readable format, similar to e.g. the cpuset format of the Linux kernel

func (Bitmask) MarshalJSON

func (b Bitmask) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface of "encoding/json"

type Config

type Config struct {
	Options    Options `json:"options"`
	Partitions map[string]struct {
		L2Allocation interface{} `json:"l2Allocation"`
		L3Allocation interface{} `json:"l3Allocation"`
		MBAllocation interface{} `json:"mbAllocation"`
		Classes      map[string]struct {
			L2Schema interface{} `json:"l2Schema"`
			L3Schema interface{} `json:"l3Schema"`
			MBSchema interface{} `json:"mbSchema"`
		} `json:"classes"`
	} `json:"partitions"`
}

Config represents the raw RDT configuration data from the configmap

type CtrlGroup

type CtrlGroup interface {
	ResctrlGroup

	// CreateMonGroup creates a new monitoring group under the class.
	CreateMonGroup(name string, annotations map[string]string) (MonGroup, error)

	// DeleteMonGroup deletes a monitoring group from the class.
	DeleteMonGroup(name string) error

	// DeleteMonGroups deletes all monitoring groups.
	DeleteMonGroups() error

	// GetMonGroup returns a specific monitoring group under the class
	GetMonGroup(name string) (MonGroup, bool)

	// GetMonGroups returns all monitoring groups under the class
	GetMonGroups() []MonGroup
}

CtrlGroup defines the interface of one goresctrl managed RDT class

func GetClass

func GetClass(name string) (CtrlGroup, bool)

GetClass returns one RDT class

func GetClasses

func GetClasses() []CtrlGroup

GetClasses returns all available RDT classes

type Logger

type Logger interface {
	Debug(format string, v ...interface{})
	Info(format string, v ...interface{})
	Warn(format string, v ...interface{})
	Error(format string, v ...interface{})
	Panic(format string, v ...interface{})
	Fatal(format string, v ...interface{})
	DebugBlock(prefix, format string, v ...interface{})
	InfoBlock(prefix, format string, v ...interface{})
}

Logger is the logging interface for goresctl

func NewLoggerWrapper

func NewLoggerWrapper(l *stdlog.Logger) Logger

NewLoggerWrapper wraps an implementation of the golang standard intreface into a goresctl specific compatible logger interface

type MonData

type MonData struct {
	L3 MonL3Data
}

MonData contains monitoring stats of one monitoring group

type MonGroup

type MonGroup interface {
	ResctrlGroup

	// Parent returns the CtrlGroup under which the monitoring group exists
	Parent() CtrlGroup

	// GetAnnotations returns the annotations stored to the monitoring group
	GetAnnotations() map[string]string
}

MonGroup represents the interface to a RDT monitoring group

type MonL3Data

type MonL3Data map[uint64]MonLeafData

MonL3Data contains L3 monitoring stats of one monitoring group

type MonLeafData

type MonLeafData map[string]uint64

MonLeafData represents the raw numerical stats from one RDT monitor data leaf

type MonResource

type MonResource string

MonResource is the type of RDT monitoring resource

const (
	// MonResourceL3 is the RDT L3 cache monitor resource
	MonResourceL3 MonResource = "l3"
)

type Options

type Options struct {
	L2 catOptions `json:"l2"`
	L3 catOptions `json:"l3"`
	MB mbOptions  `json:"mb"`
}

Options contains the common settings for all classes

func (Options) Cat

func (o Options) Cat(lvl cacheLevel) catOptions

type ResctrlGroup

type ResctrlGroup interface {
	// Name returns the name of the group
	Name() string

	// GetPids returns the process ids assigned to the group
	GetPids() ([]string, error)

	// AddPids assigns the given process ids to the group
	AddPids(pids ...string) error

	// GetMonData retrieves the monitoring data of the group
	GetMonData() MonData
}

ResctrlGroup is the generic interface for resctrl CTRL and MON groups

Jump to

Keyboard shortcuts

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