mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into fix/asset-request-crash
This commit is contained in:
commit
3b5b6a2609
13 changed files with 299 additions and 70 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;
|
||||||
|
|
49
examples/utilities/render/rates.qml
Normal file
49
examples/utilities/render/rates.qml
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
//
|
||||||
|
// stats.qml
|
||||||
|
// examples/utilities/cache
|
||||||
|
//
|
||||||
|
// Created by Zach Pomerantz on 4/1/2016
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
import QtQuick 2.5
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import "../lib/plotperf"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
property var caches: [ ["Present", "present"], ["Present", "present"], ["New", "newFrame"], ["Dropped", "dropped"], ["Simulation", "simulation"], ["Avatar", "avatar"] ]
|
||||||
|
property var colors: [ "#1AC567", "#00B4EF" ]
|
||||||
|
|
||||||
|
Grid {
|
||||||
|
id: grid
|
||||||
|
rows: (root.caches.length / 2); columns: 2; spacing: 8
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: repeater
|
||||||
|
|
||||||
|
model: root.caches
|
||||||
|
|
||||||
|
Row {
|
||||||
|
PlotPerf {
|
||||||
|
title: modelData[0] + " Rate"
|
||||||
|
height: (grid.height - (grid.spacing * ((root.caches.length / 2) + 1))) / (root.caches.length / 2)
|
||||||
|
width: grid.width / 2 - grid.spacing * 1.5
|
||||||
|
object: Rates
|
||||||
|
valueScale: 1
|
||||||
|
valueUnit: "fps"
|
||||||
|
valueNumDigits: "2"
|
||||||
|
plots: [{
|
||||||
|
prop: modelData[1],
|
||||||
|
color: root.colors[index % 2]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
examples/utilities/render/renderRates.js
Normal file
21
examples/utilities/render/renderRates.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// cacheStats.js
|
||||||
|
// examples/utilities/cache
|
||||||
|
//
|
||||||
|
// Zach Pomerantz, created on 4/1/2016.
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
// Set up the qml ui
|
||||||
|
var qml = Script.resolvePath('rates.qml');
|
||||||
|
var window = new OverlayWindow({
|
||||||
|
title: 'Render Rates',
|
||||||
|
source: qml,
|
||||||
|
width: 300,
|
||||||
|
height: 200
|
||||||
|
});
|
||||||
|
window.setPosition(500, 50);
|
||||||
|
window.closed.connect(function() { Script.stop(); });
|
67
interface/resources/qml/controls-uit/TextAction.qml
Normal file
67
interface/resources/qml/controls-uit/TextAction.qml
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
//
|
||||||
|
// TextField.qml
|
||||||
|
//
|
||||||
|
// Created by David Rowe on 21 Apr 2016
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
import QtQuick 2.5
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
|
||||||
|
import "../styles-uit"
|
||||||
|
import "../controls-uit" as HifiControls
|
||||||
|
|
||||||
|
Item {
|
||||||
|
property string icon: ""
|
||||||
|
property int iconSize: 30
|
||||||
|
property string text: ""
|
||||||
|
|
||||||
|
property int colorScheme: hifi.colorSchemes.light
|
||||||
|
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
|
||||||
|
|
||||||
|
signal clicked()
|
||||||
|
|
||||||
|
height: Math.max(glyph.visible ? glyph.height - 4 : 0, string.visible ? string.height : 0)
|
||||||
|
width: glyph.width + string.anchors.leftMargin + string.width
|
||||||
|
|
||||||
|
HiFiGlyphs {
|
||||||
|
id: glyph
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: -2
|
||||||
|
text: parent.icon
|
||||||
|
size: parent.iconSize
|
||||||
|
color: isLightColorScheme
|
||||||
|
? (mouseArea.containsMouse ? hifi.colors.baseGrayHighlight : hifi.colors.lightGray)
|
||||||
|
: (mouseArea.containsMouse ? hifi.colors.faintGray : hifi.colors.lightGrayText)
|
||||||
|
visible: text !== ""
|
||||||
|
width: visible ? implicitWidth : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
RalewaySemiBold {
|
||||||
|
id: string
|
||||||
|
anchors {
|
||||||
|
left: glyph.visible ? glyph.right : parent.left
|
||||||
|
leftMargin: visible && glyph.visible ? hifi.dimensions.contentSpacing.x : 0
|
||||||
|
verticalCenter: glyph.visible ? glyph.verticalCenter : undefined
|
||||||
|
}
|
||||||
|
text: parent.text
|
||||||
|
size: hifi.fontSizes.inputLabel
|
||||||
|
color: isLightColorScheme
|
||||||
|
? (mouseArea.containsMouse ? hifi.colors.baseGrayHighlight : hifi.colors.lightGray)
|
||||||
|
: (mouseArea.containsMouse ? hifi.colors.faintGray : hifi.colors.lightGrayText)
|
||||||
|
font.underline: true;
|
||||||
|
visible: text !== ""
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onClicked: parent.clicked()
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ Window {
|
||||||
resizable: true
|
resizable: true
|
||||||
destroyOnInvisible: true
|
destroyOnInvisible: true
|
||||||
x: 40; y: 40
|
x: 40; y: 40
|
||||||
implicitWidth: 400; implicitHeight: 695
|
implicitWidth: 400; implicitHeight: 728
|
||||||
minSize: Qt.vector2d(200, 300)
|
minSize: Qt.vector2d(200, 300)
|
||||||
|
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
@ -236,7 +236,23 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.VerticalSpacer { }
|
HifiControls.VerticalSpacer {
|
||||||
|
height: hifi.dimensions.controlInterlineHeight - 3
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControls.TextAction {
|
||||||
|
id: directoryButton
|
||||||
|
icon: hifi.glyphs.script
|
||||||
|
iconSize: 24
|
||||||
|
text: "Reveal Scripts Folder"
|
||||||
|
onClicked: fileDialogHelper.openScriptsDirectory()
|
||||||
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
anchors.left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControls.VerticalSpacer {
|
||||||
|
height: hifi.dimensions.controlInterlineHeight - 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,7 @@
|
||||||
#include "scripting/WebWindowClass.h"
|
#include "scripting/WebWindowClass.h"
|
||||||
#include "scripting/WindowScriptingInterface.h"
|
#include "scripting/WindowScriptingInterface.h"
|
||||||
#include "scripting/ControllerScriptingInterface.h"
|
#include "scripting/ControllerScriptingInterface.h"
|
||||||
|
#include "scripting/RatesScriptingInterface.h"
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
#include "SpeechRecognizer.h"
|
#include "SpeechRecognizer.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1384,6 +1385,7 @@ void Application::initializeUi() {
|
||||||
rootContext->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
|
rootContext->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
|
||||||
rootContext->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
rootContext->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
||||||
rootContext->setContextProperty("FrameTimings", &_frameTimingsScriptingInterface);
|
rootContext->setContextProperty("FrameTimings", &_frameTimingsScriptingInterface);
|
||||||
|
rootContext->setContextProperty("Rates", new RatesScriptingInterface(this));
|
||||||
|
|
||||||
rootContext->setContextProperty("TREE_SCALE", TREE_SCALE);
|
rootContext->setContextProperty("TREE_SCALE", TREE_SCALE);
|
||||||
rootContext->setContextProperty("Quat", new Quat());
|
rootContext->setContextProperty("Quat", new Quat());
|
||||||
|
@ -4439,6 +4441,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
||||||
// AvatarManager has some custom types
|
// AvatarManager has some custom types
|
||||||
AvatarManager::registerMetaTypes(scriptEngine);
|
AvatarManager::registerMetaTypes(scriptEngine);
|
||||||
|
|
||||||
|
scriptEngine->registerGlobalObject("Rates", new RatesScriptingInterface(this));
|
||||||
|
|
||||||
// hook our avatar and avatar hash map object into this script engine
|
// hook our avatar and avatar hash map object into this script engine
|
||||||
scriptEngine->registerGlobalObject("MyAvatar", getMyAvatar());
|
scriptEngine->registerGlobalObject("MyAvatar", getMyAvatar());
|
||||||
qScriptRegisterMetaType(scriptEngine, audioListenModeToScriptValue, audioListenModeFromScriptValue);
|
qScriptRegisterMetaType(scriptEngine, audioListenModeToScriptValue, audioListenModeFromScriptValue);
|
||||||
|
|
|
@ -254,10 +254,7 @@ void AvatarManager::clearAllAvatars() {
|
||||||
|
|
||||||
QWriteLocker locker(&_hashLock);
|
QWriteLocker locker(&_hashLock);
|
||||||
|
|
||||||
_myAvatar->die();
|
handleRemovedAvatar(_myAvatar);
|
||||||
_myAvatar.reset();
|
|
||||||
|
|
||||||
_avatarHash.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarManager::setLocalLights(const QVector<AvatarManager::LocalLight>& localLights) {
|
void AvatarManager::setLocalLights(const QVector<AvatarManager::LocalLight>& localLights) {
|
||||||
|
|
37
interface/src/scripting/RatesScriptingInterface.h
Normal file
37
interface/src/scripting/RatesScriptingInterface.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
//
|
||||||
|
// RatesScriptingInterface.h
|
||||||
|
// interface/src/scripting
|
||||||
|
//
|
||||||
|
// Created by Zach Pomerantz on 4/20/16.
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HIFI_RATES_SCRIPTING_INTERFACE_H
|
||||||
|
#define HIFI_RATES_SCRIPTING_INTERFACE_H
|
||||||
|
|
||||||
|
#include <display-plugins/DisplayPlugin.h>
|
||||||
|
|
||||||
|
class RatesScriptingInterface : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(float render READ getRenderRate)
|
||||||
|
Q_PROPERTY(float present READ getPresentRate)
|
||||||
|
Q_PROPERTY(float newFrame READ getNewFrameRate)
|
||||||
|
Q_PROPERTY(float dropped READ getDropRate)
|
||||||
|
Q_PROPERTY(float simulation READ getSimulationRate)
|
||||||
|
Q_PROPERTY(float avatar READ getAvatarRate)
|
||||||
|
|
||||||
|
public:
|
||||||
|
RatesScriptingInterface(QObject* parent) : QObject(parent) {}
|
||||||
|
float getRenderRate() { return qApp->getFps(); }
|
||||||
|
float getPresentRate() { return qApp->getActiveDisplayPlugin()->presentRate(); }
|
||||||
|
float getNewFrameRate() { return qApp->getActiveDisplayPlugin()->newFramePresentRate(); }
|
||||||
|
float getDropRate() { return qApp->getActiveDisplayPlugin()->droppedFrameRate(); }
|
||||||
|
float getSimulationRate() { return qApp->getAverageSimsPerSecond(); }
|
||||||
|
float getAvatarRate() { return qApp->getAvatarSimrate(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HIFI_INTERFACE_RATES_SCRIPTING_INTERFACE_H
|
|
@ -1,6 +1,5 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
#line __LINE__
|
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
// stars.frag
|
// stars.frag
|
||||||
// fragment shader
|
// fragment shader
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#define hifi_Shared_RateCounter_h
|
#define hifi_Shared_RateCounter_h
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <atomic>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <QtCore/QElapsedTimer>
|
#include <QtCore/QElapsedTimer>
|
||||||
|
|
||||||
|
@ -20,6 +21,8 @@
|
||||||
template <uint32_t INTERVAL = MSECS_PER_SECOND, uint8_t PRECISION = 2>
|
template <uint32_t INTERVAL = MSECS_PER_SECOND, uint8_t PRECISION = 2>
|
||||||
class RateCounter {
|
class RateCounter {
|
||||||
public:
|
public:
|
||||||
|
RateCounter() { _rate = 0; } // avoid use of std::atomic copy ctor
|
||||||
|
|
||||||
void increment(size_t count = 1) {
|
void increment(size_t count = 1) {
|
||||||
auto now = usecTimestampNow();
|
auto now = usecTimestampNow();
|
||||||
float currentIntervalMs = (now - _start) / (float) USECS_PER_MSEC;
|
float currentIntervalMs = (now - _start) / (float) USECS_PER_MSEC;
|
||||||
|
@ -42,8 +45,8 @@ public:
|
||||||
private:
|
private:
|
||||||
uint64_t _start { usecTimestampNow() };
|
uint64_t _start { usecTimestampNow() };
|
||||||
size_t _count { 0 };
|
size_t _count { 0 };
|
||||||
float _rate { 0 };
|
|
||||||
const float _scale { powf(10, PRECISION) };
|
const float _scale { powf(10, PRECISION) };
|
||||||
|
std::atomic<float> _rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QRegularExpression>
|
#include <QtCore/QRegularExpression>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
|
#include "PathUtils.h"
|
||||||
|
|
||||||
|
|
||||||
QUrl FileDialogHelper::home() {
|
QUrl FileDialogHelper::home() {
|
||||||
|
@ -103,3 +106,7 @@ QStringList FileDialogHelper::drives() {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileDialogHelper::openScriptsDirectory() {
|
||||||
|
QDesktopServices::openUrl(defaultScriptsLocation());
|
||||||
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ public:
|
||||||
Q_INVOKABLE bool validFolder(const QString& path);
|
Q_INVOKABLE bool validFolder(const QString& path);
|
||||||
Q_INVOKABLE QUrl pathToUrl(const QString& path);
|
Q_INVOKABLE QUrl pathToUrl(const QString& path);
|
||||||
Q_INVOKABLE QUrl saveHelper(const QString& saveText, const QUrl& currentFolder, const QStringList& selectionFilters);
|
Q_INVOKABLE QUrl saveHelper(const QString& saveText, const QUrl& currentFolder, const QStringList& selectionFilters);
|
||||||
|
|
||||||
|
Q_INVOKABLE void openScriptsDirectory();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
exports.searchPaths = function(name, binaryType, releaseType) {
|
function platformExtension(name) {
|
||||||
function platformExtension(name) {
|
if (name == "Interface") {
|
||||||
if (name == "Interface" || name == "High Fidelity") {
|
if (process.platform == "darwin") {
|
||||||
if (process.platform == "darwin") {
|
return ".app/Contents/MacOS/" + name
|
||||||
return ".app/Contents/MacOS/" + name
|
} else if (process.platform == "win32") {
|
||||||
} else if (process.platform == "win32") {
|
return ".exe"
|
||||||
return ".exe"
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return process.platform == "win32" ? ".exe" : ""
|
return ""
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return process.platform == "win32" ? ".exe" : ""
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
exports.searchPaths = function(name, binaryType, releaseType) {
|
||||||
var extension = platformExtension(name);
|
var extension = platformExtension(name);
|
||||||
var devBasePath = "../build/" + name + "/";
|
var devBasePath = "../build/" + name + "/";
|
||||||
|
|
||||||
|
@ -68,6 +69,7 @@ exports.discoveredPath = function (name, binaryType, releaseType) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var stats = fs.lstatSync(testPath);
|
var stats = fs.lstatSync(testPath);
|
||||||
|
var extension = platformExtension(name);
|
||||||
|
|
||||||
if (stats.isFile() || (stats.isDirectory() && extension == ".app")) {
|
if (stats.isFile() || (stats.isDirectory() && extension == ".app")) {
|
||||||
console.log("Found " + name + " at " + testPath);
|
console.log("Found " + name + " at " + testPath);
|
||||||
|
@ -81,11 +83,6 @@ exports.discoveredPath = function (name, binaryType, releaseType) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for a released server console on OS X, assume the name of the interface executable is "High Fidelity"
|
|
||||||
if (releaseType && process.platform == "darwin" && name == "Interface") {
|
|
||||||
name = "High Fidelity";
|
|
||||||
}
|
|
||||||
|
|
||||||
// attempt to find a binary at the usual paths, return null if it doesn't exist
|
// attempt to find a binary at the usual paths, return null if it doesn't exist
|
||||||
return binaryFromPaths(name, this.searchPaths(name, binaryType, releaseType));
|
return binaryFromPaths(name, this.searchPaths(name, binaryType, releaseType));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue