Update cgroups to e364e5d4183340acdf51f943ba033543

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-09-05 11:51:38 -04:00
parent 697dcdd407
commit 0973a084cf
15 changed files with 961 additions and 169 deletions

View File

@ -1,7 +1,7 @@
github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6
github.com/containerd/go-runc ba22f6a82e52be3be4eb4a00000fe816f4b41c2e
github.com/containerd/console 76d18fd1d66972718ab2284449591db0b3cdb4de
github.com/containerd/cgroups e6d1aa8c71c6103624b2c6e6f4be0863b67027f1
github.com/containerd/cgroups e364e5d4183340acdf51f943ba033543ecb747d3
github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87
github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f

View File

@ -92,6 +92,11 @@ processes, err := control.Processes(cgroups.Devices, recursive)
stats, err := control.Stat()
```
By adding `cgroups.IgnoreNotExist` all non-existent files will be ignored, e.g. swap memory stats without swap enabled
```go
stats, err := control.Stat(cgroups.IgnoreNotExist)
```
### Move process across cgroups
This allows you to take processes from one cgroup and move them to another.

View File

@ -56,7 +56,7 @@ func (b *blkioController) Update(path string, resources *specs.LinuxResources) e
return b.Create(path, resources)
}
func (b *blkioController) Stat(path string, stats *Stats) error {
func (b *blkioController) Stat(path string, stats *Metrics) error {
stats.Blkio = &BlkioStat{}
settings := []blkioStatSettings{
{
@ -119,7 +119,7 @@ func (b *blkioController) Stat(path string, stats *Stats) error {
return nil
}
func (b *blkioController) readEntry(devices map[deviceKey]string, path, name string, entry *[]BlkioEntry) error {
func (b *blkioController) readEntry(devices map[deviceKey]string, path, name string, entry *[]*BlkioEntry) error {
f, err := os.Open(filepath.Join(b.Path(path), fmt.Sprintf("blkio.%s", name)))
if err != nil {
return err
@ -158,7 +158,7 @@ func (b *blkioController) readEntry(devices map[deviceKey]string, path, name str
if err != nil {
return err
}
*entry = append(*entry, BlkioEntry{
*entry = append(*entry, &BlkioEntry{
Device: devices[deviceKey{major, minor}],
Major: major,
Minor: minor,
@ -235,7 +235,7 @@ type blkioSettings struct {
type blkioStatSettings struct {
name string
entry *[]BlkioEntry
entry *[]*BlkioEntry
}
func uintf(v interface{}) []byte {

View File

@ -154,8 +154,8 @@ func (c *cgroup) Delete() error {
return nil
}
// Stat returns the current stats for the cgroup
func (c *cgroup) Stat(handlers ...ErrorHandler) (*Stats, error) {
// Stat returns the current metrics for the cgroup
func (c *cgroup) Stat(handlers ...ErrorHandler) (*Metrics, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.err != nil {
@ -165,7 +165,9 @@ func (c *cgroup) Stat(handlers ...ErrorHandler) (*Stats, error) {
handlers = append(handlers, errPassthrough)
}
var (
stats = &Stats{}
stats = &Metrics{
Cpu: &CpuStat{},
}
wg = &sync.WaitGroup{}
errs = make(chan error, len(c.subsystems))
)

View File

@ -40,7 +40,7 @@ type Cgroup interface {
// subsystems are moved one at a time
MoveTo(Cgroup) error
// Stat returns the stats for all subsystems in the cgroup
Stat(...ErrorHandler) (*Stats, error)
Stat(...ErrorHandler) (*Metrics, error)
// Update updates all the subsystems with the provided resource changes
Update(resources *specs.LinuxResources) error
// Processes returns all the processes in a select subsystem for the cgroup

View File

@ -84,20 +84,13 @@ func (c *cpuController) Update(path string, resources *specs.LinuxResources) err
return c.Create(path, resources)
}
func (c *cpuController) Stat(path string, stats *Stats) error {
func (c *cpuController) Stat(path string, stats *Metrics) error {
f, err := os.Open(filepath.Join(c.Path(path), "cpu.stat"))
if err != nil {
return err
}
defer f.Close()
// get or create the cpu field because cpuacct can also set values on this struct
stats.cpuMu.Lock()
cpu := stats.Cpu
if cpu == nil {
cpu = &CpuStat{}
stats.Cpu = cpu
}
stats.cpuMu.Unlock()
sc := bufio.NewScanner(f)
for sc.Scan() {
if err := sc.Err(); err != nil {
@ -109,11 +102,11 @@ func (c *cpuController) Stat(path string, stats *Stats) error {
}
switch key {
case "nr_periods":
cpu.Throttling.Periods = v
stats.Cpu.Throttling.Periods = v
case "nr_throttled":
cpu.Throttling.ThrottledPeriods = v
stats.Cpu.Throttling.ThrottledPeriods = v
case "throttled_time":
cpu.Throttling.ThrottledTime = v
stats.Cpu.Throttling.ThrottledTime = v
}
}
return nil

View File

@ -30,7 +30,7 @@ func (c *cpuacctController) Path(path string) string {
return filepath.Join(c.root, path)
}
func (c *cpuacctController) Stat(path string, stats *Stats) error {
func (c *cpuacctController) Stat(path string, stats *Metrics) error {
user, kernel, err := c.getUsage(path)
if err != nil {
return err
@ -43,17 +43,10 @@ func (c *cpuacctController) Stat(path string, stats *Stats) error {
if err != nil {
return err
}
stats.cpuMu.Lock()
cpu := stats.Cpu
if cpu == nil {
cpu = &CpuStat{}
stats.Cpu = cpu
}
stats.cpuMu.Unlock()
cpu.Usage.Total = total
cpu.Usage.User = user
cpu.Usage.Kernel = kernel
cpu.Usage.PerCpu = percpu
stats.Cpu.Usage.Total = total
stats.Cpu.Usage.User = user
stats.Cpu.Usage.Kernel = kernel
stats.Cpu.Usage.PerCpu = percpu
return nil
}

View File

@ -51,8 +51,8 @@ func (h *hugetlbController) Create(path string, resources *specs.LinuxResources)
return nil
}
func (h *hugetlbController) Stat(path string, stats *Stats) error {
stats.Hugetlb = make(map[string]HugetlbStat)
func (h *hugetlbController) Stat(path string, stats *Metrics) error {
stats.Hugetlb = make(map[string]*HugetlbStat)
for _, size := range h.sizes {
s, err := h.readSizeStat(path, size)
if err != nil {
@ -63,7 +63,7 @@ func (h *hugetlbController) Stat(path string, stats *Stats) error {
return nil
}
func (h *hugetlbController) readSizeStat(path, size string) (HugetlbStat, error) {
func (h *hugetlbController) readSizeStat(path, size string) (*HugetlbStat, error) {
var s HugetlbStat
for _, t := range []struct {
name string
@ -84,9 +84,9 @@ func (h *hugetlbController) readSizeStat(path, size string) (HugetlbStat, error)
} {
v, err := readUint(filepath.Join(h.Path(path), strings.Join([]string{"hugetlb", size, t.name}, ".")))
if err != nil {
return s, err
return nil, err
}
*t.value = v
}
return s, nil
return &s, nil
}

View File

@ -81,7 +81,7 @@ func (m *memoryController) Update(path string, resources *specs.LinuxResources)
return m.set(path, settings)
}
func (m *memoryController) Stat(path string, stats *Stats) error {
func (m *memoryController) Stat(path string, stats *Metrics) error {
f, err := os.Open(filepath.Join(m.Path(path), "memory.stat"))
if err != nil {
return err
@ -97,19 +97,19 @@ func (m *memoryController) Stat(path string, stats *Stats) error {
}{
{
module: "",
entry: &stats.Memory.Usage,
entry: stats.Memory.Usage,
},
{
module: "memsw",
entry: &stats.Memory.Swap,
entry: stats.Memory.Swap,
},
{
module: "kmem",
entry: &stats.Memory.Kernel,
entry: stats.Memory.Kernel,
},
{
module: "kmem.tcp",
entry: &stats.Memory.KernelTCP,
entry: stats.Memory.KernelTcp,
},
} {
for _, tt := range []struct {
@ -194,8 +194,8 @@ func (m *memoryController) parseStats(r io.Reader, stat *MemoryStat) error {
line++
}
stat.Cache = raw["cache"]
stat.RSS = raw["rss"]
stat.RSSHuge = raw["rss_huge"]
stat.Rss = raw["rss"]
stat.RssHuge = raw["rss_huge"]
stat.MappedFile = raw["mapped_file"]
stat.Dirty = raw["dirty"]
stat.Writeback = raw["writeback"]
@ -211,8 +211,8 @@ func (m *memoryController) parseStats(r io.Reader, stat *MemoryStat) error {
stat.HierarchicalMemoryLimit = raw["hierarchical_memory_limit"]
stat.HierarchicalSwapLimit = raw["hierarchical_memsw_limit"]
stat.TotalCache = raw["total_cache"]
stat.TotalRSS = raw["total_rss"]
stat.TotalRSSHuge = raw["total_rss_huge"]
stat.TotalRss = raw["total_rss"]
stat.TotalRssHuge = raw["total_rss_huge"]
stat.TotalMappedFile = raw["total_mapped_file"]
stat.TotalDirty = raw["total_dirty"]
stat.TotalWriteback = raw["total_writeback"]

787
vendor/github.com/containerd/cgroups/metrics.pb.go generated vendored Normal file
View File

@ -0,0 +1,787 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: metrics.proto
/*
Package cgroups is a generated protocol buffer package.
It is generated from these files:
metrics.proto
It has these top-level messages:
Metrics
HugetlbStat
PidsStat
CpuStat
CpuUsage
Throttle
MemoryStat
MemoryEntry
BlkioStat
BlkioEntry
*/
package cgroups
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Metrics struct {
Hugetlb map[string]*HugetlbStat `protobuf:"bytes,1,rep,name=hugetlb" json:"hugetlb,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
Pids *PidsStat `protobuf:"bytes,2,opt,name=pids" json:"pids,omitempty"`
Cpu *CpuStat `protobuf:"bytes,3,opt,name=cpu" json:"cpu,omitempty"`
Memory *MemoryStat `protobuf:"bytes,4,opt,name=memory" json:"memory,omitempty"`
Blkio *BlkioStat `protobuf:"bytes,5,opt,name=blkio" json:"blkio,omitempty"`
}
func (m *Metrics) Reset() { *m = Metrics{} }
func (m *Metrics) String() string { return proto.CompactTextString(m) }
func (*Metrics) ProtoMessage() {}
func (*Metrics) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Metrics) GetHugetlb() map[string]*HugetlbStat {
if m != nil {
return m.Hugetlb
}
return nil
}
func (m *Metrics) GetPids() *PidsStat {
if m != nil {
return m.Pids
}
return nil
}
func (m *Metrics) GetCpu() *CpuStat {
if m != nil {
return m.Cpu
}
return nil
}
func (m *Metrics) GetMemory() *MemoryStat {
if m != nil {
return m.Memory
}
return nil
}
func (m *Metrics) GetBlkio() *BlkioStat {
if m != nil {
return m.Blkio
}
return nil
}
type HugetlbStat struct {
Usage uint64 `protobuf:"varint,1,opt,name=usage" json:"usage,omitempty"`
Max uint64 `protobuf:"varint,2,opt,name=max" json:"max,omitempty"`
Failcnt uint64 `protobuf:"varint,3,opt,name=failcnt" json:"failcnt,omitempty"`
}
func (m *HugetlbStat) Reset() { *m = HugetlbStat{} }
func (m *HugetlbStat) String() string { return proto.CompactTextString(m) }
func (*HugetlbStat) ProtoMessage() {}
func (*HugetlbStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *HugetlbStat) GetUsage() uint64 {
if m != nil {
return m.Usage
}
return 0
}
func (m *HugetlbStat) GetMax() uint64 {
if m != nil {
return m.Max
}
return 0
}
func (m *HugetlbStat) GetFailcnt() uint64 {
if m != nil {
return m.Failcnt
}
return 0
}
type PidsStat struct {
Current uint64 `protobuf:"varint,1,opt,name=current" json:"current,omitempty"`
Limit uint64 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"`
}
func (m *PidsStat) Reset() { *m = PidsStat{} }
func (m *PidsStat) String() string { return proto.CompactTextString(m) }
func (*PidsStat) ProtoMessage() {}
func (*PidsStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *PidsStat) GetCurrent() uint64 {
if m != nil {
return m.Current
}
return 0
}
func (m *PidsStat) GetLimit() uint64 {
if m != nil {
return m.Limit
}
return 0
}
type CpuStat struct {
Usage *CpuUsage `protobuf:"bytes,1,opt,name=usage" json:"usage,omitempty"`
Throttling *Throttle `protobuf:"bytes,2,opt,name=throttling" json:"throttling,omitempty"`
}
func (m *CpuStat) Reset() { *m = CpuStat{} }
func (m *CpuStat) String() string { return proto.CompactTextString(m) }
func (*CpuStat) ProtoMessage() {}
func (*CpuStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *CpuStat) GetUsage() *CpuUsage {
if m != nil {
return m.Usage
}
return nil
}
func (m *CpuStat) GetThrottling() *Throttle {
if m != nil {
return m.Throttling
}
return nil
}
type CpuUsage struct {
// values in nanoseconds
Total uint64 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"`
Kernel uint64 `protobuf:"varint,2,opt,name=kernel" json:"kernel,omitempty"`
User uint64 `protobuf:"varint,3,opt,name=user" json:"user,omitempty"`
PerCpu []uint64 `protobuf:"varint,4,rep,packed,name=per_cpu,json=perCpu" json:"per_cpu,omitempty"`
}
func (m *CpuUsage) Reset() { *m = CpuUsage{} }
func (m *CpuUsage) String() string { return proto.CompactTextString(m) }
func (*CpuUsage) ProtoMessage() {}
func (*CpuUsage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *CpuUsage) GetTotal() uint64 {
if m != nil {
return m.Total
}
return 0
}
func (m *CpuUsage) GetKernel() uint64 {
if m != nil {
return m.Kernel
}
return 0
}
func (m *CpuUsage) GetUser() uint64 {
if m != nil {
return m.User
}
return 0
}
func (m *CpuUsage) GetPerCpu() []uint64 {
if m != nil {
return m.PerCpu
}
return nil
}
type Throttle struct {
Periods uint64 `protobuf:"varint,1,opt,name=periods" json:"periods,omitempty"`
ThrottledPeriods uint64 `protobuf:"varint,2,opt,name=throttled_periods,json=throttledPeriods" json:"throttled_periods,omitempty"`
ThrottledTime uint64 `protobuf:"varint,3,opt,name=throttled_time,json=throttledTime" json:"throttled_time,omitempty"`
}
func (m *Throttle) Reset() { *m = Throttle{} }
func (m *Throttle) String() string { return proto.CompactTextString(m) }
func (*Throttle) ProtoMessage() {}
func (*Throttle) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *Throttle) GetPeriods() uint64 {
if m != nil {
return m.Periods
}
return 0
}
func (m *Throttle) GetThrottledPeriods() uint64 {
if m != nil {
return m.ThrottledPeriods
}
return 0
}
func (m *Throttle) GetThrottledTime() uint64 {
if m != nil {
return m.ThrottledTime
}
return 0
}
type MemoryStat struct {
Cache uint64 `protobuf:"varint,1,opt,name=cache" json:"cache,omitempty"`
Rss uint64 `protobuf:"varint,2,opt,name=rss" json:"rss,omitempty"`
RssHuge uint64 `protobuf:"varint,3,opt,name=rss_huge,json=rssHuge" json:"rss_huge,omitempty"`
MappedFile uint64 `protobuf:"varint,4,opt,name=mapped_file,json=mappedFile" json:"mapped_file,omitempty"`
Dirty uint64 `protobuf:"varint,5,opt,name=dirty" json:"dirty,omitempty"`
Writeback uint64 `protobuf:"varint,6,opt,name=writeback" json:"writeback,omitempty"`
PgPgIn uint64 `protobuf:"varint,7,opt,name=pg_pg_in,json=pgPgIn" json:"pg_pg_in,omitempty"`
PgPgOut uint64 `protobuf:"varint,8,opt,name=pg_pg_out,json=pgPgOut" json:"pg_pg_out,omitempty"`
PgFault uint64 `protobuf:"varint,9,opt,name=pg_fault,json=pgFault" json:"pg_fault,omitempty"`
PgMajFault uint64 `protobuf:"varint,10,opt,name=pg_maj_fault,json=pgMajFault" json:"pg_maj_fault,omitempty"`
InactiveAnon uint64 `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon" json:"inactive_anon,omitempty"`
ActiveAnon uint64 `protobuf:"varint,12,opt,name=active_anon,json=activeAnon" json:"active_anon,omitempty"`
InactiveFile uint64 `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile" json:"inactive_file,omitempty"`
ActiveFile uint64 `protobuf:"varint,14,opt,name=active_file,json=activeFile" json:"active_file,omitempty"`
Unevictable uint64 `protobuf:"varint,15,opt,name=unevictable" json:"unevictable,omitempty"`
HierarchicalMemoryLimit uint64 `protobuf:"varint,16,opt,name=hierarchical_memory_limit,json=hierarchicalMemoryLimit" json:"hierarchical_memory_limit,omitempty"`
HierarchicalSwapLimit uint64 `protobuf:"varint,17,opt,name=hierarchical_swap_limit,json=hierarchicalSwapLimit" json:"hierarchical_swap_limit,omitempty"`
TotalCache uint64 `protobuf:"varint,18,opt,name=total_cache,json=totalCache" json:"total_cache,omitempty"`
TotalRss uint64 `protobuf:"varint,19,opt,name=total_rss,json=totalRss" json:"total_rss,omitempty"`
TotalRssHuge uint64 `protobuf:"varint,20,opt,name=total_rss_huge,json=totalRssHuge" json:"total_rss_huge,omitempty"`
TotalMappedFile uint64 `protobuf:"varint,21,opt,name=total_mapped_file,json=totalMappedFile" json:"total_mapped_file,omitempty"`
TotalDirty uint64 `protobuf:"varint,22,opt,name=total_dirty,json=totalDirty" json:"total_dirty,omitempty"`
TotalWriteback uint64 `protobuf:"varint,23,opt,name=total_writeback,json=totalWriteback" json:"total_writeback,omitempty"`
TotalPgPgIn uint64 `protobuf:"varint,24,opt,name=total_pg_pg_in,json=totalPgPgIn" json:"total_pg_pg_in,omitempty"`
TotalPgPgOut uint64 `protobuf:"varint,25,opt,name=total_pg_pg_out,json=totalPgPgOut" json:"total_pg_pg_out,omitempty"`
TotalPgFault uint64 `protobuf:"varint,26,opt,name=total_pg_fault,json=totalPgFault" json:"total_pg_fault,omitempty"`
TotalPgMajFault uint64 `protobuf:"varint,27,opt,name=total_pg_maj_fault,json=totalPgMajFault" json:"total_pg_maj_fault,omitempty"`
TotalInactiveAnon uint64 `protobuf:"varint,28,opt,name=total_inactive_anon,json=totalInactiveAnon" json:"total_inactive_anon,omitempty"`
TotalActiveAnon uint64 `protobuf:"varint,29,opt,name=total_active_anon,json=totalActiveAnon" json:"total_active_anon,omitempty"`
TotalInactiveFile uint64 `protobuf:"varint,30,opt,name=total_inactive_file,json=totalInactiveFile" json:"total_inactive_file,omitempty"`
TotalActiveFile uint64 `protobuf:"varint,31,opt,name=total_active_file,json=totalActiveFile" json:"total_active_file,omitempty"`
TotalUnevictable uint64 `protobuf:"varint,32,opt,name=total_unevictable,json=totalUnevictable" json:"total_unevictable,omitempty"`
Usage *MemoryEntry `protobuf:"bytes,33,opt,name=usage" json:"usage,omitempty"`
Swap *MemoryEntry `protobuf:"bytes,34,opt,name=swap" json:"swap,omitempty"`
Kernel *MemoryEntry `protobuf:"bytes,35,opt,name=kernel" json:"kernel,omitempty"`
KernelTcp *MemoryEntry `protobuf:"bytes,36,opt,name=kernel_tcp,json=kernelTcp" json:"kernel_tcp,omitempty"`
}
func (m *MemoryStat) Reset() { *m = MemoryStat{} }
func (m *MemoryStat) String() string { return proto.CompactTextString(m) }
func (*MemoryStat) ProtoMessage() {}
func (*MemoryStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *MemoryStat) GetCache() uint64 {
if m != nil {
return m.Cache
}
return 0
}
func (m *MemoryStat) GetRss() uint64 {
if m != nil {
return m.Rss
}
return 0
}
func (m *MemoryStat) GetRssHuge() uint64 {
if m != nil {
return m.RssHuge
}
return 0
}
func (m *MemoryStat) GetMappedFile() uint64 {
if m != nil {
return m.MappedFile
}
return 0
}
func (m *MemoryStat) GetDirty() uint64 {
if m != nil {
return m.Dirty
}
return 0
}
func (m *MemoryStat) GetWriteback() uint64 {
if m != nil {
return m.Writeback
}
return 0
}
func (m *MemoryStat) GetPgPgIn() uint64 {
if m != nil {
return m.PgPgIn
}
return 0
}
func (m *MemoryStat) GetPgPgOut() uint64 {
if m != nil {
return m.PgPgOut
}
return 0
}
func (m *MemoryStat) GetPgFault() uint64 {
if m != nil {
return m.PgFault
}
return 0
}
func (m *MemoryStat) GetPgMajFault() uint64 {
if m != nil {
return m.PgMajFault
}
return 0
}
func (m *MemoryStat) GetInactiveAnon() uint64 {
if m != nil {
return m.InactiveAnon
}
return 0
}
func (m *MemoryStat) GetActiveAnon() uint64 {
if m != nil {
return m.ActiveAnon
}
return 0
}
func (m *MemoryStat) GetInactiveFile() uint64 {
if m != nil {
return m.InactiveFile
}
return 0
}
func (m *MemoryStat) GetActiveFile() uint64 {
if m != nil {
return m.ActiveFile
}
return 0
}
func (m *MemoryStat) GetUnevictable() uint64 {
if m != nil {
return m.Unevictable
}
return 0
}
func (m *MemoryStat) GetHierarchicalMemoryLimit() uint64 {
if m != nil {
return m.HierarchicalMemoryLimit
}
return 0
}
func (m *MemoryStat) GetHierarchicalSwapLimit() uint64 {
if m != nil {
return m.HierarchicalSwapLimit
}
return 0
}
func (m *MemoryStat) GetTotalCache() uint64 {
if m != nil {
return m.TotalCache
}
return 0
}
func (m *MemoryStat) GetTotalRss() uint64 {
if m != nil {
return m.TotalRss
}
return 0
}
func (m *MemoryStat) GetTotalRssHuge() uint64 {
if m != nil {
return m.TotalRssHuge
}
return 0
}
func (m *MemoryStat) GetTotalMappedFile() uint64 {
if m != nil {
return m.TotalMappedFile
}
return 0
}
func (m *MemoryStat) GetTotalDirty() uint64 {
if m != nil {
return m.TotalDirty
}
return 0
}
func (m *MemoryStat) GetTotalWriteback() uint64 {
if m != nil {
return m.TotalWriteback
}
return 0
}
func (m *MemoryStat) GetTotalPgPgIn() uint64 {
if m != nil {
return m.TotalPgPgIn
}
return 0
}
func (m *MemoryStat) GetTotalPgPgOut() uint64 {
if m != nil {
return m.TotalPgPgOut
}
return 0
}
func (m *MemoryStat) GetTotalPgFault() uint64 {
if m != nil {
return m.TotalPgFault
}
return 0
}
func (m *MemoryStat) GetTotalPgMajFault() uint64 {
if m != nil {
return m.TotalPgMajFault
}
return 0
}
func (m *MemoryStat) GetTotalInactiveAnon() uint64 {
if m != nil {
return m.TotalInactiveAnon
}
return 0
}
func (m *MemoryStat) GetTotalActiveAnon() uint64 {
if m != nil {
return m.TotalActiveAnon
}
return 0
}
func (m *MemoryStat) GetTotalInactiveFile() uint64 {
if m != nil {
return m.TotalInactiveFile
}
return 0
}
func (m *MemoryStat) GetTotalActiveFile() uint64 {
if m != nil {
return m.TotalActiveFile
}
return 0
}
func (m *MemoryStat) GetTotalUnevictable() uint64 {
if m != nil {
return m.TotalUnevictable
}
return 0
}
func (m *MemoryStat) GetUsage() *MemoryEntry {
if m != nil {
return m.Usage
}
return nil
}
func (m *MemoryStat) GetSwap() *MemoryEntry {
if m != nil {
return m.Swap
}
return nil
}
func (m *MemoryStat) GetKernel() *MemoryEntry {
if m != nil {
return m.Kernel
}
return nil
}
func (m *MemoryStat) GetKernelTcp() *MemoryEntry {
if m != nil {
return m.KernelTcp
}
return nil
}
type MemoryEntry struct {
Limit uint64 `protobuf:"varint,1,opt,name=limit" json:"limit,omitempty"`
Usage uint64 `protobuf:"varint,2,opt,name=usage" json:"usage,omitempty"`
Max uint64 `protobuf:"varint,3,opt,name=max" json:"max,omitempty"`
Failcnt uint64 `protobuf:"varint,4,opt,name=failcnt" json:"failcnt,omitempty"`
}
func (m *MemoryEntry) Reset() { *m = MemoryEntry{} }
func (m *MemoryEntry) String() string { return proto.CompactTextString(m) }
func (*MemoryEntry) ProtoMessage() {}
func (*MemoryEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *MemoryEntry) GetLimit() uint64 {
if m != nil {
return m.Limit
}
return 0
}
func (m *MemoryEntry) GetUsage() uint64 {
if m != nil {
return m.Usage
}
return 0
}
func (m *MemoryEntry) GetMax() uint64 {
if m != nil {
return m.Max
}
return 0
}
func (m *MemoryEntry) GetFailcnt() uint64 {
if m != nil {
return m.Failcnt
}
return 0
}
type BlkioStat struct {
IoServiceBytesRecursive []*BlkioEntry `protobuf:"bytes,1,rep,name=io_service_bytes_recursive,json=ioServiceBytesRecursive" json:"io_service_bytes_recursive,omitempty"`
IoServicedRecursive []*BlkioEntry `protobuf:"bytes,2,rep,name=io_serviced_recursive,json=ioServicedRecursive" json:"io_serviced_recursive,omitempty"`
IoQueuedRecursive []*BlkioEntry `protobuf:"bytes,3,rep,name=io_queued_recursive,json=ioQueuedRecursive" json:"io_queued_recursive,omitempty"`
IoServiceTimeRecursive []*BlkioEntry `protobuf:"bytes,4,rep,name=io_service_time_recursive,json=ioServiceTimeRecursive" json:"io_service_time_recursive,omitempty"`
IoWaitTimeRecursive []*BlkioEntry `protobuf:"bytes,5,rep,name=io_wait_time_recursive,json=ioWaitTimeRecursive" json:"io_wait_time_recursive,omitempty"`
IoMergedRecursive []*BlkioEntry `protobuf:"bytes,6,rep,name=io_merged_recursive,json=ioMergedRecursive" json:"io_merged_recursive,omitempty"`
IoTimeRecursive []*BlkioEntry `protobuf:"bytes,7,rep,name=io_time_recursive,json=ioTimeRecursive" json:"io_time_recursive,omitempty"`
SectorsRecursive []*BlkioEntry `protobuf:"bytes,8,rep,name=sectors_recursive,json=sectorsRecursive" json:"sectors_recursive,omitempty"`
}
func (m *BlkioStat) Reset() { *m = BlkioStat{} }
func (m *BlkioStat) String() string { return proto.CompactTextString(m) }
func (*BlkioStat) ProtoMessage() {}
func (*BlkioStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *BlkioStat) GetIoServiceBytesRecursive() []*BlkioEntry {
if m != nil {
return m.IoServiceBytesRecursive
}
return nil
}
func (m *BlkioStat) GetIoServicedRecursive() []*BlkioEntry {
if m != nil {
return m.IoServicedRecursive
}
return nil
}
func (m *BlkioStat) GetIoQueuedRecursive() []*BlkioEntry {
if m != nil {
return m.IoQueuedRecursive
}
return nil
}
func (m *BlkioStat) GetIoServiceTimeRecursive() []*BlkioEntry {
if m != nil {
return m.IoServiceTimeRecursive
}
return nil
}
func (m *BlkioStat) GetIoWaitTimeRecursive() []*BlkioEntry {
if m != nil {
return m.IoWaitTimeRecursive
}
return nil
}
func (m *BlkioStat) GetIoMergedRecursive() []*BlkioEntry {
if m != nil {
return m.IoMergedRecursive
}
return nil
}
func (m *BlkioStat) GetIoTimeRecursive() []*BlkioEntry {
if m != nil {
return m.IoTimeRecursive
}
return nil
}
func (m *BlkioStat) GetSectorsRecursive() []*BlkioEntry {
if m != nil {
return m.SectorsRecursive
}
return nil
}
type BlkioEntry struct {
Op string `protobuf:"bytes,1,opt,name=op" json:"op,omitempty"`
Device string `protobuf:"bytes,2,opt,name=device" json:"device,omitempty"`
Major uint64 `protobuf:"varint,3,opt,name=major" json:"major,omitempty"`
Minor uint64 `protobuf:"varint,4,opt,name=minor" json:"minor,omitempty"`
Value uint64 `protobuf:"varint,5,opt,name=value" json:"value,omitempty"`
}
func (m *BlkioEntry) Reset() { *m = BlkioEntry{} }
func (m *BlkioEntry) String() string { return proto.CompactTextString(m) }
func (*BlkioEntry) ProtoMessage() {}
func (*BlkioEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *BlkioEntry) GetOp() string {
if m != nil {
return m.Op
}
return ""
}
func (m *BlkioEntry) GetDevice() string {
if m != nil {
return m.Device
}
return ""
}
func (m *BlkioEntry) GetMajor() uint64 {
if m != nil {
return m.Major
}
return 0
}
func (m *BlkioEntry) GetMinor() uint64 {
if m != nil {
return m.Minor
}
return 0
}
func (m *BlkioEntry) GetValue() uint64 {
if m != nil {
return m.Value
}
return 0
}
func init() {
proto.RegisterType((*Metrics)(nil), "cgroups.Metrics")
proto.RegisterType((*HugetlbStat)(nil), "cgroups.HugetlbStat")
proto.RegisterType((*PidsStat)(nil), "cgroups.PidsStat")
proto.RegisterType((*CpuStat)(nil), "cgroups.CpuStat")
proto.RegisterType((*CpuUsage)(nil), "cgroups.CpuUsage")
proto.RegisterType((*Throttle)(nil), "cgroups.Throttle")
proto.RegisterType((*MemoryStat)(nil), "cgroups.MemoryStat")
proto.RegisterType((*MemoryEntry)(nil), "cgroups.MemoryEntry")
proto.RegisterType((*BlkioStat)(nil), "cgroups.BlkioStat")
proto.RegisterType((*BlkioEntry)(nil), "cgroups.BlkioEntry")
}
func init() { proto.RegisterFile("metrics.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 1175 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x96, 0x6f, 0x6f, 0xdb, 0x36,
0x10, 0xc6, 0x61, 0x5b, 0x89, 0xed, 0x73, 0x92, 0xc6, 0x74, 0x9b, 0x28, 0x69, 0xbb, 0x7a, 0x6e,
0x8b, 0x06, 0xc9, 0x10, 0x60, 0x2d, 0xb0, 0x0d, 0x79, 0xb3, 0xb5, 0xd9, 0xba, 0x16, 0x58, 0x56,
0x4f, 0x49, 0xd1, 0x97, 0x82, 0x2c, 0x33, 0x0a, 0x13, 0x59, 0xe4, 0x28, 0xca, 0x69, 0xbe, 0xd8,
0xbe, 0xc5, 0x80, 0x7d, 0xa4, 0x81, 0x47, 0x4a, 0xa2, 0xf3, 0xef, 0x9d, 0x8e, 0xf7,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/containerd/cgroups/metrics.proto generated vendored Normal file
View File

@ -0,0 +1,107 @@
syntax = "proto3";
package cgroups;
message Metrics {
map<string, HugetlbStat> hugetlb = 1;
PidsStat pids = 2;
CpuStat cpu = 3;
MemoryStat memory = 4;
BlkioStat blkio = 5;
}
message HugetlbStat {
uint64 usage = 1;
uint64 max = 2;
uint64 failcnt = 3;
}
message PidsStat {
uint64 current = 1;
uint64 limit = 2;
}
message CpuStat {
CpuUsage usage = 1;
Throttle throttling = 2;
}
message CpuUsage {
// values in nanoseconds
uint64 total = 1;
uint64 kernel = 2;
uint64 user = 3;
repeated uint64 per_cpu = 4;
}
message Throttle {
uint64 periods = 1;
uint64 throttled_periods = 2;
uint64 throttled_time = 3;
}
message MemoryStat {
uint64 cache = 1;
uint64 rss = 2;
uint64 rss_huge = 3;
uint64 mapped_file = 4;
uint64 dirty = 5;
uint64 writeback = 6;
uint64 pg_pg_in = 7;
uint64 pg_pg_out = 8;
uint64 pg_fault = 9;
uint64 pg_maj_fault = 10;
uint64 inactive_anon = 11;
uint64 active_anon = 12;
uint64 inactive_file = 13;
uint64 active_file = 14;
uint64 unevictable = 15;
uint64 hierarchical_memory_limit = 16;
uint64 hierarchical_swap_limit = 17;
uint64 total_cache = 18;
uint64 total_rss = 19;
uint64 total_rss_huge = 20;
uint64 total_mapped_file = 21;
uint64 total_dirty = 22;
uint64 total_writeback = 23;
uint64 total_pg_pg_in = 24;
uint64 total_pg_pg_out = 25;
uint64 total_pg_fault = 26;
uint64 total_pg_maj_fault = 27;
uint64 total_inactive_anon = 28;
uint64 total_active_anon = 29;
uint64 total_inactive_file = 30;
uint64 total_active_file = 31;
uint64 total_unevictable = 32;
MemoryEntry usage = 33;
MemoryEntry swap = 34;
MemoryEntry kernel = 35;
MemoryEntry kernel_tcp = 36;
}
message MemoryEntry {
uint64 limit = 1;
uint64 usage = 2;
uint64 max = 3;
uint64 failcnt = 4;
}
message BlkioStat {
repeated BlkioEntry io_service_bytes_recursive = 1;
repeated BlkioEntry io_serviced_recursive = 2;
repeated BlkioEntry io_queued_recursive = 3;
repeated BlkioEntry io_service_time_recursive = 4;
repeated BlkioEntry io_wait_time_recursive = 5;
repeated BlkioEntry io_merged_recursive = 6;
repeated BlkioEntry io_time_recursive = 7;
repeated BlkioEntry sectors_recursive = 8;
}
message BlkioEntry {
string op = 1;
string device = 2;
uint64 major = 3;
uint64 minor = 4;
uint64 value = 5;
}

View File

@ -46,7 +46,7 @@ func (p *pidsController) Update(path string, resources *specs.LinuxResources) er
return p.Create(path, resources)
}
func (p *pidsController) Stat(path string, stats *Stats) error {
func (p *pidsController) Stat(path string, stats *Metrics) error {
current, err := readUint(filepath.Join(p.Path(path), "pids.current"))
if err != nil {
return err

View File

@ -1,109 +0,0 @@
package cgroups
import "sync"
type Stats struct {
cpuMu sync.Mutex
Hugetlb map[string]HugetlbStat
Pids *PidsStat
Cpu *CpuStat
Memory *MemoryStat
Blkio *BlkioStat
}
type HugetlbStat struct {
Usage uint64
Max uint64
Failcnt uint64
}
type PidsStat struct {
Current uint64
Limit uint64
}
type CpuStat struct {
Usage CpuUsage
Throttling Throttle
}
type CpuUsage struct {
// Units: nanoseconds.
Total uint64
PerCpu []uint64
Kernel uint64
User uint64
}
type Throttle struct {
Periods uint64
ThrottledPeriods uint64
ThrottledTime uint64
}
type MemoryStat struct {
Cache uint64
RSS uint64
RSSHuge uint64
MappedFile uint64
Dirty uint64
Writeback uint64
PgPgIn uint64
PgPgOut uint64
PgFault uint64
PgMajFault uint64
InactiveAnon uint64
ActiveAnon uint64
InactiveFile uint64
ActiveFile uint64
Unevictable uint64
HierarchicalMemoryLimit uint64
HierarchicalSwapLimit uint64
TotalCache uint64
TotalRSS uint64
TotalRSSHuge uint64
TotalMappedFile uint64
TotalDirty uint64
TotalWriteback uint64
TotalPgPgIn uint64
TotalPgPgOut uint64
TotalPgFault uint64
TotalPgMajFault uint64
TotalInactiveAnon uint64
TotalActiveAnon uint64
TotalInactiveFile uint64
TotalActiveFile uint64
TotalUnevictable uint64
Usage MemoryEntry
Swap MemoryEntry
Kernel MemoryEntry
KernelTCP MemoryEntry
}
type MemoryEntry struct {
Limit uint64
Usage uint64
Max uint64
Failcnt uint64
}
type BlkioStat struct {
IoServiceBytesRecursive []BlkioEntry
IoServicedRecursive []BlkioEntry
IoQueuedRecursive []BlkioEntry
IoServiceTimeRecursive []BlkioEntry
IoWaitTimeRecursive []BlkioEntry
IoMergedRecursive []BlkioEntry
IoTimeRecursive []BlkioEntry
SectorsRecursive []BlkioEntry
}
type BlkioEntry struct {
Op string
Device string
Major uint64
Minor uint64
Value uint64
}

View File

@ -67,7 +67,7 @@ type deleter interface {
type stater interface {
Subsystem
Stat(path string, stats *Stats) error
Stat(path string, stats *Metrics) error
}
type updater interface {

View File

@ -43,19 +43,13 @@ func Slice(slice, name string) Path {
}
func NewSystemd(root string) (*SystemdController, error) {
conn, err := systemdDbus.New()
if err != nil {
return nil, err
}
return &SystemdController{
root: root,
conn: conn,
}, nil
}
type SystemdController struct {
mu sync.Mutex
conn *systemdDbus.Conn
root string
}
@ -64,6 +58,11 @@ func (s *SystemdController) Name() Name {
}
func (s *SystemdController) Create(path string, resources *specs.LinuxResources) error {
conn, err := systemdDbus.New()
if err != nil {
return err
}
defer conn.Close()
slice, name := splitName(path)
properties := []systemdDbus.Property{
systemdDbus.PropDescription(fmt.Sprintf("cgroup %s", name)),
@ -74,15 +73,30 @@ func (s *SystemdController) Create(path string, resources *specs.LinuxResources)
newProperty("CPUAccounting", true),
newProperty("BlockIOAccounting", true),
}
_, err := s.conn.StartTransientUnit(name, "replace", properties, nil)
ch := make(chan string)
_, err = conn.StartTransientUnit(name, "replace", properties, ch)
if err != nil {
return err
}
<-ch
return nil
}
func (s *SystemdController) Delete(path string) error {
_, name := splitName(path)
_, err := s.conn.StopUnit(name, "replace", nil)
conn, err := systemdDbus.New()
if err != nil {
return err
}
defer conn.Close()
_, name := splitName(path)
ch := make(chan string)
_, err = conn.StopUnit(name, "replace", ch)
if err != nil {
return err
}
<-ch
return nil
}
func newProperty(name string, units interface{}) systemdDbus.Property {
return systemdDbus.Property{