Collect Active(anon), Inactive(anon) and Unevictable in /proc/meminfo
These fields helps people understand anonymous memory usage pattern.
This commit is contained in:
parent
0d7dd621d2
commit
3695635d09
|
@ -16,6 +16,9 @@ import (
|
||||||
type VirtualMemoryExStat struct {
|
type VirtualMemoryExStat struct {
|
||||||
ActiveFile uint64 `json:"activefile"`
|
ActiveFile uint64 `json:"activefile"`
|
||||||
InactiveFile uint64 `json:"inactivefile"`
|
InactiveFile uint64 `json:"inactivefile"`
|
||||||
|
ActiveAnon uint64 `json:"activeanon"`
|
||||||
|
InactiveAnon uint64 `json:"inactiveanon"`
|
||||||
|
Unevictable uint64 `json:"unevictable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func VirtualMemory() (*VirtualMemoryStat, error) {
|
func VirtualMemory() (*VirtualMemoryStat, error) {
|
||||||
|
@ -64,12 +67,18 @@ func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {
|
||||||
ret.Active = t * 1024
|
ret.Active = t * 1024
|
||||||
case "Inactive":
|
case "Inactive":
|
||||||
ret.Inactive = t * 1024
|
ret.Inactive = t * 1024
|
||||||
|
case "Active(anon)":
|
||||||
|
retEx.ActiveAnon = t * 1024
|
||||||
|
case "Inactive(anon)":
|
||||||
|
retEx.InactiveAnon = t * 1024
|
||||||
case "Active(file)":
|
case "Active(file)":
|
||||||
activeFile = true
|
activeFile = true
|
||||||
retEx.ActiveFile = t * 1024
|
retEx.ActiveFile = t * 1024
|
||||||
case "Inactive(file)":
|
case "Inactive(file)":
|
||||||
inactiveFile = true
|
inactiveFile = true
|
||||||
retEx.InactiveFile = t * 1024
|
retEx.InactiveFile = t * 1024
|
||||||
|
case "Unevictable":
|
||||||
|
retEx.Unevictable = t * 1024
|
||||||
case "Writeback":
|
case "Writeback":
|
||||||
ret.Writeback = t * 1024
|
ret.Writeback = t * 1024
|
||||||
case "WritebackTmp":
|
case "WritebackTmp":
|
||||||
|
|
Loading…
Reference in New Issue