Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cgroup2/hugetlbv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package cgroup2
import (
"fmt"
"os"
"strconv"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -46,6 +47,8 @@ func TestCgroupv2HugetlbStats(t *testing.T) {
for _, entry := range stats.Hugetlb {
if entry.Pagesize == "2MB" {
assert.Equal(t, uint64(1073741824), entry.Max)
checkFileContent(t, c.path, "hugetlb."+entry.Pagesize+".current", strconv.FormatUint(entry.Current, 10))
checkFileContent(t, c.path, "hugetlb."+entry.Pagesize+".events", "max "+strconv.FormatUint(entry.Failcnt, 10))
break
}
}
Expand Down
54 changes: 32 additions & 22 deletions cgroup2/stats/metrics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions cgroup2/stats/metrics.pb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,13 @@ file {
type: TYPE_STRING
json_name: "pagesize"
}
field {
name: "failcnt"
number: 4
label: LABEL_OPTIONAL
type: TYPE_UINT64
json_name: "failcnt"
}
}
message_type {
name: "NetworkStat"
Expand Down
1 change: 1 addition & 0 deletions cgroup2/stats/metrics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ message HugeTlbStat {
uint64 current = 1;
uint64 max = 2;
string pagesize = 3;
uint64 failcnt = 4;
}

message NetworkStat {
Expand Down
1 change: 1 addition & 0 deletions cgroup2/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ func readHugeTlbStats(path string) []*stats.HugeTlbStat {
Max: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".max")),
Current: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".current")),
Pagesize: pagesize,
Failcnt: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".events")),
}
}
return usage
Expand Down
Loading