add machine_id
This commit is contained in:
@@ -14,6 +14,10 @@ func NewMemoryInfo() models.MemoryInfo {
|
||||
Total: 0,
|
||||
Free: 0,
|
||||
Available: 0,
|
||||
Used: 0,
|
||||
Buffers: 0,
|
||||
Cached: 0,
|
||||
Shared: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +50,18 @@ func GetMemoryInfo() models.MemoryInfo {
|
||||
memInfo.Free = value
|
||||
case "MemAvailable:":
|
||||
memInfo.Available = value
|
||||
case "Buffers:":
|
||||
memInfo.Buffers = value // 存储 Buffers 值
|
||||
case "Cached:":
|
||||
memInfo.Cached = value // 存储 Cached 值
|
||||
case "Shmem:":
|
||||
memInfo.Shared = value // 存储 Shared 值
|
||||
}
|
||||
}
|
||||
|
||||
// 计算已用内存
|
||||
memInfo.Used = memInfo.Total - memInfo.Free - memInfo.Buffers - memInfo.Cached - memInfo.Shared
|
||||
|
||||
return memInfo
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user