MCPcopy Create free account
hub / github.com/prometheus/procfs / parseClocksource

Function parseClocksource

sysfs/clocksource.go:56–76  ·  view source on GitHub ↗
(clocksourcePath string)

Source from the content-addressed store, hash-verified

54}
55
56func parseClocksource(clocksourcePath string) (*ClockSource, error) {
57
58 stringFiles := []string{
59 "available_clocksource",
60 "current_clocksource",
61 }
62 stringOut := make([]string, len(stringFiles))
63 var err error
64
65 for i, f := range stringFiles {
66 stringOut[i], err = parsers.SysReadFile(filepath.Join(clocksourcePath, f))
67 if err != nil {
68 return &ClockSource{}, err
69 }
70 }
71
72 return &ClockSource{
73 Available: strings.Fields(stringOut[0]),
74 Current: stringOut[1],
75 }, nil
76}

Callers 1

ClockSourcesMethod · 0.85

Calls 1

SysReadFileFunction · 0.92

Tested by

no test coverage detected