MCPcopy Index your code
hub / github.com/koding/kite / parseMeminfo

Function parseMeminfo

systeminfo/systeminfo_linux.go:56–70  ·  view source on GitHub ↗
(table map[string]*uint64)

Source from the content-addressed store, hash-verified

54}
55
56func parseMeminfo(table map[string]*uint64) error {
57 return readFile("/proc/meminfo", func(line string) bool {
58 fields := strings.Split(line, ":")
59
60 if ptr := table[fields[0]]; ptr != nil {
61 num := strings.TrimLeft(fields[1], " ")
62 val, err := strtoull(strings.Fields(num)[0])
63 if err == nil {
64 *ptr = val * 1024
65 }
66 }
67
68 return true
69 })
70}
71
72func readFile(file string, handler func(string) bool) error {
73 contents, err := ioutil.ReadFile(file)

Callers 1

GetMethod · 0.85

Calls 3

readFileFunction · 0.85
strtoullFunction · 0.85
FieldsMethod · 0.80

Tested by

no test coverage detected