Closed mkanet closed 1 year ago
Hi @mkanet
your assumption are ok. The VIRT and RES memory are computed as following:
"memory_info": [
418680832, #<---RES
414109696, #<---VERT
793086,
418738176,
418680832,
202112,
185488,
536500,
72048,
414109696,
414224384,
414109696
]
Stat are given in bytes and are converted by Glances in a user friendly unit. using the auto_unit internal function (https://github.com/nicolargo/glances/blob/develop/glances/plugins/plugin/model.py#L1040).
Under the wood, the stats are grabbed from the PSUtil memory_info function (https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_info).
Good point for the new version of the API (Glances v4) to clarify the data !
Example of new data mode:
{
'<pid>': {
'cpu_percent': ...,
'mem_percent': ...,
'mem_virt': ...,
'mem_res': ...,
...
}
}
@nicolargo thank you for confirming!
PS: Is Glances version 4.0.0 API backward-compatible with 3rd party applications that access Glances 3.x API?
Assuming Glances webpage displays this:
...and Glances API returns the respective json data below.
QUESTION: How do I calculate the
VIRT
andRES
values in the screenshot above using the sample API JSON response below? I'm assuming that they should be calculated from values inmemory_info
below and also maybetime_since_update
? There are several values listed inmemory_info
which makes it confusing.UPDATE:
Presuming:
python.exe glances process RES = ((418680832 / 1024) / 1024) = 399.28515625 399M
VIRT = ((414109696 / 1024) / 1024) = 394.92578125 385M
Presuming:
vmware-vmx.exe RES = ((2189692928 / 1024) / 1024) = 2,088.25390625 2,088M also 2.04G
VIRT = ((414109696 / 1024) / 1024) = 44.921875 44.9M