Documentation
¶
Index ¶
- func EnterPid(cgroupPaths map[string]string, pid int) error
- func FindCgroupMountpoint(subsystem string) (string, error)
- func GetAllSubsystems() ([]string, error)
- func GetInitCgroupDir(subsystem string) (string, error)
- func GetThisCgroupDir(subsystem string) (string, error)
- func IsNotFound(err error) bool
- func NewNotFoundError(sub string) error
- func ParseCgroupFile(subsystem string, r io.Reader) (string, error)
- func PathExists(path string) bool
- func ReadProcsFile(dir string) ([]int, error)
- func RemovePaths(paths map[string]string) (err error)
- type BlkioStatEntry
- type BlkioStats
- type Cgroup
- type CpuStats
- type CpuUsage
- type FreezerState
- type MemoryStats
- type Mount
- type NotFoundError
- type Stats
- type ThrottlingData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllSubsystems ¶ added in v0.4.2
Returns all the cgroup subsystems supported by the kernel
func GetInitCgroupDir ¶
func GetThisCgroupDir ¶
Returns the relative path to the cgroup docker is running in.
func IsNotFound ¶ added in v0.4.2
func NewNotFoundError ¶ added in v0.4.2
func ParseCgroupFile ¶ added in v0.4.2
func PathExists ¶ added in v0.4.2
func ReadProcsFile ¶
func RemovePaths ¶ added in v0.4.2
RemovePaths iterates over the provided paths removing them. We trying to remove all paths five times with increasing delay between tries. If after all there are not removed cgroups - appropriate error will be returned.
Types ¶
type BlkioStatEntry ¶
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_recursive,omitempty"` IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive,omitempty"` IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive,omitempty"` IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive,omitempty"` IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive,omitempty"` IoTimeRecursive []BlkioStatEntry `json:"io_time_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 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 CpusetMems string `json:"cpuset_mems,omitempty"` // MEM 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:"throttling_data,omitempty"` }
type CpuUsage ¶
type CpuUsage struct { // Total CPU time consumed. // Units: nanoseconds. TotalUsage uint64 `json:"total_usage,omitempty"` // Total CPU time consumed per core. // Units: nanoseconds. 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"` }
All CPU stats are aggregate since container inception.
type FreezerState ¶
type FreezerState string
const ( Undefined FreezerState = "" Frozen FreezerState = "FROZEN" Thawed FreezerState = "THAWED" )
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 Mount ¶ added in v0.4.2
func GetCgroupMounts ¶ added in v0.4.2
func (Mount) GetThisCgroupDir ¶ added in v0.4.2
type NotFoundError ¶ added in v0.4.2
type NotFoundError struct {
Subsystem string
}
func (*NotFoundError) Error ¶ added in v0.4.2
func (e *NotFoundError) Error() string
type Stats ¶
type Stats struct { CpuStats CpuStats `json:"cpu_stats,omitempty"` MemoryStats MemoryStats `json:"memory_stats,omitempty"` BlkioStats BlkioStats `json:"blkio_stats,omitempty"` }
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"` }
Click to show internal directories.
Click to hide internal directories.