mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 11:29:48 +08:00
Fix get container mem usage (#10796)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
parent
b5fc643efd
commit
9a0d1d1e74
@ -57,5 +57,11 @@ func GetContainerMemUsed() (uint64, error) {
|
||||
if stats.Memory == nil || stats.Memory.Usage == nil {
|
||||
return 0, errors.New("cannot find memory usage info from cGroups")
|
||||
}
|
||||
return stats.Memory.Usage.Usage, nil
|
||||
// ref: <https://github.com/docker/cli/blob/e57b5f78de635e6e2b688686d10b830c4747c4dc/cli/command/container/stats_helpers.go#L239>
|
||||
inactiveFile := stats.Memory.InactiveFile
|
||||
usage := stats.Memory.Usage.Usage
|
||||
if inactiveFile < usage {
|
||||
return usage - inactiveFile, nil
|
||||
}
|
||||
return usage, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user