summaryrefslogtreecommitdiffstats
path: root/DOCS
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-04-09 00:27:54 +0200
committerwm4 <wm4@nowhere>2020-04-09 00:33:38 +0200
commitfd3caa264ea0848e7e30db94390063c87e247003 (patch)
tree3eb8268c1afc7a0bab5a544e4664cce23d2ab712 /DOCS
parentc5f8ec76b16268b05d1e3af8f1931eddf5165b8b (diff)
downloadmpv-fd3caa264ea0848e7e30db94390063c87e247003.tar.bz2
mpv-fd3caa264ea0848e7e30db94390063c87e247003.tar.xz
stats: some more performance graphs
Add an infrastructure for collecting performance-related data, use it in some places. Add rendering of them to stats.lua. There were two main goals: minimal impact on the normal code and normal playback. So all these stats_* function calls either happen only during initialization, or return immediately if no stats collection is going on. That's why it does this lazily adding of stats entries etc. (a first iteration made each stats entry an API thing, instead of just a single stats_ctx, but I thought that was getting too intrusive in the "normal" code, even if everything gets worse inside of stats.c). You could get most of this information from various profilers (including the extremely primitive --dump-stats thing in mpv), but this makes it easier to see the most important information at once (at least in theory), partially because we know best about the context of various things. Not very happy with this. It's all pretty primitive and dumb. At this point I just wanted to get over with it, without necessarily having to revisit it later, but with having my stupid statistics. Somehow the code feels terrible. There are a lot of meh decisions in there that could be better or worse (but mostly could be better), and it just sucks but it's also trivial and uninteresting and does the job. I guess I hate programming. It's so tedious and the result is always shit. Anyway, enjoy.
Diffstat (limited to 'DOCS')
-rw-r--r--DOCS/man/input.rst9
-rw-r--r--DOCS/man/stats.rst35
2 files changed, 44 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 958b7a4241..af80052b1d 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2875,6 +2875,15 @@ Property list
Note that directly accessing this structure via subkeys is not supported,
the only access is through aforementioned ``MPV_FORMAT_NODE``.
+``perf-info``
+ Further performance data. Querying this property triggers internal
+ collection of some data, and may slow down the player. Each query will reset
+ some internal state. Property change notification doesn't and won't work.
+ All of this may change in the future, so don't use this. The builtin
+ ``stats`` script is supposed to be the only user; since it's bundled and
+ built with the source code, it can use knowledge of mpv internal to render
+ the information properly. See ``stats`` script description for some details.
+
``video-bitrate``, ``audio-bitrate``, ``sub-bitrate``
Bitrate values calculated on the packet level. This works by dividing the
bit size of all packets between two keyframes by their presentation
diff --git a/DOCS/man/stats.rst b/DOCS/man/stats.rst
index 857fc231e2..603de4ba97 100644
--- a/DOCS/man/stats.rst
+++ b/DOCS/man/stats.rst
@@ -24,6 +24,7 @@ stats:
1 Show usual stats
2 Show frame timings
3 Input cache stats
+4 Internal stuff
==== ==================
Font
@@ -56,6 +57,8 @@ Configurable Options
Default: 2
``key_page_3``
Default: 3
+``key_page_4``
+ Default: 4
Key bindings for page switching while stats are displayed.
@@ -163,3 +166,35 @@ Using ``input.conf``, it is also possible to directly display a certain page::
i script-binding stats/display-page-1
e script-binding stats/display-page-2
+
+Internal stuff page
+~~~~~~~~~~~~~~~~~~~
+
+Most entries shown on this page have rather vague meaning. Likely none of this
+is useful for you. Don't attempt to use it. Forget its existence.
+
+Selecting this for the first time will start collecting some internal
+performance data. That means performance will be slightly lower than normal for
+the rest of the time the player is running (even if the stats page is closed).
+Note that the stats page itself
+
+The displayed information is accumulated over the redraw delay (shown as
+``poll-time`` field).
+
+This adds entries for each Lua script. If there are too many scripts running,
+parts of the list will simply be out of the screen.
+
+If the underlying platform does not support pthread per thread times, the
+displayed times will be 0 or something random (I suspect that at time of this
+writing, only Linux provides the correct via pthread APIs for per thread times).
+
+Most entries are added lazily and only during data collection, which is why
+entries may pop up randomly after some time. It's also why the memory usage
+entries for scripts that have been inactive since the start of data collection
+are missing.
+
+Memory usage is approximate and does not reflect internal fragmentation.
+
+If entries have ``/time`` and ``/cpu`` variants, the former gives the real time
+(monotonic clock), while the latter the thread CPU time (only if the
+corresponding pthread API works and is supported).