aboutsummaryrefslogtreecommitdiffhomepage
path: root/player
diff options
context:
space:
mode:
authorGravatar Julian <MyFakeAcc.4@googlemail.com>2017-09-17 01:21:44 +0200
committerGravatar wm4 <wm4@nowhere>2017-10-09 20:40:32 +0200
commiteadec19d22b644bc90463915b99cafbfbdb65cea (patch)
treef39f6c51cf751bd183a7dffafc0b1aed404bdc98 /player
parent54b3a9fdb004a85340e502a0e5af27b80c939694 (diff)
stats: stop coloring timing values
It used a bad heuristic that got even worse/less reliable with recent changes in mpv. In fact, it's not reliable at all. Watch out for dropped frames instead. That's a useful indicator.
Diffstat (limited to 'player')
-rw-r--r--player/lua/stats.lua34
1 files changed, 8 insertions, 26 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua
index 217fa09edc..cc81424646 100644
--- a/player/lua/stats.lua
+++ b/player/lua/stats.lua
@@ -21,8 +21,6 @@ local o = {
duration = 4,
redraw_delay = 1, -- acts as duration in the toggling case
ass_formatting = true,
- timing_warning = true,
- timing_warning_th = 0.85, -- *no* warning threshold (warning when > target_fps * timing_warning_th)
print_perfdata_passes = false, -- when true, print the full information about all passes
filter_params_max_length = 100, -- a filter list longer than this many characters will be shown one filter per line instead
debug = false,
@@ -294,26 +292,10 @@ local function append_perfdata(s, dedicated_page)
end
end
- -- Highlight i with a red border when t exceeds the time for one frame
- -- or yellow when it exceeds a given threshold
- local function hl(i, t)
- if t == nil then
- t = i
- end
-
+ -- Pretty print measured time
+ local function pp(i)
-- rescale to microseconds for a saner display
- i = i / 1000
-
- if o.timing_warning and target_fps > 0 then
- if t > target_fps then
- return format("{\\bord0.5}{\\3c&H0000FF&}%05d{\\bord%s}{\\3c&H%s&}",
- i, o.border_size, o.border_color)
- elseif t > (target_fps * o.timing_warning_th) then
- return format("{\\bord0.5}{\\1c&H00DDDD&}%05d{\\bord%s}{\\1c&H%s&}",
- i, o.border_size, o.font_color)
- end
- end
- return format("%05d", i)
+ return format("%05d", i / 1000)
end
-- Format n/m with a font weight based on the ratio
@@ -340,8 +322,8 @@ local function append_perfdata(s, dedicated_page)
for _, pass in ipairs(data) do
s[#s+1] = format(f, o.nl, o.indent, o.indent,
- o.font_mono, hl(pass["last"], last_s[frame]),
- hl(pass["avg"], avg_s[frame]), hl(pass["peak"]),
+ o.font_mono, pp(pass["last"]),
+ pp(pass["avg"]), pp(pass["peak"]),
o.prefix_sep .. o.prefix_sep, p(pass["last"], last_s[frame]),
o.font, o.prefix_sep, o.prefix_sep, pass["desc"])
@@ -354,13 +336,13 @@ local function append_perfdata(s, dedicated_page)
-- Print sum of timing values as "Total"
s[#s+1] = format(f, o.nl, o.indent, o.indent,
- o.font_mono, hl(last_s[frame]),
- hl(avg_s[frame]), hl(peak_s[frame]), "", "", o.font,
+ o.font_mono, pp(last_s[frame]),
+ pp(avg_s[frame]), pp(peak_s[frame]), "", "", o.font,
o.prefix_sep, o.prefix_sep, b("Total"))
else
-- for the simplified view, we just print the sum of each pass
s[#s+1] = format(f, o.nl, o.indent, o.indent, o.font_mono,
- hl(last_s[frame]), hl(avg_s[frame]), hl(peak_s[frame]),
+ pp(last_s[frame]), pp(avg_s[frame]), pp(peak_s[frame]),
"", "", o.font, o.prefix_sep, o.prefix_sep,
frame:gsub("^%l", string.upper))
end