MCPcopy Create free account
hub / github.com/containerd/cgroups / readMemoryEvents

Function readMemoryEvents

cgroup2/manager.go:709–727  ·  view source on GitHub ↗
(cgroupPath string)

Source from the content-addressed store, hash-verified

707}
708
709func readMemoryEvents(cgroupPath string) (*stats.MemoryEvents, error) {
710 memoryEvents := make(map[string]uint64)
711 if err := readKVStatsFile(cgroupPath, "memory.events", memoryEvents); err != nil {
712 if !os.IsNotExist(err) {
713 return nil, err
714 }
715 }
716 if len(memoryEvents) == 0 {
717 return nil, nil
718 }
719 return &stats.MemoryEvents{
720 Low: memoryEvents["low"],
721 High: memoryEvents["high"],
722 Max: memoryEvents["max"],
723 Oom: memoryEvents["oom"],
724 OomKill: memoryEvents["oom_kill"],
725 OomGroupKill: memoryEvents["oom_group_kill"],
726 }, nil
727}
728
729func readKVStatsFile(path string, file string, out map[string]uint64) error {
730 f, err := os.Open(filepath.Join(path, file))

Callers 1

StatFilteredMethod · 0.85

Calls 1

readKVStatsFileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…