mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 19:10:38 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into controllers
This commit is contained in:
commit
f43738e75a
9 changed files with 94 additions and 56 deletions
|
@ -240,6 +240,7 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
int packetsSent = 0;
|
int packetsSent = 0;
|
||||||
|
int totalBytesSent = 0;
|
||||||
|
|
||||||
NodeToSenderStatsMapIterator i = _singleSenderStats.begin();
|
NodeToSenderStatsMapIterator i = _singleSenderStats.begin();
|
||||||
while (i != _singleSenderStats.end()) {
|
while (i != _singleSenderStats.end()) {
|
||||||
|
@ -291,12 +292,15 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
||||||
packetsSent += nackPacketList->getNumPackets();
|
packetsSent += nackPacketList->getNumPackets();
|
||||||
|
|
||||||
// send the list of nack packets
|
// send the list of nack packets
|
||||||
nodeList->sendPacketList(std::move(nackPacketList), *destinationNode);
|
totalBytesSent += nodeList->sendPacketList(std::move(nackPacketList), *destinationNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OctreeSendThread::_totalPackets += packetsSent;
|
||||||
|
OctreeSendThread::_totalBytes += totalBytesSent;
|
||||||
|
|
||||||
return packetsSent;
|
return packetsSent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,12 +112,15 @@ bool OctreeSendThread::process() {
|
||||||
return isStillRunning(); // keep running till they terminate us
|
return isStillRunning(); // keep running till they terminate us
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 OctreeSendThread::_usleepTime = 0;
|
AtomicUIntStat OctreeSendThread::_usleepTime { 0 };
|
||||||
quint64 OctreeSendThread::_usleepCalls = 0;
|
AtomicUIntStat OctreeSendThread::_usleepCalls { 0 };
|
||||||
|
AtomicUIntStat OctreeSendThread::_totalBytes { 0 };
|
||||||
|
AtomicUIntStat OctreeSendThread::_totalWastedBytes { 0 };
|
||||||
|
AtomicUIntStat OctreeSendThread::_totalPackets { 0 };
|
||||||
|
|
||||||
|
AtomicUIntStat OctreeSendThread::_totalSpecialBytes { 0 };
|
||||||
|
AtomicUIntStat OctreeSendThread::_totalSpecialPackets { 0 };
|
||||||
|
|
||||||
quint64 OctreeSendThread::_totalBytes = 0;
|
|
||||||
quint64 OctreeSendThread::_totalWastedBytes = 0;
|
|
||||||
quint64 OctreeSendThread::_totalPackets = 0;
|
|
||||||
|
|
||||||
int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytesSent, int& truePacketsSent) {
|
int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytesSent, int& truePacketsSent) {
|
||||||
OctreeServer::didHandlePacketSend(this);
|
OctreeServer::didHandlePacketSend(this);
|
||||||
|
@ -581,11 +584,17 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
// send the environment packet
|
// send the environment packet
|
||||||
// TODO: should we turn this into a while loop to better handle sending multiple special packets
|
// TODO: should we turn this into a while loop to better handle sending multiple special packets
|
||||||
if (_myServer->hasSpecialPacketsToSend(_node) && !nodeData->isShuttingDown()) {
|
if (_myServer->hasSpecialPacketsToSend(_node) && !nodeData->isShuttingDown()) {
|
||||||
int specialPacketsSent;
|
int specialPacketsSent = 0;
|
||||||
trueBytesSent += _myServer->sendSpecialPackets(_node, nodeData, specialPacketsSent);
|
trueBytesSent += _myServer->sendSpecialPackets(_node, nodeData, specialPacketsSent);
|
||||||
nodeData->resetOctreePacket(); // because nodeData's _sequenceNumber has changed
|
nodeData->resetOctreePacket(); // because nodeData's _sequenceNumber has changed
|
||||||
truePacketsSent += specialPacketsSent;
|
truePacketsSent += specialPacketsSent;
|
||||||
packetsSentThisInterval += specialPacketsSent;
|
packetsSentThisInterval += specialPacketsSent;
|
||||||
|
|
||||||
|
_totalPackets += specialPacketsSent;
|
||||||
|
_totalBytes += trueBytesSent;
|
||||||
|
|
||||||
|
_totalSpecialPackets += specialPacketsSent;
|
||||||
|
_totalSpecialBytes += trueBytesSent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-send packets that were nacked by the client
|
// Re-send packets that were nacked by the client
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#ifndef hifi_OctreeSendThread_h
|
#ifndef hifi_OctreeSendThread_h
|
||||||
#define hifi_OctreeSendThread_h
|
#define hifi_OctreeSendThread_h
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#include <GenericThread.h>
|
#include <GenericThread.h>
|
||||||
#include <OctreeElementBag.h>
|
#include <OctreeElementBag.h>
|
||||||
|
|
||||||
|
@ -21,6 +23,8 @@
|
||||||
|
|
||||||
class OctreeServer;
|
class OctreeServer;
|
||||||
|
|
||||||
|
using AtomicUIntStat = std::atomic<uintmax_t>;
|
||||||
|
|
||||||
/// Threaded processor for sending octree packets to a single client
|
/// Threaded processor for sending octree packets to a single client
|
||||||
class OctreeSendThread : public GenericThread {
|
class OctreeSendThread : public GenericThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -30,12 +34,15 @@ public:
|
||||||
|
|
||||||
void setIsShuttingDown();
|
void setIsShuttingDown();
|
||||||
|
|
||||||
static quint64 _totalBytes;
|
static AtomicUIntStat _totalBytes;
|
||||||
static quint64 _totalWastedBytes;
|
static AtomicUIntStat _totalWastedBytes;
|
||||||
static quint64 _totalPackets;
|
static AtomicUIntStat _totalPackets;
|
||||||
|
|
||||||
static quint64 _usleepTime;
|
static AtomicUIntStat _totalSpecialBytes;
|
||||||
static quint64 _usleepCalls;
|
static AtomicUIntStat _totalSpecialPackets;
|
||||||
|
|
||||||
|
static AtomicUIntStat _usleepTime;
|
||||||
|
static AtomicUIntStat _usleepCalls;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Implements generic processing behavior for this thread.
|
/// Implements generic processing behavior for this thread.
|
||||||
|
|
|
@ -415,6 +415,9 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
quint64 totalBytesOfBitMasks = OctreePacketData::getTotalBytesOfBitMasks();
|
quint64 totalBytesOfBitMasks = OctreePacketData::getTotalBytesOfBitMasks();
|
||||||
quint64 totalBytesOfColor = OctreePacketData::getTotalBytesOfColor();
|
quint64 totalBytesOfColor = OctreePacketData::getTotalBytesOfColor();
|
||||||
|
|
||||||
|
quint64 totalOutboundSpecialPackets = OctreeSendThread::_totalSpecialPackets;
|
||||||
|
quint64 totalOutboundSpecialBytes = OctreeSendThread::_totalSpecialBytes;
|
||||||
|
|
||||||
statsString += QString(" Total Clients Connected: %1 clients\r\n")
|
statsString += QString(" Total Clients Connected: %1 clients\r\n")
|
||||||
.arg(locale.toString((uint)getCurrentClientCount()).rightJustified(COLUMN_WIDTH, ' '));
|
.arg(locale.toString((uint)getCurrentClientCount()).rightJustified(COLUMN_WIDTH, ' '));
|
||||||
|
|
||||||
|
@ -606,6 +609,13 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
.arg(locale.toString((uint)totalOutboundPackets).rightJustified(COLUMN_WIDTH, ' '));
|
.arg(locale.toString((uint)totalOutboundPackets).rightJustified(COLUMN_WIDTH, ' '));
|
||||||
statsString += QString(" Total Outbound Bytes: %1 bytes\r\n")
|
statsString += QString(" Total Outbound Bytes: %1 bytes\r\n")
|
||||||
.arg(locale.toString((uint)totalOutboundBytes).rightJustified(COLUMN_WIDTH, ' '));
|
.arg(locale.toString((uint)totalOutboundBytes).rightJustified(COLUMN_WIDTH, ' '));
|
||||||
|
|
||||||
|
statsString += QString(" Total Outbound Special Packets: %1 packets\r\n")
|
||||||
|
.arg(locale.toString((uint)totalOutboundSpecialPackets).rightJustified(COLUMN_WIDTH, ' '));
|
||||||
|
statsString += QString(" Total Outbound Special Bytes: %1 bytes\r\n")
|
||||||
|
.arg(locale.toString((uint)totalOutboundSpecialBytes).rightJustified(COLUMN_WIDTH, ' '));
|
||||||
|
|
||||||
|
|
||||||
statsString += QString(" Total Wasted Bytes: %1 bytes\r\n")
|
statsString += QString(" Total Wasted Bytes: %1 bytes\r\n")
|
||||||
.arg(locale.toString((uint)totalWastedBytes).rightJustified(COLUMN_WIDTH, ' '));
|
.arg(locale.toString((uint)totalWastedBytes).rightJustified(COLUMN_WIDTH, ' '));
|
||||||
statsString += QString().sprintf(" Total OctalCode Bytes: %s bytes (%5.2f%%)\r\n",
|
statsString += QString().sprintf(" Total OctalCode Bytes: %s bytes (%5.2f%%)\r\n",
|
||||||
|
|
|
@ -28,11 +28,11 @@
|
||||||
#include "OctreeLogging.h"
|
#include "OctreeLogging.h"
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
|
|
||||||
quint64 OctreeElement::_octreeMemoryUsage = 0;
|
AtomicUIntStat OctreeElement::_octreeMemoryUsage { 0 };
|
||||||
quint64 OctreeElement::_octcodeMemoryUsage = 0;
|
AtomicUIntStat OctreeElement::_octcodeMemoryUsage { 0 };
|
||||||
quint64 OctreeElement::_externalChildrenMemoryUsage = 0;
|
AtomicUIntStat OctreeElement::_externalChildrenMemoryUsage { 0 };
|
||||||
quint64 OctreeElement::_voxelNodeCount = 0;
|
AtomicUIntStat OctreeElement::_voxelNodeCount { 0 };
|
||||||
quint64 OctreeElement::_voxelNodeLeafCount = 0;
|
AtomicUIntStat OctreeElement::_voxelNodeLeafCount { 0 };
|
||||||
|
|
||||||
void OctreeElement::resetPopulationStatistics() {
|
void OctreeElement::resetPopulationStatistics() {
|
||||||
_voxelNodeCount = 0;
|
_voxelNodeCount = 0;
|
||||||
|
@ -245,13 +245,12 @@ bool OctreeElement::isParentOf(OctreeElementPointer possibleChild) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 OctreeElement::_getChildAtIndexTime = 0;
|
AtomicUIntStat OctreeElement::_getChildAtIndexTime { 0 };
|
||||||
quint64 OctreeElement::_getChildAtIndexCalls = 0;
|
AtomicUIntStat OctreeElement::_getChildAtIndexCalls { 0 };
|
||||||
quint64 OctreeElement::_setChildAtIndexTime = 0;
|
AtomicUIntStat OctreeElement::_setChildAtIndexTime { 0 };
|
||||||
quint64 OctreeElement::_setChildAtIndexCalls = 0;
|
AtomicUIntStat OctreeElement::_setChildAtIndexCalls { 0 };
|
||||||
|
AtomicUIntStat OctreeElement::_externalChildrenCount { 0 };
|
||||||
quint64 OctreeElement::_externalChildrenCount = 0;
|
AtomicUIntStat OctreeElement::_childrenCount[NUMBER_OF_CHILDREN + 1];
|
||||||
quint64 OctreeElement::_childrenCount[NUMBER_OF_CHILDREN + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
OctreeElementPointer OctreeElement::getChildAtIndex(int childIndex) const {
|
OctreeElementPointer OctreeElement::getChildAtIndex(int childIndex) const {
|
||||||
#ifdef SIMPLE_CHILD_ARRAY
|
#ifdef SIMPLE_CHILD_ARRAY
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
//#define SIMPLE_CHILD_ARRAY
|
//#define SIMPLE_CHILD_ARRAY
|
||||||
#define SIMPLE_EXTERNAL_CHILDREN
|
#define SIMPLE_EXTERNAL_CHILDREN
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
|
|
||||||
#include <OctalCode.h>
|
#include <OctalCode.h>
|
||||||
|
@ -24,6 +26,9 @@
|
||||||
#include "ViewFrustum.h"
|
#include "ViewFrustum.h"
|
||||||
#include "OctreeConstants.h"
|
#include "OctreeConstants.h"
|
||||||
|
|
||||||
|
using AtomicUIntStat = std::atomic<uintmax_t>;
|
||||||
|
|
||||||
|
|
||||||
class EncodeBitstreamParams;
|
class EncodeBitstreamParams;
|
||||||
class Octree;
|
class Octree;
|
||||||
class OctreeElement;
|
class OctreeElement;
|
||||||
|
@ -290,20 +295,20 @@ protected:
|
||||||
//static QReadWriteLock _updateHooksLock;
|
//static QReadWriteLock _updateHooksLock;
|
||||||
static std::vector<OctreeElementUpdateHook*> _updateHooks;
|
static std::vector<OctreeElementUpdateHook*> _updateHooks;
|
||||||
|
|
||||||
static quint64 _voxelNodeCount;
|
static AtomicUIntStat _voxelNodeCount;
|
||||||
static quint64 _voxelNodeLeafCount;
|
static AtomicUIntStat _voxelNodeLeafCount;
|
||||||
|
|
||||||
static quint64 _octreeMemoryUsage;
|
static AtomicUIntStat _octreeMemoryUsage;
|
||||||
static quint64 _octcodeMemoryUsage;
|
static AtomicUIntStat _octcodeMemoryUsage;
|
||||||
static quint64 _externalChildrenMemoryUsage;
|
static AtomicUIntStat _externalChildrenMemoryUsage;
|
||||||
|
|
||||||
static quint64 _getChildAtIndexTime;
|
static AtomicUIntStat _getChildAtIndexTime;
|
||||||
static quint64 _getChildAtIndexCalls;
|
static AtomicUIntStat _getChildAtIndexCalls;
|
||||||
static quint64 _setChildAtIndexTime;
|
static AtomicUIntStat _setChildAtIndexTime;
|
||||||
static quint64 _setChildAtIndexCalls;
|
static AtomicUIntStat _setChildAtIndexCalls;
|
||||||
|
|
||||||
static quint64 _externalChildrenCount;
|
static AtomicUIntStat _externalChildrenCount;
|
||||||
static quint64 _childrenCount[NUMBER_OF_CHILDREN + 1];
|
static AtomicUIntStat _childrenCount[NUMBER_OF_CHILDREN + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_OctreeElement_h
|
#endif // hifi_OctreeElement_h
|
||||||
|
|
|
@ -16,14 +16,12 @@
|
||||||
#include "OctreePacketData.h"
|
#include "OctreePacketData.h"
|
||||||
|
|
||||||
bool OctreePacketData::_debug = false;
|
bool OctreePacketData::_debug = false;
|
||||||
quint64 OctreePacketData::_totalBytesOfOctalCodes = 0;
|
AtomicUIntStat OctreePacketData::_totalBytesOfOctalCodes { 0 };
|
||||||
quint64 OctreePacketData::_totalBytesOfBitMasks = 0;
|
AtomicUIntStat OctreePacketData::_totalBytesOfBitMasks { 0 };
|
||||||
quint64 OctreePacketData::_totalBytesOfColor = 0;
|
AtomicUIntStat OctreePacketData::_totalBytesOfColor { 0 };
|
||||||
quint64 OctreePacketData::_totalBytesOfValues = 0;
|
AtomicUIntStat OctreePacketData::_totalBytesOfValues { 0 };
|
||||||
quint64 OctreePacketData::_totalBytesOfPositions = 0;
|
AtomicUIntStat OctreePacketData::_totalBytesOfPositions { 0 };
|
||||||
quint64 OctreePacketData::_totalBytesOfRawData = 0;
|
AtomicUIntStat OctreePacketData::_totalBytesOfRawData { 0 };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OctreePacketData::OctreePacketData(bool enableCompression, int targetSize) {
|
OctreePacketData::OctreePacketData(bool enableCompression, int targetSize) {
|
||||||
changeSettings(enableCompression, targetSize); // does reset...
|
changeSettings(enableCompression, targetSize); // does reset...
|
||||||
|
@ -490,8 +488,8 @@ bool OctreePacketData::appendRawData(QByteArray data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
quint64 OctreePacketData::_compressContentTime = 0;
|
AtomicUIntStat OctreePacketData::_compressContentTime { 0 };
|
||||||
quint64 OctreePacketData::_compressContentCalls = 0;
|
AtomicUIntStat OctreePacketData::_compressContentCalls { 0 };
|
||||||
|
|
||||||
bool OctreePacketData::compressContent() {
|
bool OctreePacketData::compressContent() {
|
||||||
PerformanceWarning warn(false, "OctreePacketData::compressContent()", false, &_compressContentTime, &_compressContentCalls);
|
PerformanceWarning warn(false, "OctreePacketData::compressContent()", false, &_compressContentTime, &_compressContentCalls);
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#ifndef hifi_OctreePacketData_h
|
#ifndef hifi_OctreePacketData_h
|
||||||
#define hifi_OctreePacketData_h
|
#define hifi_OctreePacketData_h
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
@ -35,6 +37,8 @@
|
||||||
#include "OctreeConstants.h"
|
#include "OctreeConstants.h"
|
||||||
#include "OctreeElement.h"
|
#include "OctreeElement.h"
|
||||||
|
|
||||||
|
using AtomicUIntStat = std::atomic<uintmax_t>;
|
||||||
|
|
||||||
typedef unsigned char OCTREE_PACKET_FLAGS;
|
typedef unsigned char OCTREE_PACKET_FLAGS;
|
||||||
typedef uint16_t OCTREE_PACKET_SEQUENCE;
|
typedef uint16_t OCTREE_PACKET_SEQUENCE;
|
||||||
const uint16_t MAX_OCTREE_PACKET_SEQUENCE = 65535;
|
const uint16_t MAX_OCTREE_PACKET_SEQUENCE = 65535;
|
||||||
|
@ -286,15 +290,15 @@ private:
|
||||||
|
|
||||||
static bool _debug;
|
static bool _debug;
|
||||||
|
|
||||||
static quint64 _compressContentTime;
|
static AtomicUIntStat _compressContentTime;
|
||||||
static quint64 _compressContentCalls;
|
static AtomicUIntStat _compressContentCalls;
|
||||||
|
|
||||||
static quint64 _totalBytesOfOctalCodes;
|
static AtomicUIntStat _totalBytesOfOctalCodes;
|
||||||
static quint64 _totalBytesOfBitMasks;
|
static AtomicUIntStat _totalBytesOfBitMasks;
|
||||||
static quint64 _totalBytesOfColor;
|
static AtomicUIntStat _totalBytesOfColor;
|
||||||
static quint64 _totalBytesOfValues;
|
static AtomicUIntStat _totalBytesOfValues;
|
||||||
static quint64 _totalBytesOfPositions;
|
static AtomicUIntStat _totalBytesOfPositions;
|
||||||
static quint64 _totalBytesOfRawData;
|
static AtomicUIntStat _totalBytesOfRawData;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_OctreePacketData_h
|
#endif // hifi_OctreePacketData_h
|
||||||
|
|
|
@ -24,19 +24,21 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
using AtomicUIntStat = std::atomic<uintmax_t>;
|
||||||
|
|
||||||
class PerformanceWarning {
|
class PerformanceWarning {
|
||||||
private:
|
private:
|
||||||
quint64 _start;
|
quint64 _start;
|
||||||
const char* _message;
|
const char* _message;
|
||||||
bool _renderWarningsOn;
|
bool _renderWarningsOn;
|
||||||
bool _alwaysDisplay;
|
bool _alwaysDisplay;
|
||||||
quint64* _runningTotal;
|
AtomicUIntStat* _runningTotal;
|
||||||
quint64* _totalCalls;
|
AtomicUIntStat* _totalCalls;
|
||||||
static bool _suppressShortTimings;
|
static bool _suppressShortTimings;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PerformanceWarning(bool renderWarnings, const char* message, bool alwaysDisplay = false,
|
PerformanceWarning(bool renderWarnings, const char* message, bool alwaysDisplay = false,
|
||||||
quint64* runningTotal = NULL, quint64* totalCalls = NULL) :
|
AtomicUIntStat* runningTotal = NULL, AtomicUIntStat* totalCalls = NULL) :
|
||||||
_start(usecTimestampNow()),
|
_start(usecTimestampNow()),
|
||||||
_message(message),
|
_message(message),
|
||||||
_renderWarningsOn(renderWarnings),
|
_renderWarningsOn(renderWarnings),
|
||||||
|
|
Loading…
Reference in a new issue