update go version, deps for runc v1.0.0-rc92

This commit is contained in:
Bradley Cicenas
2020-10-25 14:22:47 +00:00
parent 4d7d69d4cf
commit 03a0da3230
6 changed files with 89 additions and 56 deletions

View File

@@ -4,13 +4,14 @@ package collector
import (
linuxproc "github.com/c9s/goprocinfo/linux"
"github.com/opencontainers/runc/libcontainer/system"
)
var sysMemTotal = getSysMemTotal()
var clockTicksPerSecond = uint64(system.GetClockTicks())
const nanoSecondsPerSecond = 1e9
const (
clockTicksPerSecond uint64 = 100
nanoSecondsPerSecond = 1e9
)
func getSysMemTotal() int64 {
stat, err := linuxproc.ReadMemInfo("/proc/meminfo")

View File

@@ -5,10 +5,12 @@ package collector
import (
"time"
"github.com/bcicen/ctop/config"
"github.com/bcicen/ctop/models"
"github.com/opencontainers/runc/libcontainer"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/types"
"github.com/bcicen/ctop/config"
"github.com/bcicen/ctop/models"
)
// Runc collector
@@ -112,7 +114,7 @@ func (c *Runc) ReadMem(stats *cgroups.Stats) {
c.MemPercent = percent(float64(c.MemUsage), float64(c.MemLimit))
}
func (c *Runc) ReadNet(interfaces []*libcontainer.NetworkInterface) {
func (c *Runc) ReadNet(interfaces []*types.NetworkInterface) {
var rx, tx int64
for _, network := range interfaces {
rx += int64(network.RxBytes)

View File

@@ -247,7 +247,7 @@ func (cm *Runc) All() (containers container.Containers) {
func getFactory(opts RuncOpts) (libcontainer.Factory, error) {
cgroupManager := libcontainer.Cgroupfs
if opts.systemdCgroups {
if systemd.UseSystemd() {
if systemd.IsRunningSystemd() {
cgroupManager = libcontainer.SystemdCgroups
} else {
return nil, fmt.Errorf("systemd cgroup enabled, but systemd support for managing cgroups is not available")