diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-15 13:39:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-15 13:39:02 +0200 |
commit | a0b096c88421548593ecebe93bbe369385087f3b (patch) | |
tree | 6a9706d587ea2ff06d1cb7f4c26b712d4ccdd706 /docs | |
parent | 9322179812d3177719c7bab23301646bbf862974 (diff) | |
download | psutil-a0b096c88421548593ecebe93bbe369385087f3b.tar.gz |
[NetBSD] virtual_memory() metrics are completely wrong (#2235), fixes #2234
Match values shown by **htop**. This is before. In here:
* available mem is almost the same as total (unrealistic)
* used is higher than total; there's also a failing test:
```
MEMORY
------
Total : 972.7M
Available : 959.1M
Percent : 1.4
Used : 1.1G
Free : 173.6M
Active : 434.3M
Inactive : 258.4M
Buffers : 509.4M
Cached : 692.9M
Shared : 0.0B
Wired : 280.0K
```
Now:
```
MEMORY
------
Total : 972.7M
Available : 538.1M
Percent : 44.7
Used : 434.5M
Free : 173.6M
Active : 434.2M
Inactive : 258.4M
Buffers : 509.4M
Cached : 692.9M
Shared : 0.0B
Wired : 280.0K
```
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.rst | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/docs/index.rst b/docs/index.rst index dfca444d..2a1c5b6a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -334,18 +334,20 @@ Memory .. function:: virtual_memory() Return statistics about system memory usage as a named tuple including the - following fields, expressed in bytes. Main metrics: + following fields, expressed in bytes. + + Main metrics: - **total**: total physical memory (exclusive swap). - **available**: the memory that can be given instantly to processes without the system going into swap. - This is calculated by summing different memory values depending on the - platform and it is supposed to be used to monitor actual memory usage in a - cross platform fashion. + This is calculated by summing different memory metrics that vary depending + on the platform. It is supposed to be used to monitor actual memory usage + in a cross platform fashion. + - **percent**: the percentage usage calculated as ``(total - available) / total * 100``. Other metrics: - - **percent**: the percentage usage calculated as ``(total - available) / total * 100`` - **used**: memory used, calculated differently depending on the platform and designed for informational purposes only. **total - free** does not necessarily match **used**. @@ -370,7 +372,8 @@ Memory human readable form. .. note:: if you just want to know how much physical memory is left in a - cross platform fashion simply rely on the **available** field. + cross platform fashion simply rely on **available** and **percent** + fields. >>> import psutil >>> mem = psutil.virtual_memory() |