浏览器端反馈控制

This commit is contained in:
2026-08-11 11:57:59 +08:00
parent 6c8c205e86
commit 67f93307e2
5 changed files with 179 additions and 16 deletions
+26 -2
View File
@@ -289,20 +289,44 @@ class GalleryCard {
updateObserverDashboard(observer) {
const nanosecondFields = new Set([
"paint_duration_ns", "render_duration_ns", "target_interval_ns",
"bottleneck_duration_ns", "consumer_sample_interval_ns", "consumer_smoothed_interval_ns",
"bottleneck_duration_ns", "consumer_pixel_interval_ns", "consumer_presentation_interval_ns",
"consumer_manual_interval_ns", "consumer_sample_interval_ns", "consumer_smoothed_interval_ns",
"consumer_variation_ns", "consumer_safety_interval_ns", "consumer_interval_ns", "next_refresh_interval_ns", "paint_lease_wait_ns",
"paint_state_wait_ns", "publish_state_wait_ns", "ready_wait_ns",
"frame_age_at_render_ns", "render_lease_wait_ns", "render_state_wait_ns",
"render_finish_state_wait_ns", "queue_wait_ns", "end_to_end_ns"
]);
const booleanFields = new Set([
"consumer_feedback_master_enabled", "consumer_feedback_enabled",
"consumer_pixel_feedback_enabled", "consumer_presentation_feedback_enabled",
"consumer_manual_feedback_enabled"
]);
for (const [name, field] of this.observerFields) {
const raw = observer[name] ?? (name === "limit_state" ? "not_applicable" : name === "last_event" ? "none" : 0);
const raw = observer[name] ?? (name === "limit_state" ? "not_applicable" :
name === "last_event" || name === "consumer_feedback_source" ? "none" : 0);
if (name === "consumer_effective_fps") {
const interval = Number(observer.consumer_interval_ns || 0);
field.textContent = interval > 0 ? `${(1e9 / interval).toFixed(2)} FPS` : "0 FPS";
field.title = interval > 0 ? `${1e9 / interval} FPS` : "0 FPS";
continue;
}
if (name === "consumer_manual_fps") {
field.textContent = `${Number(raw || 0).toFixed(2)} FPS`;
field.title = `${Number(raw || 0)} FPS`;
continue;
}
if (name === "consumer_feedback_source") {
const names = {disabled: "总开关关闭", none: "无", pixel: "像素响应",
presentation: "浏览器呈现", manual: "手动"};
field.textContent = String(raw).split("+").map(value => names[value] || value).join(" + ");
field.title = String(raw);
continue;
}
if (booleanFields.has(name)) {
field.textContent = raw ? "启用" : "关闭";
field.title = String(Boolean(raw));
continue;
}
field.textContent = nanosecondFields.has(name) ? formatNanoseconds(raw) :
name === "configured_frequency_hz" ? (observer.frequency_limit_enabled === false ? "已关闭" : `${Number(raw || 0).toLocaleString()} Hz`) :
typeof raw === "number" ? raw.toLocaleString() : String(raw);
+10
View File
@@ -121,6 +121,16 @@
<div><small>PaintEvent</small><b data-observer-field="paint_duration_ns">0 ns</b></div>
<div><small>后台渲染</small><b data-observer-field="render_duration_ns">0 ns</b></div>
<div><small>内部瓶颈</small><b data-observer-field="bottleneck_duration_ns">0 ns</b></div>
<div><small>消费者总开关</small><b data-observer-field="consumer_feedback_master_enabled">关闭</b></div>
<div><small>Kernel 反馈有效</small><b data-observer-field="consumer_feedback_enabled">关闭</b></div>
<div><small>像素响应反馈</small><b data-observer-field="consumer_pixel_feedback_enabled">关闭</b></div>
<div><small>浏览器呈现反馈</small><b data-observer-field="consumer_presentation_feedback_enabled">关闭</b></div>
<div><small>手动消费者反馈</small><b data-observer-field="consumer_manual_feedback_enabled">关闭</b></div>
<div><small>手动消费者 FPS</small><b data-observer-field="consumer_manual_fps">0 FPS</b></div>
<div><small>生效反馈来源</small><b data-observer-field="consumer_feedback_source">none</b></div>
<div><small>像素响应周期</small><b data-observer-field="consumer_pixel_interval_ns">0 ns</b></div>
<div><small>浏览器呈现周期</small><b data-observer-field="consumer_presentation_interval_ns">0 ns</b></div>
<div><small>手动消费者周期</small><b data-observer-field="consumer_manual_interval_ns">0 ns</b></div>
<div><small>消费者原始采样</small><b data-observer-field="consumer_sample_interval_ns">0 ns</b></div>
<div><small>消费者平滑周期</small><b data-observer-field="consumer_smoothed_interval_ns">0 ns</b></div>
<div><small>消费者抖动</small><b data-observer-field="consumer_variation_ns">0 ns</b></div>