Skip to content

Commit 0bcdc45

Browse files
authored
added zswap, zswapped, secpagetables, filehugepages, hugetlb and unaccepted to meminfo (#655)
Signed-off-by: Navid Yaghoobi <[email protected]>
1 parent a5f79dd commit 0bcdc45

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

meminfo.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ type Meminfo struct {
6666
// Memory which has been evicted from RAM, and is temporarily
6767
// on the disk
6868
SwapFree *uint64
69+
// Memory consumed by the zswap backend (compressed size)
70+
Zswap *uint64
71+
// Amount of anonymous memory stored in zswap (original size)
72+
Zswapped *uint64
6973
// Memory which is waiting to get written back to the disk
7074
Dirty *uint64
7175
// Memory which is actively being written back to the disk
@@ -85,6 +89,8 @@ type Meminfo struct {
8589
// amount of memory dedicated to the lowest level of page
8690
// tables.
8791
PageTables *uint64
92+
// secondary page tables.
93+
SecPageTables *uint64
8894
// NFS pages sent to the server, but not yet committed to
8995
// stable storage
9096
NFSUnstable *uint64
@@ -129,15 +135,18 @@ type Meminfo struct {
129135
Percpu *uint64
130136
HardwareCorrupted *uint64
131137
AnonHugePages *uint64
138+
FileHugePages *uint64
132139
ShmemHugePages *uint64
133140
ShmemPmdMapped *uint64
134141
CmaTotal *uint64
135142
CmaFree *uint64
143+
Unaccepted *uint64
136144
HugePagesTotal *uint64
137145
HugePagesFree *uint64
138146
HugePagesRsvd *uint64
139147
HugePagesSurp *uint64
140148
Hugepagesize *uint64
149+
Hugetlb *uint64
141150
DirectMap4k *uint64
142151
DirectMap2M *uint64
143152
DirectMap1G *uint64
@@ -161,6 +170,8 @@ type Meminfo struct {
161170
MlockedBytes *uint64
162171
SwapTotalBytes *uint64
163172
SwapFreeBytes *uint64
173+
ZswapBytes *uint64
174+
ZswappedBytes *uint64
164175
DirtyBytes *uint64
165176
WritebackBytes *uint64
166177
AnonPagesBytes *uint64
@@ -171,6 +182,7 @@ type Meminfo struct {
171182
SUnreclaimBytes *uint64
172183
KernelStackBytes *uint64
173184
PageTablesBytes *uint64
185+
SecPageTablesBytes *uint64
174186
NFSUnstableBytes *uint64
175187
BounceBytes *uint64
176188
WritebackTmpBytes *uint64
@@ -182,11 +194,14 @@ type Meminfo struct {
182194
PercpuBytes *uint64
183195
HardwareCorruptedBytes *uint64
184196
AnonHugePagesBytes *uint64
197+
FileHugePagesBytes *uint64
185198
ShmemHugePagesBytes *uint64
186199
ShmemPmdMappedBytes *uint64
187200
CmaTotalBytes *uint64
188201
CmaFreeBytes *uint64
202+
UnacceptedBytes *uint64
189203
HugepagesizeBytes *uint64
204+
HugetlbBytes *uint64
190205
DirectMap4kBytes *uint64
191206
DirectMap2MBytes *uint64
192207
DirectMap1GBytes *uint64
@@ -287,6 +302,12 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
287302
case "SwapFree:":
288303
m.SwapFree = &val
289304
m.SwapFreeBytes = &valBytes
305+
case "Zswap:":
306+
m.Zswap = &val
307+
m.ZswapBytes = &valBytes
308+
case "Zswapped:":
309+
m.Zswapped = &val
310+
m.ZswapBytes = &valBytes
290311
case "Dirty:":
291312
m.Dirty = &val
292313
m.DirtyBytes = &valBytes
@@ -317,6 +338,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
317338
case "PageTables:":
318339
m.PageTables = &val
319340
m.PageTablesBytes = &valBytes
341+
case "SecPageTables:":
342+
m.SecPageTables = &val
343+
m.SecPageTablesBytes = &valBytes
320344
case "NFS_Unstable:":
321345
m.NFSUnstable = &val
322346
m.NFSUnstableBytes = &valBytes
@@ -350,6 +374,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
350374
case "AnonHugePages:":
351375
m.AnonHugePages = &val
352376
m.AnonHugePagesBytes = &valBytes
377+
case "FileHugePages:":
378+
m.FileHugePages = &val
379+
m.FileHugePagesBytes = &valBytes
353380
case "ShmemHugePages:":
354381
m.ShmemHugePages = &val
355382
m.ShmemHugePagesBytes = &valBytes
@@ -362,6 +389,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
362389
case "CmaFree:":
363390
m.CmaFree = &val
364391
m.CmaFreeBytes = &valBytes
392+
case "Unaccepted:":
393+
m.Unaccepted = &val
394+
m.UnacceptedBytes = &valBytes
365395
case "HugePages_Total:":
366396
m.HugePagesTotal = &val
367397
case "HugePages_Free:":
@@ -373,6 +403,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
373403
case "Hugepagesize:":
374404
m.Hugepagesize = &val
375405
m.HugepagesizeBytes = &valBytes
406+
case "Hugetlb:":
407+
m.Hugetlb = &val
408+
m.HugetlbBytes = &valBytes
376409
case "DirectMap4k:":
377410
m.DirectMap4k = &val
378411
m.DirectMap4kBytes = &valBytes

0 commit comments

Comments
 (0)