mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 00:07:33 +00:00
stats.lua: page 2 - frame timing: use fixed display order
Page 2 displays the frame timing info for each type (currently "Fresh" and "Redraw"), but since they're unordered keys of a map, their iteration order and hence their order on screen could (and did) change depending on $things, which was annoying. haasn thinks none of them should be considered more important (and therefore maybe worthy of being displayed on top), so we go with lexicographic order, which currently means that "Fresh" is first. Fixes #9901
This commit is contained in:
parent
37927b65f7
commit
57f42cee84
@ -280,6 +280,14 @@ local function append_property(s, prop, attr, excluded)
|
||||
return append(s, ret, attr)
|
||||
end
|
||||
|
||||
local function sorted_keys(t, comp_fn)
|
||||
local keys = {}
|
||||
for k,_ in pairs(t) do
|
||||
keys[#keys+1] = k
|
||||
end
|
||||
table.sort(keys, comp_fn)
|
||||
return keys
|
||||
end
|
||||
|
||||
local function append_perfdata(s, dedicated_page)
|
||||
local vo_p = mp.get_property_native("vo-passes")
|
||||
@ -327,7 +335,8 @@ local function append_perfdata(s, dedicated_page)
|
||||
b("Frame Timings:"), o.prefix_sep, o.font_size * 0.66,
|
||||
"(last/average/peak μs)", o.font_size)
|
||||
|
||||
for frame, data in pairs(vo_p) do
|
||||
for _,frame in ipairs(sorted_keys(vo_p)) do -- ensure fixed display order
|
||||
local data = vo_p[frame]
|
||||
local f = "%s%s%s{\\fn%s}%s / %s / %s %s%s{\\fn%s}%s%s%s"
|
||||
|
||||
if dedicated_page then
|
||||
|
Loading…
Reference in New Issue
Block a user