cgroups

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2014 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("mountpoint not found")
)

Functions

func GetInitCgroupDir

func GetInitCgroupDir(subsystem string) (string, error)

func GetThisCgroupDir

func GetThisCgroupDir(subsystem string) (string, error)

Returns the relative path to the cgroup docker is running in.

func ReadProcsFile

func ReadProcsFile(dir string) ([]int, error)

Types

type ActiveCgroup

type ActiveCgroup interface {
	Cleanup() error
}

type BlkioStatEntry

type BlkioStatEntry struct {
	Major uint64 `json:"major,omitempty"`
	Minor uint64 `json:"minor,omitempty"`
	Op    string `json:"op,omitempty"`
	Value uint64 `json:"value,omitempty"`
}

type BlkioStats

type BlkioStats struct {
	// number of bytes tranferred to and from the block device
	IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive,omitempty"`
	IoServicedRecursive     []BlkioStatEntry `json:"io_serviced_recusrive,omitempty"`
	IoQueuedRecursive       []BlkioStatEntry `json:"io_queue_recursive,omitempty"`
	SectorsRecursive        []BlkioStatEntry `json:"sectors_recursive,omitempty"`
}

type Cgroup

type Cgroup struct {
	Name   string `json:"name,omitempty"`
	Parent string `json:"parent,omitempty"` // name of parent cgroup or slice

	AllowAllDevices   bool              `json:"allow_all_devices,omitempty"` // If this is true allow access to any kind of device within the container.  If false, allow access only to devices explicitly listed in the allowed_devices list.
	AllowedDevices    []*devices.Device `json:"allowed_devices,omitempty"`
	Memory            int64             `json:"memory,omitempty"`             // Memory limit (in bytes)
	MemoryReservation int64             `json:"memory_reservation,omitempty"` // Memory reservation or soft_limit (in bytes)
	MemorySwap        int64             `json:"memory_swap,omitempty"`        // Total memory usage (memory + swap); set `-1' to disable swap
	CpuShares         int64             `json:"cpu_shares,omitempty"`         // CPU shares (relative weight vs. other containers)
	CpuQuota          int64             `json:"cpu_quota,omitempty"`          // CPU hardcap limit (in usecs). Allowed cpu time in a given period.
	CpuPeriod         int64             `json:"cpu_period,omitempty"`         // CPU period to be used for hardcapping (in usecs). 0 to use system default.
	CpusetCpus        string            `json:"cpuset_cpus,omitempty"`        // CPU to use
	Freezer           FreezerState      `json:"freezer,omitempty"`            // set the freeze value for the process
	Slice             string            `json:"slice,omitempty"`              // Parent slice to use for systemd
}

type CpuStats

type CpuStats struct {
	CpuUsage       CpuUsage       `json:"cpu_usage,omitempty"`
	ThrottlingData ThrottlingData `json:"throlling_data,omitempty"`
}

type CpuUsage

type CpuUsage struct {
	// percentage of available CPUs currently being used.
	PercentUsage uint64 `json:"percent_usage,omitempty"`
	// nanoseconds of cpu time consumed over the last 100 ms.
	CurrentUsage uint64   `json:"current_usage,omitempty"`
	PercpuUsage  []uint64 `json:"percpu_usage,omitempty"`
	// Time spent by tasks of the cgroup in kernel mode. Units: nanoseconds.
	UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
	// Time spent by tasks of the cgroup in user mode. Units: nanoseconds.
	UsageInUsermode uint64 `json:"usage_in_usermode"`
}

type FreezerState

type FreezerState string
const (
	Undefined FreezerState = ""
	Frozen    FreezerState = "FROZEN"
	Thawed    FreezerState = "THAWED"
)

type FreezerStats

type FreezerStats struct {
	ParentState string `json:"parent_state,omitempty"`
	SelfState   string `json:"self_state,omitempty"`
}

TODO(Vishh): Remove freezer from stats since it does not logically belong in stats.

type MemoryStats

type MemoryStats struct {
	// current res_counter usage for memory
	Usage uint64 `json:"usage,omitempty"`
	// maximum usage ever recorded.
	MaxUsage uint64 `json:"max_usage,omitempty"`
	// TODO(vishh): Export these as stronger types.
	// all the stats exported via memory.stat.
	Stats map[string]uint64 `json:"stats,omitempty"`
	// number of times memory usage hits limits.
	Failcnt uint64 `json:"failcnt"`
}

type Stats

type Stats struct {
	CpuStats     CpuStats     `json:"cpu_stats,omitempty"`
	MemoryStats  MemoryStats  `json:"memory_stats,omitempty"`
	BlkioStats   BlkioStats   `json:"blkio_stats,omitempty"`
	FreezerStats FreezerStats `json:"freezer_stats,omitempty"`
}

func NewStats

func NewStats() *Stats

type ThrottlingData

type ThrottlingData struct {
	// Number of periods with throttling active
	Periods uint64 `json:"periods,omitempty"`
	// Number of periods when the container hit its throttling limit.
	ThrottledPeriods uint64 `json:"throttled_periods,omitempty"`
	// Aggregate time the container was throttled for in nanoseconds.
	ThrottledTime uint64 `json:"throttled_time,omitempty"`
}

Directories

Path Synopsis
Utility for testing cgroup operations.
Utility for testing cgroup operations.

Jump to

Keyboard shortcuts

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