1
0
Fork 0

New option to display frame latency.

Better property to evaluate simulation performance than frame rate.
This commit is contained in:
ThorstenB 2011-03-28 00:24:32 +02:00
parent 264996bb3c
commit 7299d07dab
5 changed files with 70 additions and 16 deletions

View file

@ -138,6 +138,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
menuEnable("tutorial-start", size(props.globals.getNode("/sim/tutorials", 1).getChildren("tutorial")));
menuEnable("joystick-info", size(props.globals.getNode("/input/joysticks").getChildren("js")));
# frame-per-second display
var fps = props.globals.getNode("/sim/rendering/fps-display", 1);
setlistener(fps, fpsDisplay, 1);
setlistener("/sim/startup/xsize", func {
@ -147,6 +148,16 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
}
});
# frame-latency display
var latency = props.globals.getNode("/sim/rendering/frame-latency-display", 1);
setlistener(latency, latencyDisplay, 1);
setlistener("/sim/startup/xsize", func {
if (latency.getValue()) {
latencyDisplay(0);
latencyDisplay(1);
}
});
# only enable precipitation if gui *and* aircraft want it
var p = "/sim/rendering/precipitation-";
var precip_gui = getprop(p ~ "gui-enable");
@ -197,7 +208,10 @@ var fpsDisplay = func(n) {
var w = isa(n, props.Node) ? n.getValue() : n;
fgcommand(w ? "dialog-show" : "dialog-close", props.Node.new({"dialog-name": "fps"}));
}
var latencyDisplay = func(n) {
var w = isa(n, props.Node) ? n.getValue() : n;
fgcommand(w ? "dialog-show" : "dialog-close", props.Node.new({"dialog-name": "frame-latency"}));
}
##
# How many seconds do we show the tip?

View file

@ -43,6 +43,15 @@
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Show worst-case frame latency</label>
<property>/sim/rendering/frame-latency-display</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Show chat messages</label>
@ -106,7 +115,6 @@
<text>
<label>sec.</label>
</text>
</group>
</group>

View file

@ -18,6 +18,7 @@
<text>
<label>000</label>
<property>/sim/frame-rate</property>
<format>%3.0f</format>
<live>true</live>
<color>
<red>0.9</red>

View file

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<PropertyList>
<name>frame-latency</name>
<x>2</x>
<y>2</y>
<layout>hbox</layout>
<default-padding>0</default-padding>
<font>
<name>HELVETICA_12</name>
</font>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
<alpha>0</alpha>
</color>
<text>
<label>0000 ms</label>
<property>/sim/frame-latency-max-ms</property>
<format>%4.0f ms</format>
<live>true</live>
<color>
<red>0.9</red>
<green>0.4</green>
<blue>0.2</blue>
<alpha>1</alpha>
</color>
</text>
</PropertyList>

View file

@ -131,6 +131,7 @@ Started September 2000 by David Megginson, david@megginson.com
<shader-experimental type="bool" userarchive="y">false</shader-experimental>
<shader-effects type="bool" userarchive="y">true</shader-effects>
<fps-display type="bool" userarchive="y">false</fps-display>
<frame-latency-display type="bool" userarchive="y">false</frame-latency-display>
<on-screen-statistics type="int">0</on-screen-statistics>
<glide-slope-tunnel type="bool" userarchive="y">false</glide-slope-tunnel>
<redout>