diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-04-11 03:56:12 +0300 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2020-11-15 20:36:04 +0200 |
commit | 932c1ada0f9b0f7078c09ef0179119c838eef84a (patch) | |
tree | 3628d293f6b3f449dd5e5b3898955f147addc112 /options | |
parent | cc25137eaec92bcbe6c20632c644bfa9a2369a6a (diff) | |
download | mpv-932c1ada0f9b0f7078c09ef0179119c838eef84a.tar.bz2 mpv-932c1ada0f9b0f7078c09ef0179119c838eef84a.tar.xz |
js: report scripts CPU/memory usage statistics
This can be viewed at page 4 of the internal stats display (i or I).
CPU time report is the same as at lua.c, but untested - doesn't seem
to work on windows - also not for lua.
TL;DR: Set env MPV_LEAK_REPORT=1 to enable js memory reporting stats.
This also almost doubles the memory usage by js scripts.
For memory reporting, we don't have enough info by default, because
even when using a custom allocator, mujs doesn't report the old size
(on free or realloc) because it doesn't track this value, and as
a result we can't track the overall size.
Our option are either to track the size of each allocation on our own,
or use talloc which tracks this value.
However, using talloc for mujs allocations adds a considerable
overhead, and almost doubles(!) the overall memory used, because each
individual allocation includes a considerable talloc header, and mujs
does many small allocations.
So our solution is that by default we behave like previously - not
using a custom allocator with mujs, and stats does not display memory
usage for js scripts.
However, if the env var MPV_LEAK_REPORT is set to 1, then we use
a custom allocator with talloc and track/report memory usage.
We can't switch allocator at runtime, so an mpv instance either tracks
or doesn't track js scripts memory usage, according to the env var.
(we could use a property and apply it whenever a new script starts,
so that it could change for newly launched scripts, but we don't).
Diffstat (limited to 'options')
0 files changed, 0 insertions, 0 deletions