libct/cgroups/fs2/statHugeTlb: error message nits

1. Don't wrap the error from fscommon.GetCgroupParamUint as it already
   contains the file name.

2. Don't put file name when wrapping the error from ioutil.ReadFile
   since it already has it.

3. Don't reconstruct file name, use existing one since it's available.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2020-09-22 18:05:22 -07:00
parent 49d4507c77
commit d167be2925
+3 -3
View File
@@ -43,7 +43,7 @@ func statHugeTlb(dirPath string, stats *cgroups.Stats) error {
usage := strings.Join([]string{"hugetlb", pagesize, "current"}, ".")
value, err := fscommon.GetCgroupParamUint(dirPath, usage)
if err != nil {
return errors.Wrapf(err, "failed to parse hugetlb.%s.current file", pagesize)
return err
}
hugetlbStats.Usage = value
@@ -51,11 +51,11 @@ func statHugeTlb(dirPath string, stats *cgroups.Stats) error {
filePath := filepath.Join(dirPath, fileName)
contents, err := ioutil.ReadFile(filePath)
if err != nil {
return errors.Wrapf(err, "failed to parse hugetlb.%s.events file", pagesize)
return errors.Wrap(err, "failed to read stats")
}
_, value, err = fscommon.GetCgroupParamKeyValue(string(contents))
if err != nil {
return errors.Wrapf(err, "failed to parse hugetlb.%s.events file", pagesize)
return errors.Wrap(err, "failed to parse "+fileName)
}
hugetlbStats.Failcnt = value