diff options
author | Julian <MyFakeAcc.4@googlemail.com> | 2016-07-13 16:08:16 +0900 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-10-09 20:40:31 +0200 |
commit | 8bbbab95238f0c0e2172bd26b640722eac19e3d5 (patch) | |
tree | b651b52eb861dfbb6687a04bd8f1645c6a4c32bd | |
parent | 485c3549d7a340165d20bc635f845eb0e7f6b154 (diff) | |
download | mpv-8bbbab95238f0c0e2172bd26b640722eac19e3d5.tar.bz2 mpv-8bbbab95238f0c0e2172bd26b640722eac19e3d5.tar.xz |
stats: change highlighting of performance data
Add a yellow highlight to the existing red highlight.
Red is still used once the available time is exhausted, yellow is
supposed to be a warning when the headroom is getting small.
The threshold is configurable.
-rw-r--r-- | player/lua/stats.lua | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 9a70851d74..190a468282 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -17,7 +17,6 @@ local o = { duration = 3, redraw_delay = 1, -- acts as duration in the toggling case - timing_warning = true, ass_formatting = true, debug = false, @@ -25,6 +24,8 @@ local o = { plot_graphs = true, skip_frames = 5, global_max = true, + timing_warning = true, + timing_warning_th = 0.85, -- *no* warning threshold (warning when > dfps * timing_warning_th) plot_bg_border_color = "0000FF", plot_bg_color = "262626", plot_color = "FFFFFF", @@ -178,10 +179,16 @@ local function append_perfdata(s) local peak_s = vo_p["render-peak"] + vo_p["present-peak"] + vo_p["upload-peak"] -- 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 o.timing_warning and t > dfps and dfps > 0 then - return format("{\\bord0.5}{\\3c&H0000FF&}%05d{\\bord%s}{\\3c&H%s&}", - i, o.border_size, o.border_color) + if o.timing_warning and dfps > 0 then + if t > dfps then + return format("{\\bord0.5}{\\3c&H0000FF&}%05d{\\bord%s}{\\3c&H%s&}", + i, o.border_size, o.border_color) + elseif t > (dfps * 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) end |