resctrl

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RdtInfo is global immutable variable
	RdtInfo *map[string]*RdtCosInfo
	// SysResctrl is the absolute path to the root of the Intel RDT "resource control" filesystem
	SysResctrl string
)

variables that can be accessed from the outside of package

Functions

func DestroyResAssociation

func DestroyResAssociation(group string) error

DestroyResAssociation removes resource group

func DisableRdt

func DisableRdt() bool

DisableRdt unmount resctrl

func EnableCat

func EnableCat() bool

EnableCat mounts resctrl

func EnableCdp

func EnableCdp() bool

EnableCdp mounts resctrl with option -o

func GetNumOfCLOS

func GetNumOfCLOS(getL3Clos, getMbaClos bool) (int, error)

GetNumOfCLOS returns number COSes for L3 Cache, MBA or both depending on input params If both L3 Cache and MBA selected function returns lower of two values

func GetRdtCosInfo

func GetRdtCosInfo() map[string]*RdtCosInfo

GetRdtCosInfo gives RDT info access the resctrl need flock to avoid race with other agent. Go does not support flock lib. That need cgo, please ref: https://gist.github.com/ericchiang/ce0fdcac5659d0a80b38 now we can use lib/flock/flock.go

func GetResAssociation

func GetResAssociation(availableCLOS []string) map[string]*ResAssociation

GetResAssociation returns all resource groups access the resctrl need flock to avoid race with other agent. Go does not support flock lib. That need cgo, please ref: https://gist.github.com/ericchiang/ce0fdcac5659d0a80b38 now we can use lib/flock/flock.go

func Init

func Init() error

Init does config initial

func IsIntelRdtMounted

func IsIntelRdtMounted() bool

IsIntelRdtMounted give true/false of RDT mounted or not

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns if notfound error happened

func NewNotFoundError

func NewNotFoundError(res string) error

NewNotFoundError returns new error of NotFoundError

func RemoveTasks

func RemoveTasks(tasks []string) error

RemoveTasks move tasks to default resctrl group Resctrl doesn't support remove tasks from sysfs, the way to remove tasks from resource group is to move them to default group

Types

type CPUsTask

type CPUsTask struct {
	Task
}

CPUsTask is the CPU task

func (CPUsTask) Rollback

func (t CPUsTask) Rollback() error

Rollback dos nothing for now

func (CPUsTask) Run

func (t CPUsTask) Run() error

Run to write CPU mask

type CacheCos

type CacheCos struct {
	ID   uint8
	Mask string
}

CacheCos is the COS of a cache

type GroupTask

type GroupTask struct {
	Task
}

GroupTask is task to create new group

func (GroupTask) Rollback

func (t GroupTask) Rollback() error

Rollback remove created resrouce group

func (GroupTask) Run

func (t GroupTask) Run() error

Run to create new resource group

type MbaCos

type MbaCos struct {
	ID  uint8
	Mba uint32
}

MbaCos is the COS of a cache

type NotFoundError

type NotFoundError struct {
	ResourceControl string
}

NotFoundError represents not found error

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type RdtCosInfo

type RdtCosInfo struct {
	CbmMask    string
	MinCbmBits int
	NumClosids int
}

RdtCosInfo is from /sys/fs/resctrl/info

type ResAssociation

type ResAssociation struct {
	Tasks         []string
	CPUs          string
	CacheSchemata map[string][]CacheCos
	MbaSchemata   map[string][]MbaCos
}

ResAssociation is the resource group in resctrl TODO need to paser the tag for field setting.

func NewResAssociation

func NewResAssociation() *ResAssociation

NewResAssociation gives new empty ResAssociation

type SchemataTask

type SchemataTask struct {
	Task
}

SchemataTask is the task to create schemata

func (SchemataTask) Rollback

func (t SchemataTask) Rollback() error

Rollback to revert it

func (SchemataTask) Run

func (t SchemataTask) Run() error

Run to commit schemata

type Task

type Task struct {
	TaskName string
	*ResAssociation
	RessSnapshot map[string]*ResAssociation
	Group        string
	Path         string
	Revert       bool // whether need to Revert after task faild
}

Task is task for resctrl

func (Task) Name

func (t Task) Name() string

Name returns name of the task

func (Task) Rollback

func (t Task) Rollback() error

Rollback task

func (Task) Run

func (t Task) Run() error

Run starts the task

type TasksTask

type TasksTask struct {
	Task
}

TasksTask is the task for add tasks

func (TasksTask) Rollback

func (t TasksTask) Rollback() error

Rollback tasks

func (TasksTask) Run

func (t TasksTask) Run() error

Run add tasks

Jump to

Keyboard shortcuts

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