isolation

package
v0.0.0-...-b44688a Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanRDTAssingments

func CleanRDTAssingments() (string, error)

CleanRDTAssingments cleans any existing RDT RMID's assignment.

Types

type CPUShares

type CPUShares struct {
	// contains filtered or unexported fields
}

CPUShares defines data needed for CPU controller.

func (*CPUShares) Clean

func (cpu *CPUShares) Clean() error

Clean removes the specified cgroup

func (*CPUShares) Create

func (cpu *CPUShares) Create() error

Create specified cgroup.

func (*CPUShares) Decorate

func (cpu *CPUShares) Decorate(command string) string

Decorate implements Decorator interface

func (*CPUShares) Isolate

func (cpu *CPUShares) Isolate(PID int) error

Isolate associates specified pid to the cgroup.

type Decorator

type Decorator interface {
	Decorate(string) string
}

Decorator allows to decorate launcher output.

func NewNamespace

func NewNamespace(mask int) (Decorator, error)

NewNamespace creates new instance of namespace isolation; see: man 7 namespaces.

type Decorators

type Decorators []Decorator

Decorators represents array of Decorator implementations.

func (Decorators) Decorate

func (d Decorators) Decorate(command string) string

Decorate uses all available decorators to modify the command (and implements Decorator interface).

type IntSet

type IntSet map[int]struct{}

IntSet represents a traditional set type so we can do intersections, joins, etc. on core and memory node ids.

func NewIntSet

func NewIntSet(elems ...int) IntSet

NewIntSet returns a new set containing all of the supplied elements.

func NewIntSetFromRange

func NewIntSetFromRange(rangesString string) (IntSet, error)

NewIntSetFromRange creates a set from traditional cgroup set representation. For example, "0-5,34,46-48"

func (IntSet) Add

func (s IntSet) Add(elem int)

Add mutates this set to include the supplied element.

func (IntSet) AsRangeString

func (s IntSet) AsRangeString() string

AsRangeString returns a traditional cgroup set representation. For example, "0,1,2,3,4,5,34,46,47,48"

func (IntSet) AsSlice

func (s IntSet) AsSlice() []int

AsSlice returns a slice of integers that contains all elements from this set.

func (IntSet) Contains

func (s IntSet) Contains(elem int) bool

Contains returns true if the supplied element is present in this set.

func (IntSet) Difference

func (s IntSet) Difference(t IntSet) IntSet

Difference returns a new set that contains all of the elements that are present in this set and not the supplied set. It does not mutate either set.

func (IntSet) Empty

func (s IntSet) Empty() bool

Empty returns true iff this set has exactly zero elements.

func (IntSet) Equals

func (s IntSet) Equals(t IntSet) bool

Equals returns true iff the supplied set is equal to this set.

func (IntSet) Intersection

func (s IntSet) Intersection(t IntSet) IntSet

Intersection returns a new set that contains all of the elements that are present in both this set and the supplied set. It does not mutate either set.

func (IntSet) Remove

func (s IntSet) Remove(elem int)

Remove mutates this set to remove the supplied element.

func (IntSet) Subset

func (s IntSet) Subset(t IntSet) bool

Subset returns true iff the supplied set contains all the elements in this set (e.g. s is a subset of t).

func (IntSet) Take

func (s IntSet) Take(n int) (IntSet, error)

Take returns a new set containing n items from this set. If n is greater than the number of elements in the set, returns an error.

func (IntSet) Union

func (s IntSet) Union(t IntSet) IntSet

Union returns a new set that contains all of the elements from this set and all of the elements from the supplied set. It does not mutate either set.

type Isolation

type Isolation interface {
	Decorator
	Create() error
	Isolate(PID int) error
	Clean() error
}

Isolation of resources exposes these interfaces

func NewCPUShares

func NewCPUShares(name string, shares int) Isolation

NewCPUShares instance creation.

func NewMemorySize

func NewMemorySize(name string, size int) Isolation

NewMemorySize creates an instance of input data.

type MemorySize

type MemorySize struct {
	// contains filtered or unexported fields
}

MemorySize defines input data

func (*MemorySize) Clean

func (memorySize *MemorySize) Clean() error

Clean removes specified cgroup.

func (*MemorySize) Create

func (memorySize *MemorySize) Create() error

Create specified cgroup.

func (*MemorySize) Decorate

func (memorySize *MemorySize) Decorate(command string) string

Decorate implements Decorator interface.

func (*MemorySize) Isolate

func (memorySize *MemorySize) Isolate(PID int) error

Isolate create specified cgroup and associates specified process id

type Rdtset

type Rdtset struct {
	CPURange string
	Mask     int
}

Rdtset is an instance of Decorator that used rdtset command for isolation. It allows to set CPU affinity and allocate cache available to those CPUs. See documentation at: experiments/memcached-cat/README.md

func (Rdtset) Decorate

func (r Rdtset) Decorate(command string) (decorated string)

Decorate implements Decorator interface

type Taskset

type Taskset struct {
	CPUList IntSet
}

Taskset is wrapper for taskset linux tool to run process with CPU affinity.

func (Taskset) Decorate

func (ts Taskset) Decorate(command string) string

Decorate command with taskset prefix.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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