mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Make the testing destination customizable
This commit is contained in:
parent
66235acac2
commit
8f91768bc0
1 changed files with 76 additions and 46 deletions
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
@ -8,67 +9,68 @@ Rectangle {
|
||||||
|
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
property var values: [];
|
property var values: [];
|
||||||
property var host: AddressManager.hostname
|
property alias destination: addressLine.text
|
||||||
|
readonly property string nullDestination: "169.254.0.1"
|
||||||
|
property bool running: false
|
||||||
|
|
||||||
|
function statusReport() {
|
||||||
Component.onCompleted: {
|
console.log("PERF status connected: " + AddressManager.isConnected);
|
||||||
Window.domainChanged.connect(function(newDomain){
|
|
||||||
if (newDomain !== root.host) {
|
|
||||||
root.host = AddressManager.hostname;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onHostChanged: {
|
Timer {
|
||||||
if (root.running) {
|
id: readyStateTimer
|
||||||
if (host !== "Dreaming" && host !== "Playa") {
|
interval: 500
|
||||||
|
repeat: true
|
||||||
|
running: false
|
||||||
|
onTriggered: {
|
||||||
|
if (!root.running) {
|
||||||
|
stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("PERF new domain " + host)
|
if (AddressManager.isConnected) {
|
||||||
if (host === "Dreaming") {
|
console.log("PERF already connected, disconnecting");
|
||||||
AddressManager.handleLookupString("Playa");
|
AddressManager.handleLookupString(root.nullDestination);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop();
|
||||||
|
console.log("PERF disconnected, moving to target " + root.destination);
|
||||||
|
AddressManager.handleLookupString(root.destination);
|
||||||
|
|
||||||
if (host === "Playa") {
|
// If we've arrived, start running the test
|
||||||
console.log("PERF starting timers and frame timing");
|
console.log("PERF starting timers and frame timing");
|
||||||
// If we've arrived, start running the test
|
FrameTimings.start();
|
||||||
FrameTimings.start();
|
rotationTimer.start();
|
||||||
rotationTimer.start();
|
stopTimer.start();
|
||||||
stopTimer.start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function startTest() {
|
function startTest() {
|
||||||
console.log("PERF startTest()");
|
console.log("PERF startTest()");
|
||||||
root.running = true
|
if (!root.running) {
|
||||||
console.log("PERF current host: " + AddressManager.hostname)
|
root.running = true
|
||||||
// If we're already in playa, we need to go somewhere else...
|
readyStateTimer.start();
|
||||||
if ("Playa" === AddressManager.hostname) {
|
|
||||||
console.log("PERF Navigating to dreaming")
|
|
||||||
AddressManager.handleLookupString("Dreaming/0,0,0");
|
|
||||||
} else {
|
|
||||||
console.log("PERF Navigating to playa")
|
|
||||||
AddressManager.handleLookupString("Playa");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopTest() {
|
function stopTest() {
|
||||||
console.log("PERF stopTest()");
|
console.log("PERF stopTest()");
|
||||||
root.running = false;
|
if (root.running) {
|
||||||
stopTimer.stop();
|
root.running = false;
|
||||||
rotationTimer.stop();
|
stopTimer.stop();
|
||||||
FrameTimings.finish();
|
rotationTimer.stop();
|
||||||
root.values = FrameTimings.getValues();
|
FrameTimings.finish();
|
||||||
AddressManager.handleLookupString("Dreaming/0,0,0");
|
root.values = FrameTimings.getValues();
|
||||||
resultGraph.requestPaint();
|
AddressManager.handleLookupString(root.nullDestination);
|
||||||
console.log("PERF Value Count: " + root.values.length);
|
resultGraph.requestPaint();
|
||||||
console.log("PERF Max: " + FrameTimings.max);
|
console.log("PERF Value Count: " + root.values.length);
|
||||||
console.log("PERF Min: " + FrameTimings.min);
|
console.log("PERF Max: " + FrameTimings.max);
|
||||||
console.log("PERF Avg: " + FrameTimings.mean);
|
console.log("PERF Min: " + FrameTimings.min);
|
||||||
console.log("PERF StdDev: " + FrameTimings.standardDeviation);
|
console.log("PERF Avg: " + FrameTimings.mean);
|
||||||
|
console.log("PERF StdDev: " + FrameTimings.standardDeviation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function yaw(a) {
|
function yaw(a) {
|
||||||
|
@ -82,7 +84,6 @@ Rectangle {
|
||||||
MyAvatar.setOrientationVar(yaw(Date.now() / 1000));
|
MyAvatar.setOrientationVar(yaw(Date.now() / 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool running: false
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: stopTimer
|
id: stopTimer
|
||||||
|
@ -102,14 +103,43 @@ Rectangle {
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: row
|
id: row
|
||||||
anchors { left: parent.left; right: parent.right; }
|
anchors { left: parent.left; right: parent.right; top: parent.top; margins: 16 }
|
||||||
spacing: 8
|
spacing: 8
|
||||||
Button {
|
Button {
|
||||||
text: root.running ? "Stop" : "Run"
|
text: root.running ? "Stop" : "Run"
|
||||||
onClicked: root.running ? stopTest() : startTest();
|
onClicked: root.running ? stopTest() : startTest();
|
||||||
}
|
}
|
||||||
|
Button {
|
||||||
|
text: "Disconnect"
|
||||||
|
onClicked: AddressManager.handleLookupString(root.nullDestination);
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
text: "Connect"
|
||||||
|
onClicked: AddressManager.handleLookupString(root.destination);
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
text: "Status"
|
||||||
|
onClicked: statusReport();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: addressLine
|
||||||
|
focus: true
|
||||||
|
anchors {
|
||||||
|
left: parent.left; right: parent.right;
|
||||||
|
top: row.bottom; margins: 16;
|
||||||
|
}
|
||||||
|
text: "Playa"
|
||||||
|
onTextChanged: console.log("PERF new target " + text);
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
category: "Qml.Performance.RenderTest"
|
||||||
|
property alias destination: addressLine.text
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Rectangle {
|
// Rectangle {
|
||||||
// anchors { left: parent.left; right: parent.right; top: row.bottom; topMargin: 8; bottom: parent.bottom; }
|
// anchors { left: parent.left; right: parent.right; top: row.bottom; topMargin: 8; bottom: parent.bottom; }
|
||||||
// //anchors.fill: parent
|
// //anchors.fill: parent
|
||||||
|
@ -130,7 +160,7 @@ Rectangle {
|
||||||
|
|
||||||
Canvas {
|
Canvas {
|
||||||
id: resultGraph
|
id: resultGraph
|
||||||
anchors { left: parent.left; right: parent.right; top: row.bottom; margins: 16; bottom: parent.bottom; }
|
anchors { left: parent.left; right: parent.right; top: addressLine.bottom; margins: 16; bottom: parent.bottom; }
|
||||||
property real maxValue: 200;
|
property real maxValue: 200;
|
||||||
property real perFrame: 10000;
|
property real perFrame: 10000;
|
||||||
property real k1: (5 / maxValue) * height;
|
property real k1: (5 / maxValue) * height;
|
||||||
|
|
Loading…
Reference in a new issue