Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meminfo: add Percpu field #588

Merged
merged 1 commit into from
Dec 14, 2023
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
5 changes: 5 additions & 0 deletions meminfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ type Meminfo struct {
VmallocUsed *uint64
// largest contiguous block of vmalloc area which is free
VmallocChunk *uint64
Percpu *uint64
HardwareCorrupted *uint64
AnonHugePages *uint64
ShmemHugePages *uint64
Expand Down Expand Up @@ -178,6 +179,7 @@ type Meminfo struct {
VmallocTotalBytes *uint64
VmallocUsedBytes *uint64
VmallocChunkBytes *uint64
PercpuBytes *uint64
HardwareCorruptedBytes *uint64
AnonHugePagesBytes *uint64
ShmemHugePagesBytes *uint64
Expand Down Expand Up @@ -339,6 +341,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
case "VmallocChunk:":
m.VmallocChunk = &val
m.VmallocChunkBytes = &valBytes
case "Percpu:":
m.Percpu = &val
m.PercpuBytes = &valBytes
case "HardwareCorrupted:":
m.HardwareCorrupted = &val
m.HardwareCorruptedBytes = &valBytes
Expand Down
2 changes: 2 additions & 0 deletions meminfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestMeminfo(t *testing.T) {
VmallocTotal: newuint64(34359738367),
VmallocUsed: newuint64(36596),
VmallocChunk: newuint64(34359637840),
Percpu: newuint64(26176),
HardwareCorrupted: newuint64(0),
AnonHugePages: newuint64(12288),
HugePagesTotal: newuint64(0),
Expand Down Expand Up @@ -96,6 +97,7 @@ func TestMeminfo(t *testing.T) {
VmallocTotalBytes: newuint64(35184372087808),
VmallocUsedBytes: newuint64(37474304),
VmallocChunkBytes: newuint64(35184269148160),
PercpuBytes: newuint64(26804224),
HardwareCorruptedBytes: newuint64(0),
AnonHugePagesBytes: newuint64(12582912),
HugepagesizeBytes: newuint64(2097152),
Expand Down
3 changes: 2 additions & 1 deletion testdata/fixtures.ttar
Original file line number Diff line number Diff line change
Expand Up @@ -2317,7 +2317,7 @@ unused devices: <none>
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: fixtures/proc/meminfo
Lines: 42
Lines: 43
MemTotal: 15666184 kB
MemFree: 440324 kB
Buffers: 1020128 kB
Expand Down Expand Up @@ -2351,6 +2351,7 @@ Committed_AS: 530844 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 36596 kB
VmallocChunk: 34359637840 kB
Percpu: 26176 kB
HardwareCorrupted: 0 kB
AnonHugePages: 12288 kB
HugePages_Total: 0
Expand Down