MCPcopy Create free account
hub / github.com/containers/common / readAcctList

Function readAcctList

pkg/cgroups/cpu.go:31–50  ·  view source on GitHub ↗
(ctr *CgroupControl, name string)

Source from the content-addressed store, hash-verified

29}
30
31func readAcctList(ctr *CgroupControl, name string) ([]uint64, error) {
32 p := filepath.Join(ctr.getCgroupv1Path(CPUAcct), name)
33 data, err := ioutil.ReadFile(p)
34 if err != nil {
35 return nil, errors.Wrapf(err, "reading %s", p)
36 }
37 r := []uint64{}
38 for _, s := range strings.Split(string(data), " ") {
39 s = cleanString(s)
40 if s == "" {
41 break
42 }
43 v, err := strconv.ParseUint(s, 10, 64)
44 if err != nil {
45 return nil, errors.Wrapf(err, "parsing %s", s)
46 }
47 r = append(r, v)
48 }
49 return r, nil
50}
51
52// Apply set the specified constraints
53func (c *cpuHandler) Apply(ctr *CgroupControl, res *spec.LinuxResources) error {

Callers 1

StatMethod · 0.85

Calls 2

cleanStringFunction · 0.85
getCgroupv1PathMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…