MCPcopy
hub / github.com/google/cadvisor / readString

Function readString

lib/container/common/helpers.go:239–252  ·  view source on GitHub ↗
(dirpath string, file string)

Source from the content-addressed store, hash-verified

237}
238
239func readString(dirpath string, file string) string {
240 cgroupFile := path.Join(dirpath, file)
241
242 // Read
243 out, err := os.ReadFile(cgroupFile)
244 if err != nil {
245 // Ignore non-existent files
246 if !os.IsNotExist(err) {
247 klog.Warningf("readString: Failed to read %q: %s", cgroupFile, err)
248 }
249 return ""
250 }
251 return strings.TrimSpace(string(out))
252}
253
254// Convert from [1-10000] to [2-262144]
255func convertCPUWeightToCPULimit(weight uint64) (uint64, error) {

Callers 2

getSpecInternalFunction · 0.85
readUInt64Function · 0.85

Calls 2

ReadFileMethod · 0.80
WarningfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…