Skip to content

Commit

Permalink
Markdown linter
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-savelyevv committed Jul 26, 2024
1 parent 2133ed9 commit b5e4267
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
## Memory Monitor

Memory Monitor is a tool that can be used to measure python program RAM footprint in time. It supports multiple memory types:

- `MemoryType.RSS`: Resident Set Size is the portion of memory occupied by a process that is held in RAM.

- `MemoryType.RSS_TOP`: The same type of memory as above, but the values are parsed from a table output of the *top* command. Usually, reports the same values as RSS, but with worse resolution.

- `MemoryType.SYSTEM`: This metric is defined as the difference between total system virtual memory and system available memory. Be aware, that this way it is affected by other processes that can change RAM availability. It is advised to call `get_data(memory_from_zero=True)` for this type of memory logging, if one is interested in memory footprint for a certain process. This subtracts the starting memory from all values.

RSS and SYSTEM behave differently when mmap is used, e.g. during OV model loading. RSS will report data which was read with mmap enabled as allocated, however this is not necessarily the case. SYSTEM does not report memory loaded with mmap. So it can be used to analyze "pure" memory usage without contribution of mmap pages which most probably will actually be free, but are reported as allocated by RSS.

It is advised to use `MemoryType.SYSTEM` when analyzing memory of python scripts involving OpenVINO model reading. Also, memory monitor itself allocates some memory itself, especially during figure saving. It is advised to use it for measuring large memory processes.

An example usage of memory monitor tool:

```python
import gc
import time
Expand Down Expand Up @@ -54,4 +58,4 @@ gc.collect()
time.sleep(1)
```

After this code is finished, there will be 3 pairs of files at `./memory_logs` folder. Each pair corresponds to each memory monitor configuration and consists of a .txt file with time-memory values and a .png plot file displaying these values.
After this code is finished, there will be 3 pairs of files at `./memory_logs` folder. Each pair corresponds to each memory monitor configuration and consists of a .txt file with time-memory values and a .png plot file displaying these values.

0 comments on commit b5e4267

Please sign in to comment.