mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
replace uint64_t with quint64 for Qt friendlyness
This commit is contained in:
parent
7b4921e761
commit
cda06d1cb3
57 changed files with 347 additions and 347 deletions
|
@ -591,8 +591,8 @@ double start = 0;
|
|||
|
||||
void* animateVoxels(void* args) {
|
||||
|
||||
uint64_t lastAnimateTime = 0;
|
||||
uint64_t lastProcessTime = 0;
|
||||
quint64 lastAnimateTime = 0;
|
||||
quint64 lastProcessTime = 0;
|
||||
int processesPerAnimate = 0;
|
||||
|
||||
bool firstTime = true;
|
||||
|
@ -622,8 +622,8 @@ void* animateVoxels(void* args) {
|
|||
|
||||
// The while loop will be running at PROCESSING_FPS, but we only want to call these animation functions at
|
||||
// ANIMATE_FPS. So we check out last animate time and only call these if we've elapsed that time.
|
||||
uint64_t now = usecTimestampNow();
|
||||
uint64_t animationElapsed = now - lastAnimateTime;
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64 animationElapsed = now - lastAnimateTime;
|
||||
int withinAnimationTarget = ANIMATE_VOXELS_INTERVAL_USECS - animationElapsed;
|
||||
const int CLOSE_ENOUGH_TO_ANIMATE = 2000; // approximately 2 ms
|
||||
|
||||
|
@ -676,7 +676,7 @@ void* animateVoxels(void* args) {
|
|||
processesPerAnimate++;
|
||||
}
|
||||
// dynamically sleep until we need to fire off the next set of voxels
|
||||
uint64_t usecToSleep = PROCESSING_INTERVAL_USECS - (usecTimestampNow() - lastProcessTime);
|
||||
quint64 usecToSleep = PROCESSING_INTERVAL_USECS - (usecTimestampNow() - lastProcessTime);
|
||||
if (usecToSleep > PROCESSING_INTERVAL_USECS) {
|
||||
usecToSleep = PROCESSING_INTERVAL_USECS;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ void DomainServer::readAvailableDatagrams() {
|
|||
}
|
||||
|
||||
// update last receive to now
|
||||
uint64_t timeNow = usecTimestampNow();
|
||||
quint64 timeNow = usecTimestampNow();
|
||||
checkInNode->setLastHeardMicrostamp(timeNow);
|
||||
|
||||
// send the constructed list back to this node
|
||||
|
|
|
@ -2256,7 +2256,7 @@ void Application::updateCursor(float deltaTime) {
|
|||
// watch mouse position, if it hasn't moved, hide the cursor
|
||||
bool underMouse = _glWidget->underMouse();
|
||||
if (!_mouseHidden) {
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
int elapsed = now - _lastMouseMove;
|
||||
const int HIDE_CURSOR_TIMEOUT = 1 * 1000 * 1000; // 1 second
|
||||
if (elapsed > HIDE_CURSOR_TIMEOUT && (underMouse || !_seenMouseMove)) {
|
||||
|
@ -3057,7 +3057,7 @@ void Application::displayOverlay() {
|
|||
// Show on-screen msec timer
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::FrameTimer)) {
|
||||
char frameTimer[10];
|
||||
uint64_t mSecsNow = floor(usecTimestampNow() / 1000.0 + 0.5);
|
||||
quint64 mSecsNow = floor(usecTimestampNow() / 1000.0 + 0.5);
|
||||
sprintf(frameTimer, "%d\n", (int)(mSecsNow % 1000));
|
||||
int timerBottom =
|
||||
(Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
||||
|
|
|
@ -403,7 +403,7 @@ private:
|
|||
int _mouseY;
|
||||
int _mouseDragStartedX;
|
||||
int _mouseDragStartedY;
|
||||
uint64_t _lastMouseMove;
|
||||
quint64 _lastMouseMove;
|
||||
bool _mouseHidden;
|
||||
bool _seenMouseMove;
|
||||
|
||||
|
|
|
@ -21,15 +21,15 @@ VoxelHideShowThread::VoxelHideShowThread(VoxelSystem* theSystem) :
|
|||
}
|
||||
|
||||
bool VoxelHideShowThread::process() {
|
||||
const uint64_t MSECS_TO_USECS = 1000;
|
||||
const uint64_t SECS_TO_USECS = 1000 * MSECS_TO_USECS;
|
||||
const uint64_t FRAME_RATE = 60;
|
||||
const uint64_t USECS_PER_FRAME = SECS_TO_USECS / FRAME_RATE; // every 60fps
|
||||
const quint64 MSECS_TO_USECS = 1000;
|
||||
const quint64 SECS_TO_USECS = 1000 * MSECS_TO_USECS;
|
||||
const quint64 FRAME_RATE = 60;
|
||||
const quint64 USECS_PER_FRAME = SECS_TO_USECS / FRAME_RATE; // every 60fps
|
||||
|
||||
uint64_t start = usecTimestampNow();
|
||||
quint64 start = usecTimestampNow();
|
||||
_theSystem->checkForCulling();
|
||||
uint64_t end = usecTimestampNow();
|
||||
uint64_t elapsed = end - start;
|
||||
quint64 end = usecTimestampNow();
|
||||
quint64 elapsed = end - start;
|
||||
|
||||
bool showExtraDebugging = Application::getInstance()->getLogger()->extraDebugging();
|
||||
if (showExtraDebugging && elapsed > USECS_PER_FRAME) {
|
||||
|
@ -38,7 +38,7 @@ bool VoxelHideShowThread::process() {
|
|||
|
||||
if (isStillRunning()) {
|
||||
if (elapsed < USECS_PER_FRAME) {
|
||||
uint64_t sleepFor = USECS_PER_FRAME - elapsed;
|
||||
quint64 sleepFor = USECS_PER_FRAME - elapsed;
|
||||
usleep(sleepFor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -638,8 +638,8 @@ void VoxelSystem::setupNewVoxelsForDrawing() {
|
|||
return; // bail early if we're not initialized
|
||||
}
|
||||
|
||||
uint64_t start = usecTimestampNow();
|
||||
uint64_t sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000;
|
||||
quint64 start = usecTimestampNow();
|
||||
quint64 sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000;
|
||||
|
||||
bool iAmDebugging = false; // if you're debugging set this to true, so you won't get skipped for slow debugging
|
||||
if (!iAmDebugging && sinceLastTime <= std::max((float) _setupNewVoxelsForDrawingLastElapsed, SIXTY_FPS_IN_MILLISECONDS)) {
|
||||
|
@ -685,7 +685,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() {
|
|||
|
||||
_bufferWriteLock.unlock();
|
||||
|
||||
uint64_t end = usecTimestampNow();
|
||||
quint64 end = usecTimestampNow();
|
||||
int elapsedmsec = (end - start) / 1000;
|
||||
_setupNewVoxelsForDrawingLastFinished = end;
|
||||
_setupNewVoxelsForDrawingLastElapsed = elapsedmsec;
|
||||
|
@ -702,8 +702,8 @@ void VoxelSystem::setupNewVoxelsForDrawingSingleNode(bool allowBailEarly) {
|
|||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||
"setupNewVoxelsForDrawingSingleNode() xxxxx");
|
||||
|
||||
uint64_t start = usecTimestampNow();
|
||||
uint64_t sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000;
|
||||
quint64 start = usecTimestampNow();
|
||||
quint64 sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000;
|
||||
|
||||
bool iAmDebugging = false; // if you're debugging set this to true, so you won't get skipped for slow debugging
|
||||
if (allowBailEarly && !iAmDebugging &&
|
||||
|
@ -728,7 +728,7 @@ void VoxelSystem::setupNewVoxelsForDrawingSingleNode(bool allowBailEarly) {
|
|||
|
||||
_bufferWriteLock.unlock();
|
||||
|
||||
uint64_t end = usecTimestampNow();
|
||||
quint64 end = usecTimestampNow();
|
||||
int elapsedmsec = (end - start) / 1000;
|
||||
_setupNewVoxelsForDrawingLastFinished = end;
|
||||
_setupNewVoxelsForDrawingLastElapsed = elapsedmsec;
|
||||
|
@ -737,14 +737,14 @@ void VoxelSystem::setupNewVoxelsForDrawingSingleNode(bool allowBailEarly) {
|
|||
void VoxelSystem::checkForCulling() {
|
||||
|
||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "checkForCulling()");
|
||||
uint64_t start = usecTimestampNow();
|
||||
quint64 start = usecTimestampNow();
|
||||
|
||||
// track how long its been since we were last moving. If we have recently moved then only use delta frustums, if
|
||||
// it's been a long time since we last moved, then go ahead and do a full frustum cull.
|
||||
if (isViewChanging()) {
|
||||
_lastViewIsChanging = start;
|
||||
}
|
||||
uint64_t sinceLastMoving = (start - _lastViewIsChanging) / 1000;
|
||||
quint64 sinceLastMoving = (start - _lastViewIsChanging) / 1000;
|
||||
bool enoughTime = (sinceLastMoving >= std::max((float) _lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS));
|
||||
|
||||
// These has changed events will occur before we stop. So we need to remember this for when we finally have stopped
|
||||
|
@ -766,7 +766,7 @@ void VoxelSystem::checkForCulling() {
|
|||
hideOutOfView(forceFullFrustum);
|
||||
|
||||
if (forceFullFrustum) {
|
||||
uint64_t endViewCulling = usecTimestampNow();
|
||||
quint64 endViewCulling = usecTimestampNow();
|
||||
_lastViewCullingElapsed = (endViewCulling - start) / 1000;
|
||||
}
|
||||
|
||||
|
@ -775,7 +775,7 @@ void VoxelSystem::checkForCulling() {
|
|||
// VBO reubuilding. Possibly we should do this only if our actual VBO usage crosses some lower boundary.
|
||||
cleanupRemovedVoxels();
|
||||
|
||||
uint64_t sinceLastAudit = (start - _lastAudit) / 1000;
|
||||
quint64 sinceLastAudit = (start - _lastAudit) / 1000;
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::AutomaticallyAuditTree)) {
|
||||
if (sinceLastAudit >= std::max((float) _lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS)) {
|
||||
|
|
|
@ -229,10 +229,10 @@ private:
|
|||
bool _readRenderFullVBO;
|
||||
|
||||
int _setupNewVoxelsForDrawingLastElapsed;
|
||||
uint64_t _setupNewVoxelsForDrawingLastFinished;
|
||||
uint64_t _lastViewCulling;
|
||||
uint64_t _lastViewIsChanging;
|
||||
uint64_t _lastAudit;
|
||||
quint64 _setupNewVoxelsForDrawingLastFinished;
|
||||
quint64 _lastViewCulling;
|
||||
quint64 _lastViewIsChanging;
|
||||
quint64 _lastAudit;
|
||||
int _lastViewCullingElapsed;
|
||||
bool _hasRecentlyChanged;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ void Profile::updatePosition(const glm::vec3 position) {
|
|||
if (_lastPosition != position) {
|
||||
|
||||
static timeval lastPositionSend = {};
|
||||
const uint64_t DATA_SERVER_POSITION_UPDATE_INTERVAL_USECS = 5 * 1000 * 1000;
|
||||
const quint64 DATA_SERVER_POSITION_UPDATE_INTERVAL_USECS = 5 * 1000 * 1000;
|
||||
const float DATA_SERVER_POSITION_CHANGE_THRESHOLD_METERS = 1;
|
||||
|
||||
if (usecTimestampNow() - usecTimestamp(&lastPositionSend) >= DATA_SERVER_POSITION_UPDATE_INTERVAL_USECS &&
|
||||
|
@ -115,10 +115,10 @@ void Profile::updateOrientation(const glm::quat& orientation) {
|
|||
if (_lastOrientation == eulerAngles) {
|
||||
return;
|
||||
}
|
||||
const uint64_t DATA_SERVER_ORIENTATION_UPDATE_INTERVAL_USECS = 5 * 1000 * 1000;
|
||||
const quint64 DATA_SERVER_ORIENTATION_UPDATE_INTERVAL_USECS = 5 * 1000 * 1000;
|
||||
const float DATA_SERVER_ORIENTATION_CHANGE_THRESHOLD_DEGREES = 5.0f;
|
||||
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
if (now - _lastOrientationSend >= DATA_SERVER_ORIENTATION_UPDATE_INTERVAL_USECS &&
|
||||
glm::distance(_lastOrientation, eulerAngles) >= DATA_SERVER_ORIENTATION_CHANGE_THRESHOLD_DEGREES) {
|
||||
DataServerClient::putValueForKeyAndUserString(DataServerKey::Orientation, QString(createByteArray(eulerAngles)),
|
||||
|
|
|
@ -57,7 +57,7 @@ private:
|
|||
QString _lastDomain;
|
||||
glm::vec3 _lastPosition;
|
||||
glm::vec3 _lastOrientation;
|
||||
uint64_t _lastOrientationSend;
|
||||
quint64 _lastOrientationSend;
|
||||
QUrl _faceModelURL;
|
||||
QUrl _skeletonModelURL;
|
||||
};
|
||||
|
|
|
@ -56,7 +56,7 @@ Faceshift::Faceshift() :
|
|||
}
|
||||
|
||||
bool Faceshift::isActive() const {
|
||||
const uint64_t ACTIVE_TIMEOUT_USECS = 1000000;
|
||||
const quint64 ACTIVE_TIMEOUT_USECS = 1000000;
|
||||
return (usecTimestampNow() - _lastTrackingStateReceived) < ACTIVE_TIMEOUT_USECS;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ private:
|
|||
bool _tcpEnabled;
|
||||
int _tcpRetryCount;
|
||||
bool _tracking;
|
||||
uint64_t _lastTrackingStateReceived;
|
||||
quint64 _lastTrackingStateReceived;
|
||||
|
||||
glm::quat _headRotation;
|
||||
glm::vec3 _headAngularVelocity;
|
||||
|
|
|
@ -25,7 +25,7 @@ public slots:
|
|||
|
||||
private:
|
||||
|
||||
uint64_t _lastMovement;
|
||||
quint64 _lastMovement;
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__SixenseManager__) */
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace starfield {
|
|||
using namespace std;
|
||||
|
||||
typedef uint32_t nuint;
|
||||
typedef uint64_t wuint;
|
||||
typedef quint64 wuint;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef unsigned char uint8_t;
|
|||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long quint64;
|
||||
#define PRId64 "I64d"
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
|
|
|
@ -228,7 +228,7 @@ private:
|
|||
|
||||
bool _isCollidingWithVoxel; /// Whether the finger of this palm is inside a leaf voxel
|
||||
bool _isCollidingWithPalm;
|
||||
uint64_t _collisionlessPaddleExpiry; /// Timestamp after which paddle starts colliding
|
||||
quint64 _collisionlessPaddleExpiry; /// Timestamp after which paddle starts colliding
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__HandData__) */
|
||||
|
|
|
@ -61,12 +61,12 @@ void OctreeInboundPacketProcessor::processPacket(const HifiSockAddr& senderSockA
|
|||
const unsigned char* packetData = reinterpret_cast<const unsigned char*>(packet.data());
|
||||
|
||||
unsigned short int sequence = (*((unsigned short int*)(packetData + numBytesPacketHeader)));
|
||||
uint64_t sentAt = (*((uint64_t*)(packetData + numBytesPacketHeader + sizeof(sequence))));
|
||||
uint64_t arrivedAt = usecTimestampNow();
|
||||
uint64_t transitTime = arrivedAt - sentAt;
|
||||
quint64 sentAt = (*((quint64*)(packetData + numBytesPacketHeader + sizeof(sequence))));
|
||||
quint64 arrivedAt = usecTimestampNow();
|
||||
quint64 transitTime = arrivedAt - sentAt;
|
||||
int editsInPacket = 0;
|
||||
uint64_t processTime = 0;
|
||||
uint64_t lockWaitTime = 0;
|
||||
quint64 processTime = 0;
|
||||
quint64 lockWaitTime = 0;
|
||||
|
||||
if (_myServer->wantsDebugReceiving()) {
|
||||
qDebug() << "PROCESSING THREAD: got '" << packetType << "' packet - " << _receivedPacketCount
|
||||
|
@ -84,19 +84,19 @@ void OctreeInboundPacketProcessor::processPacket(const HifiSockAddr& senderSockA
|
|||
packetType, packetData, packet.size(), editData, atByte, maxSize);
|
||||
}
|
||||
|
||||
uint64_t startLock = usecTimestampNow();
|
||||
quint64 startLock = usecTimestampNow();
|
||||
_myServer->getOctree()->lockForWrite();
|
||||
uint64_t startProcess = usecTimestampNow();
|
||||
quint64 startProcess = usecTimestampNow();
|
||||
int editDataBytesRead = _myServer->getOctree()->processEditPacketData(packetType,
|
||||
reinterpret_cast<const unsigned char*>(packet.data()),
|
||||
packet.size(),
|
||||
editData, maxSize, senderNode.data());
|
||||
_myServer->getOctree()->unlock();
|
||||
uint64_t endProcess = usecTimestampNow();
|
||||
quint64 endProcess = usecTimestampNow();
|
||||
|
||||
editsInPacket++;
|
||||
uint64_t thisProcessTime = endProcess - startProcess;
|
||||
uint64_t thisLockWaitTime = startProcess - startLock;
|
||||
quint64 thisProcessTime = endProcess - startProcess;
|
||||
quint64 thisLockWaitTime = startProcess - startLock;
|
||||
processTime += thisProcessTime;
|
||||
lockWaitTime += thisLockWaitTime;
|
||||
|
||||
|
@ -130,8 +130,8 @@ void OctreeInboundPacketProcessor::processPacket(const HifiSockAddr& senderSockA
|
|||
}
|
||||
}
|
||||
|
||||
void OctreeInboundPacketProcessor::trackInboundPackets(const QUuid& nodeUUID, int sequence, uint64_t transitTime,
|
||||
int editsInPacket, uint64_t processTime, uint64_t lockWaitTime) {
|
||||
void OctreeInboundPacketProcessor::trackInboundPackets(const QUuid& nodeUUID, int sequence, quint64 transitTime,
|
||||
int editsInPacket, quint64 processTime, quint64 lockWaitTime) {
|
||||
|
||||
_totalTransitTime += transitTime;
|
||||
_totalProcessTime += processTime;
|
||||
|
|
|
@ -20,21 +20,21 @@ class SingleSenderStats {
|
|||
public:
|
||||
SingleSenderStats();
|
||||
|
||||
uint64_t getAverageTransitTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalTransitTime / _totalPackets; }
|
||||
uint64_t getAverageProcessTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalProcessTime / _totalPackets; }
|
||||
uint64_t getAverageLockWaitTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalLockWaitTime / _totalPackets; }
|
||||
uint64_t getTotalElementsProcessed() const { return _totalElementsInPacket; }
|
||||
uint64_t getTotalPacketsProcessed() const { return _totalPackets; }
|
||||
uint64_t getAverageProcessTimePerElement() const
|
||||
quint64 getAverageTransitTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalTransitTime / _totalPackets; }
|
||||
quint64 getAverageProcessTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalProcessTime / _totalPackets; }
|
||||
quint64 getAverageLockWaitTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalLockWaitTime / _totalPackets; }
|
||||
quint64 getTotalElementsProcessed() const { return _totalElementsInPacket; }
|
||||
quint64 getTotalPacketsProcessed() const { return _totalPackets; }
|
||||
quint64 getAverageProcessTimePerElement() const
|
||||
{ return _totalElementsInPacket == 0 ? 0 : _totalProcessTime / _totalElementsInPacket; }
|
||||
uint64_t getAverageLockWaitTimePerElement() const
|
||||
quint64 getAverageLockWaitTimePerElement() const
|
||||
{ return _totalElementsInPacket == 0 ? 0 : _totalLockWaitTime / _totalElementsInPacket; }
|
||||
|
||||
uint64_t _totalTransitTime;
|
||||
uint64_t _totalProcessTime;
|
||||
uint64_t _totalLockWaitTime;
|
||||
uint64_t _totalElementsInPacket;
|
||||
uint64_t _totalPackets;
|
||||
quint64 _totalTransitTime;
|
||||
quint64 _totalProcessTime;
|
||||
quint64 _totalLockWaitTime;
|
||||
quint64 _totalElementsInPacket;
|
||||
quint64 _totalPackets;
|
||||
};
|
||||
|
||||
typedef std::map<QUuid, SingleSenderStats> NodeToSenderStatsMap;
|
||||
|
@ -48,14 +48,14 @@ class OctreeInboundPacketProcessor : public ReceivedPacketProcessor {
|
|||
public:
|
||||
OctreeInboundPacketProcessor(OctreeServer* myServer);
|
||||
|
||||
uint64_t getAverageTransitTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalTransitTime / _totalPackets; }
|
||||
uint64_t getAverageProcessTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalProcessTime / _totalPackets; }
|
||||
uint64_t getAverageLockWaitTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalLockWaitTime / _totalPackets; }
|
||||
uint64_t getTotalElementsProcessed() const { return _totalElementsInPacket; }
|
||||
uint64_t getTotalPacketsProcessed() const { return _totalPackets; }
|
||||
uint64_t getAverageProcessTimePerElement() const
|
||||
quint64 getAverageTransitTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalTransitTime / _totalPackets; }
|
||||
quint64 getAverageProcessTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalProcessTime / _totalPackets; }
|
||||
quint64 getAverageLockWaitTimePerPacket() const { return _totalPackets == 0 ? 0 : _totalLockWaitTime / _totalPackets; }
|
||||
quint64 getTotalElementsProcessed() const { return _totalElementsInPacket; }
|
||||
quint64 getTotalPacketsProcessed() const { return _totalPackets; }
|
||||
quint64 getAverageProcessTimePerElement() const
|
||||
{ return _totalElementsInPacket == 0 ? 0 : _totalProcessTime / _totalElementsInPacket; }
|
||||
uint64_t getAverageLockWaitTimePerElement() const
|
||||
quint64 getAverageLockWaitTimePerElement() const
|
||||
{ return _totalElementsInPacket == 0 ? 0 : _totalLockWaitTime / _totalElementsInPacket; }
|
||||
|
||||
void resetStats();
|
||||
|
@ -66,17 +66,17 @@ protected:
|
|||
virtual void processPacket(const HifiSockAddr& senderSockAddr, const QByteArray& packet);
|
||||
|
||||
private:
|
||||
void trackInboundPackets(const QUuid& nodeUUID, int sequence, uint64_t transitTime,
|
||||
int voxelsInPacket, uint64_t processTime, uint64_t lockWaitTime);
|
||||
void trackInboundPackets(const QUuid& nodeUUID, int sequence, quint64 transitTime,
|
||||
int voxelsInPacket, quint64 processTime, quint64 lockWaitTime);
|
||||
|
||||
OctreeServer* _myServer;
|
||||
int _receivedPacketCount;
|
||||
|
||||
uint64_t _totalTransitTime;
|
||||
uint64_t _totalProcessTime;
|
||||
uint64_t _totalLockWaitTime;
|
||||
uint64_t _totalElementsInPacket;
|
||||
uint64_t _totalPackets;
|
||||
quint64 _totalTransitTime;
|
||||
quint64 _totalProcessTime;
|
||||
quint64 _totalLockWaitTime;
|
||||
quint64 _totalElementsInPacket;
|
||||
quint64 _totalPackets;
|
||||
|
||||
NodeToSenderStatsMap _singleSenderStats;
|
||||
};
|
||||
|
|
|
@ -69,7 +69,7 @@ bool OctreeQueryNode::shouldSuppressDuplicatePacket() {
|
|||
|
||||
// How long has it been since we've sent one, if we're still under our max time, then keep considering
|
||||
// this packet for suppression
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
long sinceFirstSuppressedPacket = now - _firstSuppressedPacket;
|
||||
const long MAX_TIME_BETWEEN_DUPLICATE_PACKETS = 1000 * 1000; // 1 second.
|
||||
|
||||
|
@ -233,7 +233,7 @@ void OctreeQueryNode::updateLastKnownViewFrustum() {
|
|||
}
|
||||
|
||||
// save that we know the view has been sent.
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
setLastTimeBagEmpty(now); // is this what we want? poor names
|
||||
}
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ public:
|
|||
|
||||
bool moveShouldDump() const;
|
||||
|
||||
uint64_t getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }
|
||||
void setLastTimeBagEmpty(uint64_t lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; }
|
||||
quint64 getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }
|
||||
void setLastTimeBagEmpty(quint64 lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; }
|
||||
|
||||
bool getCurrentPacketIsColor() const { return _currentPacketIsColor; }
|
||||
bool getCurrentPacketIsCompressed() const { return _currentPacketIsCompressed; }
|
||||
|
@ -98,13 +98,13 @@ private:
|
|||
unsigned char* _lastOctreePacket;
|
||||
int _lastOctreePacketLength;
|
||||
int _duplicatePacketCount;
|
||||
uint64_t _firstSuppressedPacket;
|
||||
quint64 _firstSuppressedPacket;
|
||||
|
||||
int _maxSearchLevel;
|
||||
int _maxLevelReachedInLastSearch;
|
||||
ViewFrustum _currentViewFrustum;
|
||||
ViewFrustum _lastKnownViewFrustum;
|
||||
uint64_t _lastTimeBagEmpty;
|
||||
quint64 _lastTimeBagEmpty;
|
||||
bool _viewFrustumChanging;
|
||||
bool _viewFrustumJustStoppedChanging;
|
||||
bool _currentPacketIsColor;
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include "OctreeServer.h"
|
||||
#include "OctreeServerConsts.h"
|
||||
|
||||
uint64_t startSceneSleepTime = 0;
|
||||
uint64_t endSceneSleepTime = 0;
|
||||
quint64 startSceneSleepTime = 0;
|
||||
quint64 endSceneSleepTime = 0;
|
||||
|
||||
OctreeSendThread::OctreeSendThread(const QUuid& nodeUUID, OctreeServer* myServer) :
|
||||
_nodeUUID(nodeUUID),
|
||||
|
@ -25,7 +25,7 @@ OctreeSendThread::OctreeSendThread(const QUuid& nodeUUID, OctreeServer* myServer
|
|||
}
|
||||
|
||||
bool OctreeSendThread::process() {
|
||||
uint64_t start = usecTimestampNow();
|
||||
quint64 start = usecTimestampNow();
|
||||
bool gotLock = false;
|
||||
|
||||
// don't do any send processing until the initial load of the octree is complete...
|
||||
|
@ -79,16 +79,16 @@ bool OctreeSendThread::process() {
|
|||
return isStillRunning(); // keep running till they terminate us
|
||||
}
|
||||
|
||||
uint64_t OctreeSendThread::_usleepTime = 0;
|
||||
uint64_t OctreeSendThread::_usleepCalls = 0;
|
||||
quint64 OctreeSendThread::_usleepTime = 0;
|
||||
quint64 OctreeSendThread::_usleepCalls = 0;
|
||||
|
||||
uint64_t OctreeSendThread::_totalBytes = 0;
|
||||
uint64_t OctreeSendThread::_totalWastedBytes = 0;
|
||||
uint64_t OctreeSendThread::_totalPackets = 0;
|
||||
quint64 OctreeSendThread::_totalBytes = 0;
|
||||
quint64 OctreeSendThread::_totalWastedBytes = 0;
|
||||
quint64 OctreeSendThread::_totalPackets = 0;
|
||||
|
||||
int OctreeSendThread::handlePacketSend(Node* node, OctreeQueryNode* nodeData, int& trueBytesSent, int& truePacketsSent) {
|
||||
bool debug = _myServer->wantsDebugSending();
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
|
||||
bool packetSent = false; // did we send a packet?
|
||||
int packetsSent = 0;
|
||||
|
@ -283,7 +283,7 @@ int OctreeSendThread::packetDistributor(Node* node, OctreeQueryNode* nodeData, b
|
|||
// If the current view frustum has changed OR we have nothing to send, then search against
|
||||
// the current view frustum for things to send.
|
||||
if (viewFrustumChanged || nodeData->nodeBag.isEmpty()) {
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
if (forceDebugging || (_myServer->wantsDebugSending() && _myServer->wantsVerboseDebug())) {
|
||||
qDebug("(viewFrustumChanged=%s || nodeData->nodeBag.isEmpty() =%s)...",
|
||||
debug::valueOf(viewFrustumChanged), debug::valueOf(nodeData->nodeBag.isEmpty()));
|
||||
|
@ -310,7 +310,7 @@ int OctreeSendThread::packetDistributor(Node* node, OctreeQueryNode* nodeData, b
|
|||
|
||||
if (!viewFrustumChanged && !nodeData->getWantDelta()) {
|
||||
// only set our last sent time if we weren't resetting due to frustum change
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
nodeData->setLastTimeBagEmpty(now);
|
||||
}
|
||||
|
||||
|
@ -374,9 +374,9 @@ int OctreeSendThread::packetDistributor(Node* node, OctreeQueryNode* nodeData, b
|
|||
// If we have something in our nodeBag, then turn them into packets and send them out...
|
||||
if (!nodeData->nodeBag.isEmpty()) {
|
||||
int bytesWritten = 0;
|
||||
uint64_t start = usecTimestampNow();
|
||||
uint64_t startCompressTimeMsecs = OctreePacketData::getCompressContentTime() / 1000;
|
||||
uint64_t startCompressCalls = OctreePacketData::getCompressContentCalls();
|
||||
quint64 start = usecTimestampNow();
|
||||
quint64 startCompressTimeMsecs = OctreePacketData::getCompressContentTime() / 1000;
|
||||
quint64 startCompressCalls = OctreePacketData::getCompressContentCalls();
|
||||
|
||||
int clientMaxPacketsPerInterval = std::max(1,(nodeData->getMaxOctreePacketsPerSecond() / INTERVALS_PER_SECOND));
|
||||
int maxPacketsPerInterval = std::min(clientMaxPacketsPerInterval, _myServer->getPacketsPerClientPerInterval());
|
||||
|
@ -533,13 +533,13 @@ int OctreeSendThread::packetDistributor(Node* node, OctreeQueryNode* nodeData, b
|
|||
}
|
||||
|
||||
|
||||
uint64_t end = usecTimestampNow();
|
||||
quint64 end = usecTimestampNow();
|
||||
int elapsedmsec = (end - start)/1000;
|
||||
|
||||
uint64_t endCompressCalls = OctreePacketData::getCompressContentCalls();
|
||||
quint64 endCompressCalls = OctreePacketData::getCompressContentCalls();
|
||||
int elapsedCompressCalls = endCompressCalls - startCompressCalls;
|
||||
|
||||
uint64_t endCompressTimeMsecs = OctreePacketData::getCompressContentTime() / 1000;
|
||||
quint64 endCompressTimeMsecs = OctreePacketData::getCompressContentTime() / 1000;
|
||||
int elapsedCompressTimeMsecs = endCompressTimeMsecs - startCompressTimeMsecs;
|
||||
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ class OctreeSendThread : public GenericThread {
|
|||
public:
|
||||
OctreeSendThread(const QUuid& nodeUUID, OctreeServer* myServer);
|
||||
|
||||
static uint64_t _totalBytes;
|
||||
static uint64_t _totalWastedBytes;
|
||||
static uint64_t _totalPackets;
|
||||
static quint64 _totalBytes;
|
||||
static quint64 _totalWastedBytes;
|
||||
static quint64 _totalPackets;
|
||||
|
||||
static uint64_t _usleepTime;
|
||||
static uint64_t _usleepCalls;
|
||||
static quint64 _usleepTime;
|
||||
static quint64 _usleepCalls;
|
||||
|
||||
protected:
|
||||
/// Implements generic processing behavior for this thread.
|
||||
|
|
|
@ -120,7 +120,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QString&
|
|||
}
|
||||
|
||||
if (showStats) {
|
||||
uint64_t checkSum;
|
||||
quint64 checkSum;
|
||||
// return a 200
|
||||
QString statsString("<html><doc>\r\n<pre>\r\n");
|
||||
statsString += QString("<b>Your %1 Server is running... <a href='/'>[RELOAD]</a></b>\r\n").arg(getMyServerName());
|
||||
|
@ -140,9 +140,9 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QString&
|
|||
|
||||
statsString += "\r\n";
|
||||
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
const int USECS_PER_MSEC = 1000;
|
||||
uint64_t msecsElapsed = (now - _startedUSecs) / USECS_PER_MSEC;
|
||||
quint64 msecsElapsed = (now - _startedUSecs) / USECS_PER_MSEC;
|
||||
const int MSECS_PER_SEC = 1000;
|
||||
const int SECS_PER_MIN = 60;
|
||||
const int MIN_PER_HOUR = 60;
|
||||
|
@ -175,7 +175,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QString&
|
|||
|
||||
statsString += "\r\n";
|
||||
|
||||
uint64_t msecsElapsed = getLoadElapsedTime() / USECS_PER_MSEC;;
|
||||
quint64 msecsElapsed = getLoadElapsedTime() / USECS_PER_MSEC;;
|
||||
float seconds = (msecsElapsed % MSECS_PER_MIN)/(float)MSECS_PER_SEC;
|
||||
int minutes = (msecsElapsed/(MSECS_PER_MIN)) % MIN_PER_HOUR;
|
||||
int hours = (msecsElapsed/(MSECS_PER_MIN * MIN_PER_HOUR));
|
||||
|
@ -226,12 +226,12 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QString&
|
|||
|
||||
// display outbound packet stats
|
||||
statsString += QString("<b>%1 Outbound Packet Statistics...</b>\r\n").arg(getMyServerName());
|
||||
uint64_t totalOutboundPackets = OctreeSendThread::_totalPackets;
|
||||
uint64_t totalOutboundBytes = OctreeSendThread::_totalBytes;
|
||||
uint64_t totalWastedBytes = OctreeSendThread::_totalWastedBytes;
|
||||
uint64_t totalBytesOfOctalCodes = OctreePacketData::getTotalBytesOfOctalCodes();
|
||||
uint64_t totalBytesOfBitMasks = OctreePacketData::getTotalBytesOfBitMasks();
|
||||
uint64_t totalBytesOfColor = OctreePacketData::getTotalBytesOfColor();
|
||||
quint64 totalOutboundPackets = OctreeSendThread::_totalPackets;
|
||||
quint64 totalOutboundBytes = OctreeSendThread::_totalBytes;
|
||||
quint64 totalWastedBytes = OctreeSendThread::_totalWastedBytes;
|
||||
quint64 totalBytesOfOctalCodes = OctreePacketData::getTotalBytesOfOctalCodes();
|
||||
quint64 totalBytesOfBitMasks = OctreePacketData::getTotalBytesOfBitMasks();
|
||||
quint64 totalBytesOfColor = OctreePacketData::getTotalBytesOfColor();
|
||||
|
||||
const int COLUMN_WIDTH = 10;
|
||||
statsString += QString(" Total Outbound Packets: %1 packets\r\n")
|
||||
|
@ -256,13 +256,13 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QString&
|
|||
// display inbound packet stats
|
||||
statsString += QString().sprintf("<b>%s Edit Statistics... <a href='/resetStats'>[RESET]</a></b>\r\n",
|
||||
getMyServerName());
|
||||
uint64_t averageTransitTimePerPacket = _octreeInboundPacketProcessor->getAverageTransitTimePerPacket();
|
||||
uint64_t averageProcessTimePerPacket = _octreeInboundPacketProcessor->getAverageProcessTimePerPacket();
|
||||
uint64_t averageLockWaitTimePerPacket = _octreeInboundPacketProcessor->getAverageLockWaitTimePerPacket();
|
||||
uint64_t averageProcessTimePerElement = _octreeInboundPacketProcessor->getAverageProcessTimePerElement();
|
||||
uint64_t averageLockWaitTimePerElement = _octreeInboundPacketProcessor->getAverageLockWaitTimePerElement();
|
||||
uint64_t totalElementsProcessed = _octreeInboundPacketProcessor->getTotalElementsProcessed();
|
||||
uint64_t totalPacketsProcessed = _octreeInboundPacketProcessor->getTotalPacketsProcessed();
|
||||
quint64 averageTransitTimePerPacket = _octreeInboundPacketProcessor->getAverageTransitTimePerPacket();
|
||||
quint64 averageProcessTimePerPacket = _octreeInboundPacketProcessor->getAverageProcessTimePerPacket();
|
||||
quint64 averageLockWaitTimePerPacket = _octreeInboundPacketProcessor->getAverageLockWaitTimePerPacket();
|
||||
quint64 averageProcessTimePerElement = _octreeInboundPacketProcessor->getAverageProcessTimePerElement();
|
||||
quint64 averageLockWaitTimePerElement = _octreeInboundPacketProcessor->getAverageLockWaitTimePerElement();
|
||||
quint64 totalElementsProcessed = _octreeInboundPacketProcessor->getTotalElementsProcessed();
|
||||
quint64 totalPacketsProcessed = _octreeInboundPacketProcessor->getTotalPacketsProcessed();
|
||||
|
||||
float averageElementsPerPacket = totalPacketsProcessed == 0 ? 0 : totalElementsProcessed / totalPacketsProcessed;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
bool isInitialLoadComplete() const { return (_persistThread) ? _persistThread->isInitialLoadComplete() : true; }
|
||||
bool isPersistEnabled() const { return (_persistThread) ? true : false; }
|
||||
uint64_t getLoadElapsedTime() const { return (_persistThread) ? _persistThread->getLoadElapsedTime() : 0; }
|
||||
quint64 getLoadElapsedTime() const { return (_persistThread) ? _persistThread->getLoadElapsedTime() : 0; }
|
||||
|
||||
// Subclasses must implement these methods
|
||||
virtual OctreeQueryNode* createOctreeQueryNode() = 0;
|
||||
|
@ -94,7 +94,7 @@ protected:
|
|||
static OctreeServer* _instance;
|
||||
|
||||
time_t _started;
|
||||
uint64_t _startedUSecs;
|
||||
quint64 _startedUSecs;
|
||||
};
|
||||
|
||||
#endif // __octree_server__OctreeServer__
|
||||
|
|
|
@ -445,7 +445,7 @@ void Octree::processRemoveOctreeElementsBitstream(const unsigned char* bitstream
|
|||
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(reinterpret_cast<const char*>(bitstream));
|
||||
unsigned short int sequence = (*((unsigned short int*)(bitstream + numBytesPacketHeader)));
|
||||
uint64_t sentAt = (*((uint64_t*)(bitstream + numBytesPacketHeader + sizeof(sequence))));
|
||||
quint64 sentAt = (*((quint64*)(bitstream + numBytesPacketHeader + sizeof(sequence))));
|
||||
|
||||
int atByte = numBytesPacketHeader + sizeof(sequence) + sizeof(sentAt);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ const bool WANT_OCCLUSION_CULLING = true;
|
|||
const int DONT_CHOP = 0;
|
||||
const int NO_BOUNDARY_ADJUST = 0;
|
||||
const int LOW_RES_MOVING_ADJUST = 1;
|
||||
const uint64_t IGNORE_LAST_SENT = 0;
|
||||
const quint64 IGNORE_LAST_SENT = 0;
|
||||
|
||||
#define IGNORE_SCENE_STATS NULL
|
||||
#define IGNORE_VIEW_FRUSTUM NULL
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
bool wantOcclusionCulling;
|
||||
int boundaryLevelAdjust;
|
||||
float octreeElementSizeScale;
|
||||
uint64_t lastViewFrustumSent;
|
||||
quint64 lastViewFrustumSent;
|
||||
bool forceSendScene;
|
||||
OctreeSceneStats* stats;
|
||||
CoverageMap* map;
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
CoverageMap* map = IGNORE_COVERAGE_MAP,
|
||||
int boundaryLevelAdjust = NO_BOUNDARY_ADJUST,
|
||||
float octreeElementSizeScale = DEFAULT_OCTREE_SIZE_SCALE,
|
||||
uint64_t lastViewFrustumSent = IGNORE_LAST_SENT,
|
||||
quint64 lastViewFrustumSent = IGNORE_LAST_SENT,
|
||||
bool forceSendScene = true,
|
||||
OctreeSceneStats* stats = IGNORE_SCENE_STATS,
|
||||
JurisdictionMap* jurisdictionMap = IGNORE_JURISDICTION_MAP) :
|
||||
|
|
|
@ -24,7 +24,7 @@ const glm::vec3 IDENTITY_RIGHT = glm::vec3( 1.0f, 0.0f, 0.0f);
|
|||
const glm::vec3 IDENTITY_UP = glm::vec3( 0.0f, 1.0f, 0.0f);
|
||||
const glm::vec3 IDENTITY_FRONT = glm::vec3( 0.0f, 0.0f,-1.0f);
|
||||
|
||||
const uint64_t CHANGE_FUDGE = 1000 * 200; // useconds of fudge in determining if we want to resend changed voxels
|
||||
const quint64 CHANGE_FUDGE = 1000 * 200; // useconds of fudge in determining if we want to resend changed voxels
|
||||
|
||||
const int TREE_SCALE = 16384; // ~10 miles.. This is the number of meters of the 0.0 to 1.0 voxel universe
|
||||
|
||||
|
|
|
@ -100,9 +100,9 @@ void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned c
|
|||
if (wantDebugging) {
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(reinterpret_cast<char*>(buffer));
|
||||
unsigned short int sequence = (*((unsigned short int*)(buffer + numBytesPacketHeader)));
|
||||
uint64_t createdAt = (*((uint64_t*)(buffer + numBytesPacketHeader + sizeof(sequence))));
|
||||
uint64_t queuedAt = usecTimestampNow();
|
||||
uint64_t transitTime = queuedAt - createdAt;
|
||||
quint64 createdAt = (*((quint64*)(buffer + numBytesPacketHeader + sizeof(sequence))));
|
||||
quint64 queuedAt = usecTimestampNow();
|
||||
quint64 transitTime = queuedAt - createdAt;
|
||||
|
||||
qDebug() << "OctreeEditPacketSender::queuePacketToNode() queued " << buffer[0] <<
|
||||
" - command to node bytes=" << length <<
|
||||
|
@ -163,7 +163,7 @@ void OctreeEditPacketSender::queuePacketToNodes(unsigned char* buffer, ssize_t l
|
|||
|
||||
assert(serversExist()); // we must have jurisdictions to be here!!
|
||||
|
||||
int headerBytes = numBytesForPacketHeader(reinterpret_cast<char*>(buffer)) + sizeof(short) + sizeof(uint64_t);
|
||||
int headerBytes = numBytesForPacketHeader(reinterpret_cast<char*>(buffer)) + sizeof(short) + sizeof(quint64);
|
||||
unsigned char* octCode = buffer + headerBytes; // skip the packet header to get to the octcode
|
||||
|
||||
// We want to filter out edit messages for servers based on the server's Jurisdiction
|
||||
|
@ -307,10 +307,10 @@ void OctreeEditPacketSender::initializePacket(EditPacketBuffer& packetBuffer, Pa
|
|||
_sequenceNumber++;
|
||||
|
||||
// pack in timestamp
|
||||
uint64_t now = usecTimestampNow();
|
||||
uint64_t* timeAt = (uint64_t*)&packetBuffer._currentBuffer[packetBuffer._currentSize];
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64* timeAt = (quint64*)&packetBuffer._currentBuffer[packetBuffer._currentSize];
|
||||
*timeAt = now;
|
||||
packetBuffer._currentSize += sizeof(uint64_t); // nudge past timestamp
|
||||
packetBuffer._currentSize += sizeof(quint64); // nudge past timestamp
|
||||
|
||||
packetBuffer._currentType = type;
|
||||
}
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
#include "OctreeElement.h"
|
||||
#include "Octree.h"
|
||||
|
||||
uint64_t OctreeElement::_voxelMemoryUsage = 0;
|
||||
uint64_t OctreeElement::_octcodeMemoryUsage = 0;
|
||||
uint64_t OctreeElement::_externalChildrenMemoryUsage = 0;
|
||||
uint64_t OctreeElement::_voxelNodeCount = 0;
|
||||
uint64_t OctreeElement::_voxelNodeLeafCount = 0;
|
||||
quint64 OctreeElement::_voxelMemoryUsage = 0;
|
||||
quint64 OctreeElement::_octcodeMemoryUsage = 0;
|
||||
quint64 OctreeElement::_externalChildrenMemoryUsage = 0;
|
||||
quint64 OctreeElement::_voxelNodeCount = 0;
|
||||
quint64 OctreeElement::_voxelNodeLeafCount = 0;
|
||||
|
||||
OctreeElement::OctreeElement() {
|
||||
// Note: you must call init() from your subclass, otherwise the OctreeElement will not be properly
|
||||
|
@ -270,23 +270,23 @@ void OctreeElement::auditChildren(const char* label) const {
|
|||
#endif // def HAS_AUDIT_CHILDREN
|
||||
|
||||
|
||||
uint64_t OctreeElement::_getChildAtIndexTime = 0;
|
||||
uint64_t OctreeElement::_getChildAtIndexCalls = 0;
|
||||
uint64_t OctreeElement::_setChildAtIndexTime = 0;
|
||||
uint64_t OctreeElement::_setChildAtIndexCalls = 0;
|
||||
quint64 OctreeElement::_getChildAtIndexTime = 0;
|
||||
quint64 OctreeElement::_getChildAtIndexCalls = 0;
|
||||
quint64 OctreeElement::_setChildAtIndexTime = 0;
|
||||
quint64 OctreeElement::_setChildAtIndexCalls = 0;
|
||||
|
||||
#ifdef BLENDED_UNION_CHILDREN
|
||||
uint64_t OctreeElement::_singleChildrenCount = 0;
|
||||
uint64_t OctreeElement::_twoChildrenOffsetCount = 0;
|
||||
uint64_t OctreeElement::_twoChildrenExternalCount = 0;
|
||||
uint64_t OctreeElement::_threeChildrenOffsetCount = 0;
|
||||
uint64_t OctreeElement::_threeChildrenExternalCount = 0;
|
||||
uint64_t OctreeElement::_couldStoreFourChildrenInternally = 0;
|
||||
uint64_t OctreeElement::_couldNotStoreFourChildrenInternally = 0;
|
||||
quint64 OctreeElement::_singleChildrenCount = 0;
|
||||
quint64 OctreeElement::_twoChildrenOffsetCount = 0;
|
||||
quint64 OctreeElement::_twoChildrenExternalCount = 0;
|
||||
quint64 OctreeElement::_threeChildrenOffsetCount = 0;
|
||||
quint64 OctreeElement::_threeChildrenExternalCount = 0;
|
||||
quint64 OctreeElement::_couldStoreFourChildrenInternally = 0;
|
||||
quint64 OctreeElement::_couldNotStoreFourChildrenInternally = 0;
|
||||
#endif
|
||||
|
||||
uint64_t OctreeElement::_externalChildrenCount = 0;
|
||||
uint64_t OctreeElement::_childrenCount[NUMBER_OF_CHILDREN + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
quint64 OctreeElement::_externalChildrenCount = 0;
|
||||
quint64 OctreeElement::_childrenCount[NUMBER_OF_CHILDREN + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
OctreeElement* OctreeElement::getChildAtIndex(int childIndex) const {
|
||||
#ifdef SIMPLE_CHILD_ARRAY
|
||||
|
@ -494,17 +494,17 @@ void OctreeElement::retrieveTwoChildren(OctreeElement*& childOne, OctreeElement*
|
|||
}
|
||||
|
||||
void OctreeElement::decodeThreeOffsets(int64_t& offsetOne, int64_t& offsetTwo, int64_t& offsetThree) const {
|
||||
const uint64_t ENCODE_BITS = 21;
|
||||
const uint64_t ENCODE_MASK = 0xFFFFF;
|
||||
const uint64_t ENCODE_MASK_SIGN = 0x100000;
|
||||
const quint64 ENCODE_BITS = 21;
|
||||
const quint64 ENCODE_MASK = 0xFFFFF;
|
||||
const quint64 ENCODE_MASK_SIGN = 0x100000;
|
||||
|
||||
uint64_t offsetEncodedOne = (_children.offsetsThreeChildrenEncoded >> (ENCODE_BITS * 2)) & ENCODE_MASK;
|
||||
uint64_t offsetEncodedTwo = (_children.offsetsThreeChildrenEncoded >> (ENCODE_BITS * 1)) & ENCODE_MASK;
|
||||
uint64_t offsetEncodedThree = (_children.offsetsThreeChildrenEncoded & ENCODE_MASK);
|
||||
quint64 offsetEncodedOne = (_children.offsetsThreeChildrenEncoded >> (ENCODE_BITS * 2)) & ENCODE_MASK;
|
||||
quint64 offsetEncodedTwo = (_children.offsetsThreeChildrenEncoded >> (ENCODE_BITS * 1)) & ENCODE_MASK;
|
||||
quint64 offsetEncodedThree = (_children.offsetsThreeChildrenEncoded & ENCODE_MASK);
|
||||
|
||||
uint64_t signEncodedOne = (_children.offsetsThreeChildrenEncoded >> (ENCODE_BITS * 2)) & ENCODE_MASK_SIGN;
|
||||
uint64_t signEncodedTwo = (_children.offsetsThreeChildrenEncoded >> (ENCODE_BITS * 1)) & ENCODE_MASK_SIGN;
|
||||
uint64_t signEncodedThree = (_children.offsetsThreeChildrenEncoded & ENCODE_MASK_SIGN);
|
||||
quint64 signEncodedOne = (_children.offsetsThreeChildrenEncoded >> (ENCODE_BITS * 2)) & ENCODE_MASK_SIGN;
|
||||
quint64 signEncodedTwo = (_children.offsetsThreeChildrenEncoded >> (ENCODE_BITS * 1)) & ENCODE_MASK_SIGN;
|
||||
quint64 signEncodedThree = (_children.offsetsThreeChildrenEncoded & ENCODE_MASK_SIGN);
|
||||
|
||||
bool oneNegative = signEncodedOne == ENCODE_MASK_SIGN;
|
||||
bool twoNegative = signEncodedTwo == ENCODE_MASK_SIGN;
|
||||
|
@ -516,11 +516,11 @@ void OctreeElement::decodeThreeOffsets(int64_t& offsetOne, int64_t& offsetTwo, i
|
|||
}
|
||||
|
||||
void OctreeElement::encodeThreeOffsets(int64_t offsetOne, int64_t offsetTwo, int64_t offsetThree) {
|
||||
const uint64_t ENCODE_BITS = 21;
|
||||
const uint64_t ENCODE_MASK = 0xFFFFF;
|
||||
const uint64_t ENCODE_MASK_SIGN = 0x100000;
|
||||
const quint64 ENCODE_BITS = 21;
|
||||
const quint64 ENCODE_MASK = 0xFFFFF;
|
||||
const quint64 ENCODE_MASK_SIGN = 0x100000;
|
||||
|
||||
uint64_t offsetEncodedOne, offsetEncodedTwo, offsetEncodedThree;
|
||||
quint64 offsetEncodedOne, offsetEncodedTwo, offsetEncodedThree;
|
||||
if (offsetOne < 0) {
|
||||
offsetEncodedOne = ((-offsetOne & ENCODE_MASK) | ENCODE_MASK_SIGN);
|
||||
} else {
|
||||
|
|
|
@ -132,9 +132,9 @@ public:
|
|||
bool isDirty() const { return _isDirty; }
|
||||
void clearDirtyBit() { _isDirty = false; }
|
||||
void setDirtyBit() { _isDirty = true; }
|
||||
bool hasChangedSince(uint64_t time) const { return (_lastChanged > time); }
|
||||
bool hasChangedSince(quint64 time) const { return (_lastChanged > time); }
|
||||
void markWithChangedTime();
|
||||
uint64_t getLastChanged() const { return _lastChanged; }
|
||||
quint64 getLastChanged() const { return _lastChanged; }
|
||||
void handleSubtreeChanged(Octree* myTree);
|
||||
|
||||
// Used by VoxelSystem for rendering in/out of view and LOD
|
||||
|
@ -158,28 +158,28 @@ public:
|
|||
static unsigned long getInternalNodeCount() { return _voxelNodeCount - _voxelNodeLeafCount; }
|
||||
static unsigned long getLeafNodeCount() { return _voxelNodeLeafCount; }
|
||||
|
||||
static uint64_t getVoxelMemoryUsage() { return _voxelMemoryUsage; }
|
||||
static uint64_t getOctcodeMemoryUsage() { return _octcodeMemoryUsage; }
|
||||
static uint64_t getExternalChildrenMemoryUsage() { return _externalChildrenMemoryUsage; }
|
||||
static uint64_t getTotalMemoryUsage() { return _voxelMemoryUsage + _octcodeMemoryUsage + _externalChildrenMemoryUsage; }
|
||||
static quint64 getVoxelMemoryUsage() { return _voxelMemoryUsage; }
|
||||
static quint64 getOctcodeMemoryUsage() { return _octcodeMemoryUsage; }
|
||||
static quint64 getExternalChildrenMemoryUsage() { return _externalChildrenMemoryUsage; }
|
||||
static quint64 getTotalMemoryUsage() { return _voxelMemoryUsage + _octcodeMemoryUsage + _externalChildrenMemoryUsage; }
|
||||
|
||||
static uint64_t getGetChildAtIndexTime() { return _getChildAtIndexTime; }
|
||||
static uint64_t getGetChildAtIndexCalls() { return _getChildAtIndexCalls; }
|
||||
static uint64_t getSetChildAtIndexTime() { return _setChildAtIndexTime; }
|
||||
static uint64_t getSetChildAtIndexCalls() { return _setChildAtIndexCalls; }
|
||||
static quint64 getGetChildAtIndexTime() { return _getChildAtIndexTime; }
|
||||
static quint64 getGetChildAtIndexCalls() { return _getChildAtIndexCalls; }
|
||||
static quint64 getSetChildAtIndexTime() { return _setChildAtIndexTime; }
|
||||
static quint64 getSetChildAtIndexCalls() { return _setChildAtIndexCalls; }
|
||||
|
||||
#ifdef BLENDED_UNION_CHILDREN
|
||||
static uint64_t getSingleChildrenCount() { return _singleChildrenCount; }
|
||||
static uint64_t getTwoChildrenOffsetCount() { return _twoChildrenOffsetCount; }
|
||||
static uint64_t getTwoChildrenExternalCount() { return _twoChildrenExternalCount; }
|
||||
static uint64_t getThreeChildrenOffsetCount() { return _threeChildrenOffsetCount; }
|
||||
static uint64_t getThreeChildrenExternalCount() { return _threeChildrenExternalCount; }
|
||||
static uint64_t getCouldStoreFourChildrenInternally() { return _couldStoreFourChildrenInternally; }
|
||||
static uint64_t getCouldNotStoreFourChildrenInternally() { return _couldNotStoreFourChildrenInternally; }
|
||||
static quint64 getSingleChildrenCount() { return _singleChildrenCount; }
|
||||
static quint64 getTwoChildrenOffsetCount() { return _twoChildrenOffsetCount; }
|
||||
static quint64 getTwoChildrenExternalCount() { return _twoChildrenExternalCount; }
|
||||
static quint64 getThreeChildrenOffsetCount() { return _threeChildrenOffsetCount; }
|
||||
static quint64 getThreeChildrenExternalCount() { return _threeChildrenExternalCount; }
|
||||
static quint64 getCouldStoreFourChildrenInternally() { return _couldStoreFourChildrenInternally; }
|
||||
static quint64 getCouldNotStoreFourChildrenInternally() { return _couldNotStoreFourChildrenInternally; }
|
||||
#endif
|
||||
|
||||
static uint64_t getExternalChildrenCount() { return _externalChildrenCount; }
|
||||
static uint64_t getChildrenCount(int childCount) { return _childrenCount[childCount]; }
|
||||
static quint64 getExternalChildrenCount() { return _externalChildrenCount; }
|
||||
static quint64 getChildrenCount(int childCount) { return _childrenCount[childCount]; }
|
||||
|
||||
#ifdef BLENDED_UNION_CHILDREN
|
||||
#ifdef HAS_AUDIT_CHILDREN
|
||||
|
@ -227,7 +227,7 @@ protected:
|
|||
unsigned char* pointer;
|
||||
} _octalCode;
|
||||
|
||||
uint64_t _lastChanged; /// Client and server, timestamp this node was last changed, 8 bytes
|
||||
quint64 _lastChanged; /// Client and server, timestamp this node was last changed, 8 bytes
|
||||
|
||||
/// Client and server, pointers to child nodes, various encodings
|
||||
#ifdef SIMPLE_CHILD_ARRAY
|
||||
|
@ -245,7 +245,7 @@ protected:
|
|||
union children_t {
|
||||
OctreeElement* single;
|
||||
int32_t offsetsTwoChildren[2];
|
||||
uint64_t offsetsThreeChildrenEncoded;
|
||||
quint64 offsetsThreeChildrenEncoded;
|
||||
OctreeElement** external;
|
||||
} _children;
|
||||
#ifdef HAS_AUDIT_CHILDREN
|
||||
|
@ -278,29 +278,29 @@ protected:
|
|||
//static QReadWriteLock _updateHooksLock;
|
||||
static std::vector<OctreeElementUpdateHook*> _updateHooks;
|
||||
|
||||
static uint64_t _voxelNodeCount;
|
||||
static uint64_t _voxelNodeLeafCount;
|
||||
static quint64 _voxelNodeCount;
|
||||
static quint64 _voxelNodeLeafCount;
|
||||
|
||||
static uint64_t _voxelMemoryUsage;
|
||||
static uint64_t _octcodeMemoryUsage;
|
||||
static uint64_t _externalChildrenMemoryUsage;
|
||||
static quint64 _voxelMemoryUsage;
|
||||
static quint64 _octcodeMemoryUsage;
|
||||
static quint64 _externalChildrenMemoryUsage;
|
||||
|
||||
static uint64_t _getChildAtIndexTime;
|
||||
static uint64_t _getChildAtIndexCalls;
|
||||
static uint64_t _setChildAtIndexTime;
|
||||
static uint64_t _setChildAtIndexCalls;
|
||||
static quint64 _getChildAtIndexTime;
|
||||
static quint64 _getChildAtIndexCalls;
|
||||
static quint64 _setChildAtIndexTime;
|
||||
static quint64 _setChildAtIndexCalls;
|
||||
|
||||
#ifdef BLENDED_UNION_CHILDREN
|
||||
static uint64_t _singleChildrenCount;
|
||||
static uint64_t _twoChildrenOffsetCount;
|
||||
static uint64_t _twoChildrenExternalCount;
|
||||
static uint64_t _threeChildrenOffsetCount;
|
||||
static uint64_t _threeChildrenExternalCount;
|
||||
static uint64_t _couldStoreFourChildrenInternally;
|
||||
static uint64_t _couldNotStoreFourChildrenInternally;
|
||||
static quint64 _singleChildrenCount;
|
||||
static quint64 _twoChildrenOffsetCount;
|
||||
static quint64 _twoChildrenExternalCount;
|
||||
static quint64 _threeChildrenOffsetCount;
|
||||
static quint64 _threeChildrenExternalCount;
|
||||
static quint64 _couldStoreFourChildrenInternally;
|
||||
static quint64 _couldNotStoreFourChildrenInternally;
|
||||
#endif
|
||||
static uint64_t _externalChildrenCount;
|
||||
static uint64_t _childrenCount[NUMBER_OF_CHILDREN + 1];
|
||||
static quint64 _externalChildrenCount;
|
||||
static quint64 _childrenCount[NUMBER_OF_CHILDREN + 1];
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__OctreeElement__) */
|
|
@ -10,12 +10,12 @@
|
|||
#include "OctreePacketData.h"
|
||||
|
||||
bool OctreePacketData::_debug = false;
|
||||
uint64_t OctreePacketData::_totalBytesOfOctalCodes = 0;
|
||||
uint64_t OctreePacketData::_totalBytesOfBitMasks = 0;
|
||||
uint64_t OctreePacketData::_totalBytesOfColor = 0;
|
||||
uint64_t OctreePacketData::_totalBytesOfValues = 0;
|
||||
uint64_t OctreePacketData::_totalBytesOfPositions = 0;
|
||||
uint64_t OctreePacketData::_totalBytesOfRawData = 0;
|
||||
quint64 OctreePacketData::_totalBytesOfOctalCodes = 0;
|
||||
quint64 OctreePacketData::_totalBytesOfBitMasks = 0;
|
||||
quint64 OctreePacketData::_totalBytesOfColor = 0;
|
||||
quint64 OctreePacketData::_totalBytesOfValues = 0;
|
||||
quint64 OctreePacketData::_totalBytesOfPositions = 0;
|
||||
quint64 OctreePacketData::_totalBytesOfRawData = 0;
|
||||
|
||||
|
||||
|
||||
|
@ -272,7 +272,7 @@ bool OctreePacketData::appendValue(uint32_t value) {
|
|||
return success;
|
||||
}
|
||||
|
||||
bool OctreePacketData::appendValue(uint64_t value) {
|
||||
bool OctreePacketData::appendValue(quint64 value) {
|
||||
const unsigned char* data = (const unsigned char*)&value;
|
||||
int length = sizeof(value);
|
||||
bool success = append(data, length);
|
||||
|
@ -334,8 +334,8 @@ bool OctreePacketData::appendRawData(const unsigned char* data, int length) {
|
|||
return success;
|
||||
}
|
||||
|
||||
uint64_t OctreePacketData::_compressContentTime = 0;
|
||||
uint64_t OctreePacketData::_compressContentCalls = 0;
|
||||
quint64 OctreePacketData::_compressContentTime = 0;
|
||||
quint64 OctreePacketData::_compressContentCalls = 0;
|
||||
|
||||
bool OctreePacketData::compressContent() {
|
||||
PerformanceWarning warn(false, "OctreePacketData::compressContent()", false, &_compressContentTime, &_compressContentCalls);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
typedef unsigned char OCTREE_PACKET_FLAGS;
|
||||
typedef uint16_t OCTREE_PACKET_SEQUENCE;
|
||||
typedef uint64_t OCTREE_PACKET_SENT_TIME;
|
||||
typedef quint64 OCTREE_PACKET_SENT_TIME;
|
||||
typedef uint16_t OCTREE_PACKET_INTERNAL_SECTION_SIZE;
|
||||
const int MAX_OCTREE_PACKET_SIZE = MAX_PACKET_SIZE;
|
||||
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
bool appendValue(uint32_t value);
|
||||
|
||||
/// appends a unsigned 64 bit int to the end of the stream, may fail if new data stream is too long to fit in packet
|
||||
bool appendValue(uint64_t value);
|
||||
bool appendValue(quint64 value);
|
||||
|
||||
/// appends a float value to the end of the stream, may fail if new data stream is too long to fit in packet
|
||||
bool appendValue(float value);
|
||||
|
@ -170,11 +170,11 @@ public:
|
|||
/// displays contents for debugging
|
||||
void debugContent();
|
||||
|
||||
static uint64_t getCompressContentTime() { return _compressContentTime; } /// total time spent compressing content
|
||||
static uint64_t getCompressContentCalls() { return _compressContentCalls; } /// total calls to compress content
|
||||
static uint64_t getTotalBytesOfOctalCodes() { return _totalBytesOfOctalCodes; } /// total bytes for octal codes
|
||||
static uint64_t getTotalBytesOfBitMasks() { return _totalBytesOfBitMasks; } /// total bytes of bitmasks
|
||||
static uint64_t getTotalBytesOfColor() { return _totalBytesOfColor; } /// total bytes of color
|
||||
static quint64 getCompressContentTime() { return _compressContentTime; } /// total time spent compressing content
|
||||
static quint64 getCompressContentCalls() { return _compressContentCalls; } /// total calls to compress content
|
||||
static quint64 getTotalBytesOfOctalCodes() { return _totalBytesOfOctalCodes; } /// total bytes for octal codes
|
||||
static quint64 getTotalBytesOfBitMasks() { return _totalBytesOfBitMasks; } /// total bytes of bitmasks
|
||||
static quint64 getTotalBytesOfColor() { return _totalBytesOfColor; } /// total bytes of color
|
||||
|
||||
private:
|
||||
/// appends raw bytes, might fail if byte would cause packet to be too large
|
||||
|
@ -210,15 +210,15 @@ private:
|
|||
|
||||
static bool _debug;
|
||||
|
||||
static uint64_t _compressContentTime;
|
||||
static uint64_t _compressContentCalls;
|
||||
static quint64 _compressContentTime;
|
||||
static quint64 _compressContentCalls;
|
||||
|
||||
static uint64_t _totalBytesOfOctalCodes;
|
||||
static uint64_t _totalBytesOfBitMasks;
|
||||
static uint64_t _totalBytesOfColor;
|
||||
static uint64_t _totalBytesOfValues;
|
||||
static uint64_t _totalBytesOfPositions;
|
||||
static uint64_t _totalBytesOfRawData;
|
||||
static quint64 _totalBytesOfOctalCodes;
|
||||
static quint64 _totalBytesOfBitMasks;
|
||||
static quint64 _totalBytesOfColor;
|
||||
static quint64 _totalBytesOfValues;
|
||||
static quint64 _totalBytesOfPositions;
|
||||
static quint64 _totalBytesOfRawData;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__OctreePacketData__) */
|
|
@ -25,7 +25,7 @@ OctreePersistThread::OctreePersistThread(Octree* tree, const QString& filename,
|
|||
bool OctreePersistThread::process() {
|
||||
|
||||
if (!_initialLoadComplete) {
|
||||
uint64_t loadStarted = usecTimestampNow();
|
||||
quint64 loadStarted = usecTimestampNow();
|
||||
qDebug() << "loading Octrees from file: " << _filename << "...";
|
||||
|
||||
bool persistantFileRead;
|
||||
|
@ -37,7 +37,7 @@ bool OctreePersistThread::process() {
|
|||
}
|
||||
_tree->unlock();
|
||||
|
||||
uint64_t loadDone = usecTimestampNow();
|
||||
quint64 loadDone = usecTimestampNow();
|
||||
_loadTimeUSecs = loadDone - loadStarted;
|
||||
|
||||
_tree->clearDirtyBit(); // the tree is clean since we just loaded it
|
||||
|
@ -63,8 +63,8 @@ bool OctreePersistThread::process() {
|
|||
}
|
||||
|
||||
if (isStillRunning()) {
|
||||
uint64_t MSECS_TO_USECS = 1000;
|
||||
uint64_t USECS_TO_SLEEP = 10 * MSECS_TO_USECS; // every 10ms
|
||||
quint64 MSECS_TO_USECS = 1000;
|
||||
quint64 USECS_TO_SLEEP = 10 * MSECS_TO_USECS; // every 10ms
|
||||
usleep(USECS_TO_SLEEP);
|
||||
|
||||
// do our updates then check to save...
|
||||
|
@ -72,9 +72,9 @@ bool OctreePersistThread::process() {
|
|||
_tree->update();
|
||||
_tree->unlock();
|
||||
|
||||
uint64_t now = usecTimestampNow();
|
||||
uint64_t sinceLastSave = now - _lastCheck;
|
||||
uint64_t intervalToCheck = _persistInterval * MSECS_TO_USECS;
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64 sinceLastSave = now - _lastCheck;
|
||||
quint64 intervalToCheck = _persistInterval * MSECS_TO_USECS;
|
||||
|
||||
if (sinceLastSave > intervalToCheck) {
|
||||
// check the dirty bit and persist here...
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
OctreePersistThread(Octree* tree, const QString& filename, int persistInterval = DEFAULT_PERSIST_INTERVAL);
|
||||
|
||||
bool isInitialLoadComplete() const { return _initialLoadComplete; }
|
||||
uint64_t getLoadElapsedTime() const { return _loadTimeUSecs; }
|
||||
quint64 getLoadElapsedTime() const { return _loadTimeUSecs; }
|
||||
|
||||
signals:
|
||||
void loadCompleted();
|
||||
|
@ -38,8 +38,8 @@ private:
|
|||
int _persistInterval;
|
||||
bool _initialLoadComplete;
|
||||
|
||||
uint64_t _loadTimeUSecs;
|
||||
uint64_t _lastCheck;
|
||||
quint64 _loadTimeUSecs;
|
||||
quint64 _lastCheck;
|
||||
};
|
||||
|
||||
#endif // __Octree_server__OctreePersistThread__
|
||||
|
|
|
@ -20,7 +20,7 @@ typedef unsigned char uint8_t;
|
|||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long quint64;
|
||||
#define PRId64 "I64d"
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
|
|
|
@ -691,7 +691,7 @@ OctreeSceneStats::ItemInfo OctreeSceneStats::_ITEMS[] = {
|
|||
};
|
||||
|
||||
const char* OctreeSceneStats::getItemValue(Item item) {
|
||||
const uint64_t USECS_PER_SECOND = 1000 * 1000;
|
||||
const quint64 USECS_PER_SECOND = 1000 * 1000;
|
||||
int calcFPS, calcAverageFPS, calculatedKBPS;
|
||||
switch(item) {
|
||||
case ITEM_ELAPSED: {
|
||||
|
|
|
@ -172,17 +172,17 @@ private:
|
|||
|
||||
// scene timing data in usecs
|
||||
bool _isStarted;
|
||||
uint64_t _start;
|
||||
uint64_t _end;
|
||||
uint64_t _elapsed;
|
||||
uint64_t _lastFullElapsed;
|
||||
quint64 _start;
|
||||
quint64 _end;
|
||||
quint64 _elapsed;
|
||||
quint64 _lastFullElapsed;
|
||||
|
||||
SimpleMovingAverage _elapsedAverage;
|
||||
SimpleMovingAverage _bitsPerOctreeAverage;
|
||||
|
||||
uint64_t _totalEncodeTime;
|
||||
uint64_t _lastFullTotalEncodeTime;
|
||||
uint64_t _encodeStart;
|
||||
quint64 _totalEncodeTime;
|
||||
quint64 _lastFullTotalEncodeTime;
|
||||
quint64 _encodeStart;
|
||||
|
||||
// scene octree related data
|
||||
unsigned long _totalElements;
|
||||
|
|
|
@ -21,11 +21,11 @@ public:
|
|||
|
||||
virtual PacketType getMyPacketType() const { return PacketTypeParticleData; }
|
||||
|
||||
uint64_t getLastDeletedParticlesSentAt() const { return _lastDeletedParticlesSentAt; }
|
||||
void setLastDeletedParticlesSentAt(uint64_t sentAt) { _lastDeletedParticlesSentAt = sentAt; }
|
||||
quint64 getLastDeletedParticlesSentAt() const { return _lastDeletedParticlesSentAt; }
|
||||
void setLastDeletedParticlesSentAt(quint64 sentAt) { _lastDeletedParticlesSentAt = sentAt; }
|
||||
|
||||
private:
|
||||
uint64_t _lastDeletedParticlesSentAt;
|
||||
quint64 _lastDeletedParticlesSentAt;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__ParticleNodeData__) */
|
||||
|
|
|
@ -76,7 +76,7 @@ bool ParticleServer::hasSpecialPacketToSend(Node* node) {
|
|||
// check to see if any new particles have been added since we last sent to this node...
|
||||
ParticleNodeData* nodeData = static_cast<ParticleNodeData*>(node->getLinkedData());
|
||||
if (nodeData) {
|
||||
uint64_t deletedParticlesSentAt = nodeData->getLastDeletedParticlesSentAt();
|
||||
quint64 deletedParticlesSentAt = nodeData->getLastDeletedParticlesSentAt();
|
||||
|
||||
ParticleTree* tree = static_cast<ParticleTree*>(_tree);
|
||||
shouldSendDeletedParticles = tree->hasParticlesDeletedSince(deletedParticlesSentAt);
|
||||
|
@ -91,8 +91,8 @@ int ParticleServer::sendSpecialPacket(Node* node) {
|
|||
|
||||
ParticleNodeData* nodeData = static_cast<ParticleNodeData*>(node->getLinkedData());
|
||||
if (nodeData) {
|
||||
uint64_t deletedParticlesSentAt = nodeData->getLastDeletedParticlesSentAt();
|
||||
uint64_t deletePacketSentAt = usecTimestampNow();
|
||||
quint64 deletedParticlesSentAt = nodeData->getLastDeletedParticlesSentAt();
|
||||
quint64 deletePacketSentAt = usecTimestampNow();
|
||||
|
||||
ParticleTree* tree = static_cast<ParticleTree*>(_tree);
|
||||
bool hasMoreToSend = true;
|
||||
|
@ -121,11 +121,11 @@ void ParticleServer::pruneDeletedParticles() {
|
|||
if (tree->hasAnyDeletedParticles()) {
|
||||
|
||||
//qDebug() << "there are some deleted particles to consider...";
|
||||
uint64_t earliestLastDeletedParticlesSent = usecTimestampNow() + 1; // in the future
|
||||
quint64 earliestLastDeletedParticlesSent = usecTimestampNow() + 1; // in the future
|
||||
foreach (const SharedNodePointer& otherNode, NodeList::getInstance()->getNodeHash()) {
|
||||
if (otherNode->getLinkedData()) {
|
||||
ParticleNodeData* nodeData = static_cast<ParticleNodeData*>(otherNode->getLinkedData());
|
||||
uint64_t nodeLastDeletedParticlesSentAt = nodeData->getLastDeletedParticlesSentAt();
|
||||
quint64 nodeLastDeletedParticlesSentAt = nodeData->getLastDeletedParticlesSentAt();
|
||||
if (nodeLastDeletedParticlesSentAt < earliestLastDeletedParticlesSent) {
|
||||
earliestLastDeletedParticlesSent = nodeLastDeletedParticlesSentAt;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ void Particle::init(glm::vec3 position, float radius, rgbColor color, glm::vec3
|
|||
_id = id;
|
||||
//qDebug() << "Particle::init()... assigning id from init... _id=" << _id;
|
||||
}
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
_lastEdited = now;
|
||||
_lastUpdated = now;
|
||||
_created = now; // will get updated as appropriate in setAge()
|
||||
|
@ -169,8 +169,8 @@ bool Particle::appendParticleData(OctreePacketData* packetData) const {
|
|||
int Particle::expectedBytes() {
|
||||
int expectedBytes = sizeof(uint32_t) // id
|
||||
+ sizeof(float) // age
|
||||
+ sizeof(uint64_t) // last updated
|
||||
+ sizeof(uint64_t) // lasted edited
|
||||
+ sizeof(quint64) // last updated
|
||||
+ sizeof(quint64) // lasted edited
|
||||
+ sizeof(float) // radius
|
||||
+ sizeof(glm::vec3) // position
|
||||
+ sizeof(rgbColor) // color
|
||||
|
@ -185,7 +185,7 @@ int Particle::expectedBytes() {
|
|||
|
||||
int Particle::expectedEditMessageBytes() {
|
||||
int expectedBytes = sizeof(uint32_t) // id
|
||||
+ sizeof(uint64_t) // lasted edited
|
||||
+ sizeof(quint64) // lasted edited
|
||||
+ sizeof(float) // radius
|
||||
+ sizeof(glm::vec3) // position
|
||||
+ sizeof(rgbColor) // color
|
||||
|
@ -514,7 +514,7 @@ bool Particle::encodeParticleEditMessageDetails(PacketType command, ParticleID i
|
|||
}
|
||||
|
||||
// lastEdited
|
||||
uint64_t lastEdited = properties.getLastEdited();
|
||||
quint64 lastEdited = properties.getLastEdited();
|
||||
memcpy(copyAt, &lastEdited, sizeof(lastEdited));
|
||||
copyAt += sizeof(lastEdited);
|
||||
sizeOut += sizeof(lastEdited);
|
||||
|
@ -646,9 +646,9 @@ void Particle::adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssiz
|
|||
}
|
||||
|
||||
// lastEdited
|
||||
uint64_t lastEditedInLocalTime;
|
||||
quint64 lastEditedInLocalTime;
|
||||
memcpy(&lastEditedInLocalTime, dataAt, sizeof(lastEditedInLocalTime));
|
||||
uint64_t lastEditedInServerTime = lastEditedInLocalTime + clockSkew;
|
||||
quint64 lastEditedInServerTime = lastEditedInLocalTime + clockSkew;
|
||||
memcpy(dataAt, &lastEditedInServerTime, sizeof(lastEditedInServerTime));
|
||||
const bool wantDebug = false;
|
||||
if (wantDebug) {
|
||||
|
@ -663,14 +663,14 @@ void Particle::adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssiz
|
|||
const float MIN_EXPECTED_FRAME_PERIOD = 0.005f; // 1/200th of a second
|
||||
const float MIN_VALID_SPEED = 9.8 * MIN_EXPECTED_FRAME_PERIOD / (float)(TREE_SCALE);
|
||||
|
||||
void Particle::update(const uint64_t& now) {
|
||||
void Particle::update(const quint64& now) {
|
||||
float timeElapsed = (float)(now - _lastUpdated) / (float)(USECS_PER_SECOND);
|
||||
_lastUpdated = now;
|
||||
|
||||
// calculate our default shouldDie state... then allow script to change it if it wants...
|
||||
float speed = glm::length(_velocity);
|
||||
bool isStopped = (speed < MIN_VALID_SPEED);
|
||||
const uint64_t REALLY_OLD = 30 * USECS_PER_SECOND; // 30 seconds
|
||||
const quint64 REALLY_OLD = 30 * USECS_PER_SECOND; // 30 seconds
|
||||
bool isReallyOld = ((now - _created) > REALLY_OLD);
|
||||
bool isInHand = getInHand();
|
||||
bool shouldDie = (getAge() > getLifetime()) || getShouldDie() || (!isInHand && isStopped && isReallyOld);
|
||||
|
@ -799,7 +799,7 @@ void Particle::collisionWithVoxel(VoxelDetail* voxelDetails) {
|
|||
|
||||
|
||||
void Particle::setAge(float age) {
|
||||
uint64_t ageInUsecs = age * USECS_PER_SECOND;
|
||||
quint64 ageInUsecs = age * USECS_PER_SECOND;
|
||||
_created = usecTimestampNow() - ageInUsecs;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
bool getInHand() const { return _inHand; }
|
||||
bool getShouldDie() const { return _shouldDie; }
|
||||
|
||||
uint64_t getLastEdited() const { return _lastEdited; }
|
||||
quint64 getLastEdited() const { return _lastEdited; }
|
||||
uint16_t getChangedBits() const;
|
||||
|
||||
/// set position in meter units
|
||||
|
@ -112,7 +112,7 @@ private:
|
|||
|
||||
uint32_t _id;
|
||||
bool _idSet;
|
||||
uint64_t _lastEdited;
|
||||
quint64 _lastEdited;
|
||||
bool _positionChanged;
|
||||
bool _colorChanged;
|
||||
bool _radiusChanged;
|
||||
|
@ -198,10 +198,10 @@ public:
|
|||
ParticleProperties getProperties() const;
|
||||
|
||||
/// The last updated/simulated time of this particle from the time perspective of the authoritative server/source
|
||||
uint64_t getLastUpdated() const { return _lastUpdated; }
|
||||
quint64 getLastUpdated() const { return _lastUpdated; }
|
||||
|
||||
/// The last edited time of this particle from the time perspective of the authoritative server/source
|
||||
uint64_t getLastEdited() const { return _lastEdited; }
|
||||
quint64 getLastEdited() const { return _lastEdited; }
|
||||
|
||||
/// lifetime of the particle in seconds
|
||||
float getAge() const { return static_cast<float>(usecTimestampNow() - _created) / static_cast<float>(USECS_PER_SECOND); }
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
|
||||
static void adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssize_t length, int clockSkew);
|
||||
|
||||
void update(const uint64_t& now);
|
||||
void update(const quint64& now);
|
||||
void collisionWithParticle(Particle* other);
|
||||
void collisionWithVoxel(VoxelDetail* voxel);
|
||||
|
||||
|
@ -300,11 +300,11 @@ protected:
|
|||
uint32_t _creatorTokenID;
|
||||
bool _newlyCreated;
|
||||
|
||||
uint64_t _lastUpdated;
|
||||
uint64_t _lastEdited;
|
||||
quint64 _lastUpdated;
|
||||
quint64 _lastEdited;
|
||||
|
||||
// this doesn't go on the wire, we send it as lifetime
|
||||
uint64_t _created;
|
||||
quint64 _created;
|
||||
|
||||
// used by the static interfaces for creator token ids
|
||||
static uint32_t _nextCreatorTokenID;
|
||||
|
|
|
@ -336,7 +336,7 @@ void ParticleTree::update() {
|
|||
storeParticle(args._movingParticles[i]);
|
||||
} else {
|
||||
uint32_t particleID = args._movingParticles[i].getID();
|
||||
uint64_t deletedAt = usecTimestampNow();
|
||||
quint64 deletedAt = usecTimestampNow();
|
||||
_recentlyDeletedParticlesLock.lockForWrite();
|
||||
_recentlyDeletedParticleIDs.insert(deletedAt, particleID);
|
||||
_recentlyDeletedParticlesLock.unlock();
|
||||
|
@ -348,12 +348,12 @@ void ParticleTree::update() {
|
|||
}
|
||||
|
||||
|
||||
bool ParticleTree::hasParticlesDeletedSince(uint64_t sinceTime) {
|
||||
bool ParticleTree::hasParticlesDeletedSince(quint64 sinceTime) {
|
||||
// we can probably leverage the ordered nature of QMultiMap to do this quickly...
|
||||
bool hasSomethingNewer = false;
|
||||
|
||||
_recentlyDeletedParticlesLock.lockForRead();
|
||||
QMultiMap<uint64_t, uint32_t>::const_iterator iterator = _recentlyDeletedParticleIDs.constBegin();
|
||||
QMultiMap<quint64, uint32_t>::const_iterator iterator = _recentlyDeletedParticleIDs.constBegin();
|
||||
while (iterator != _recentlyDeletedParticleIDs.constEnd()) {
|
||||
//qDebug() << "considering... time/key:" << iterator.key();
|
||||
if (iterator.key() > sinceTime) {
|
||||
|
@ -367,7 +367,7 @@ bool ParticleTree::hasParticlesDeletedSince(uint64_t sinceTime) {
|
|||
}
|
||||
|
||||
// sinceTime is an in/out parameter - it will be side effected with the last time sent out
|
||||
bool ParticleTree::encodeParticlesDeletedSince(uint64_t& sinceTime, unsigned char* outputBuffer, size_t maxLength,
|
||||
bool ParticleTree::encodeParticlesDeletedSince(quint64& sinceTime, unsigned char* outputBuffer, size_t maxLength,
|
||||
size_t& outputLength) {
|
||||
|
||||
bool hasMoreToSend = true;
|
||||
|
@ -386,7 +386,7 @@ bool ParticleTree::encodeParticlesDeletedSince(uint64_t& sinceTime, unsigned cha
|
|||
// we keep a multi map of particle IDs to timestamps, we only want to include the particle IDs that have been
|
||||
// deleted since we last sent to this node
|
||||
_recentlyDeletedParticlesLock.lockForRead();
|
||||
QMultiMap<uint64_t, uint32_t>::const_iterator iterator = _recentlyDeletedParticleIDs.constBegin();
|
||||
QMultiMap<quint64, uint32_t>::const_iterator iterator = _recentlyDeletedParticleIDs.constBegin();
|
||||
while (iterator != _recentlyDeletedParticleIDs.constEnd()) {
|
||||
QList<uint32_t> values = _recentlyDeletedParticleIDs.values(iterator.key());
|
||||
for (int valueItem = 0; valueItem < values.size(); ++valueItem) {
|
||||
|
@ -431,12 +431,12 @@ bool ParticleTree::encodeParticlesDeletedSince(uint64_t& sinceTime, unsigned cha
|
|||
}
|
||||
|
||||
// called by the server when it knows all nodes have been sent deleted packets
|
||||
void ParticleTree::forgetParticlesDeletedBefore(uint64_t sinceTime) {
|
||||
void ParticleTree::forgetParticlesDeletedBefore(quint64 sinceTime) {
|
||||
//qDebug() << "forgetParticlesDeletedBefore()";
|
||||
QSet<uint64_t> keysToRemove;
|
||||
QSet<quint64> keysToRemove;
|
||||
|
||||
_recentlyDeletedParticlesLock.lockForWrite();
|
||||
QMultiMap<uint64_t, uint32_t>::iterator iterator = _recentlyDeletedParticleIDs.begin();
|
||||
QMultiMap<quint64, uint32_t>::iterator iterator = _recentlyDeletedParticleIDs.begin();
|
||||
// First find all the keys in the map that are older and need to be deleted
|
||||
while (iterator != _recentlyDeletedParticleIDs.end()) {
|
||||
//qDebug() << "considering... time/key:" << iterator.key();
|
||||
|
@ -448,7 +448,7 @@ void ParticleTree::forgetParticlesDeletedBefore(uint64_t sinceTime) {
|
|||
}
|
||||
|
||||
// Now run through the keysToRemove and remove them
|
||||
foreach (uint64_t value, keysToRemove) {
|
||||
foreach (quint64 value, keysToRemove) {
|
||||
//qDebug() << "removing the key, _recentlyDeletedParticleIDs.remove(value); time/key:" << value;
|
||||
_recentlyDeletedParticleIDs.remove(value);
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ public:
|
|||
void removeNewlyCreatedHook(NewlyCreatedParticleHook* hook);
|
||||
|
||||
bool hasAnyDeletedParticles() const { return _recentlyDeletedParticleIDs.size() > 0; }
|
||||
bool hasParticlesDeletedSince(uint64_t sinceTime);
|
||||
bool encodeParticlesDeletedSince(uint64_t& sinceTime, unsigned char* packetData, size_t maxLength, size_t& outputLength);
|
||||
void forgetParticlesDeletedBefore(uint64_t sinceTime);
|
||||
bool hasParticlesDeletedSince(quint64 sinceTime);
|
||||
bool encodeParticlesDeletedSince(quint64& sinceTime, unsigned char* packetData, size_t maxLength, size_t& outputLength);
|
||||
void forgetParticlesDeletedBefore(quint64 sinceTime);
|
||||
|
||||
void processEraseMessage(const QByteArray& dataByteArray, const HifiSockAddr& senderSockAddr, Node* sourceNode);
|
||||
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
|
||||
|
||||
QReadWriteLock _recentlyDeletedParticlesLock;
|
||||
QMultiMap<uint64_t, uint32_t> _recentlyDeletedParticleIDs;
|
||||
QMultiMap<quint64, uint32_t> _recentlyDeletedParticleIDs;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__ParticleTree__) */
|
||||
|
|
|
@ -55,11 +55,11 @@ public:
|
|||
const QUuid& getUUID() const { return _uuid; }
|
||||
void setUUID(const QUuid& uuid) { _uuid = uuid; }
|
||||
|
||||
uint64_t getWakeMicrostamp() const { return _wakeMicrostamp; }
|
||||
void setWakeMicrostamp(uint64_t wakeMicrostamp) { _wakeMicrostamp = wakeMicrostamp; }
|
||||
quint64 getWakeMicrostamp() const { return _wakeMicrostamp; }
|
||||
void setWakeMicrostamp(quint64 wakeMicrostamp) { _wakeMicrostamp = wakeMicrostamp; }
|
||||
|
||||
uint64_t getLastHeardMicrostamp() const { return _lastHeardMicrostamp; }
|
||||
void setLastHeardMicrostamp(uint64_t lastHeardMicrostamp) { _lastHeardMicrostamp = lastHeardMicrostamp; }
|
||||
quint64 getLastHeardMicrostamp() const { return _lastHeardMicrostamp; }
|
||||
void setLastHeardMicrostamp(quint64 lastHeardMicrostamp) { _lastHeardMicrostamp = lastHeardMicrostamp; }
|
||||
|
||||
const HifiSockAddr& getPublicSocket() const { return _publicSocket; }
|
||||
void setPublicSocket(const HifiSockAddr& publicSocket);
|
||||
|
@ -98,8 +98,8 @@ private:
|
|||
|
||||
NODE_TYPE _type;
|
||||
QUuid _uuid;
|
||||
uint64_t _wakeMicrostamp;
|
||||
uint64_t _lastHeardMicrostamp;
|
||||
quint64 _wakeMicrostamp;
|
||||
quint64 _lastHeardMicrostamp;
|
||||
HifiSockAddr _publicSocket;
|
||||
HifiSockAddr _localSocket;
|
||||
HifiSockAddr* _activeSocket;
|
||||
|
|
|
@ -128,7 +128,7 @@ void NodeList::timePingReply(const QByteArray& packet) {
|
|||
|
||||
// The other node's expected time should be our original time plus the one way flight time
|
||||
// anything other than that is clock skew
|
||||
uint64_t othersExprectedReply = ourOriginalTime + oneWayFlightTime;
|
||||
quint64 othersExprectedReply = ourOriginalTime + oneWayFlightTime;
|
||||
int clockSkew = othersReplyTime - othersExprectedReply;
|
||||
|
||||
matchingNode->setPingMs(pingTime / 1000);
|
||||
|
|
|
@ -35,9 +35,9 @@ const int NODES_PER_BUCKET = 100;
|
|||
|
||||
const int MAX_PACKET_SIZE = 1500;
|
||||
|
||||
const uint64_t NODE_SILENCE_THRESHOLD_USECS = 2 * 1000 * 1000;
|
||||
const uint64_t DOMAIN_SERVER_CHECK_IN_USECS = 1 * 1000000;
|
||||
const uint64_t PING_INACTIVE_NODE_INTERVAL_USECS = 1 * 1000 * 1000;
|
||||
const quint64 NODE_SILENCE_THRESHOLD_USECS = 2 * 1000 * 1000;
|
||||
const quint64 DOMAIN_SERVER_CHECK_IN_USECS = 1 * 1000000;
|
||||
const quint64 PING_INACTIVE_NODE_INTERVAL_USECS = 1 * 1000 * 1000;
|
||||
|
||||
extern const char SOLO_NODE_TYPES[2];
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "PacketSender.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
const uint64_t PacketSender::USECS_PER_SECOND = 1000 * 1000;
|
||||
const uint64_t PacketSender::SENDING_INTERVAL_ADJUST = 200; // approaximate 200us
|
||||
const quint64 PacketSender::USECS_PER_SECOND = 1000 * 1000;
|
||||
const quint64 PacketSender::SENDING_INTERVAL_ADJUST = 200; // approaximate 200us
|
||||
const int PacketSender::TARGET_FPS = 60;
|
||||
const int PacketSender::MAX_SLEEP_INTERVAL = PacketSender::USECS_PER_SECOND;
|
||||
|
||||
|
@ -82,13 +82,13 @@ bool PacketSender::threadedProcess() {
|
|||
int packetsPerSecondTarget = (_packetsPerSecond > MINIMUM_PACKETS_PER_SECOND)
|
||||
? _packetsPerSecond : MINIMUM_PACKETS_PER_SECOND;
|
||||
|
||||
uint64_t intervalBetweenSends = USECS_PER_SECOND / packetsPerSecondTarget;
|
||||
uint64_t sleepInterval = (intervalBetweenSends > SENDING_INTERVAL_ADJUST) ?
|
||||
quint64 intervalBetweenSends = USECS_PER_SECOND / packetsPerSecondTarget;
|
||||
quint64 sleepInterval = (intervalBetweenSends > SENDING_INTERVAL_ADJUST) ?
|
||||
intervalBetweenSends - SENDING_INTERVAL_ADJUST : intervalBetweenSends;
|
||||
|
||||
// We'll sleep before we send, this way, we can set our last send time to be our ACTUAL last send time
|
||||
uint64_t now = usecTimestampNow();
|
||||
uint64_t elapsed = now - _lastSendTime;
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64 elapsed = now - _lastSendTime;
|
||||
int usecToSleep = sleepInterval - elapsed;
|
||||
|
||||
// If we've never sent, or it's been a long time since we sent, then our elapsed time will be quite large
|
||||
|
@ -132,18 +132,18 @@ bool PacketSender::threadedProcess() {
|
|||
// We also keep a running total of packets sent over multiple calls to process() so that we can adjust up or down for
|
||||
// possible rounding error that would occur if we only considered whole integer packet counts per call to process
|
||||
bool PacketSender::nonThreadedProcess() {
|
||||
uint64_t now = usecTimestampNow();
|
||||
quint64 now = usecTimestampNow();
|
||||
|
||||
if (_lastProcessCallTime == 0) {
|
||||
_lastProcessCallTime = now - _usecsPerProcessCallHint;
|
||||
}
|
||||
|
||||
const uint64_t MINIMUM_POSSIBLE_CALL_TIME = 10; // in usecs
|
||||
const uint64_t USECS_PER_SECOND = 1000 * 1000;
|
||||
const quint64 MINIMUM_POSSIBLE_CALL_TIME = 10; // in usecs
|
||||
const quint64 USECS_PER_SECOND = 1000 * 1000;
|
||||
const float ZERO_RESET_CALLS_PER_SECOND = 1; // used in guard against divide by zero
|
||||
|
||||
// keep track of our process call times, so we have a reliable account of how often our caller calls us
|
||||
uint64_t elapsedSinceLastCall = now - _lastProcessCallTime;
|
||||
quint64 elapsedSinceLastCall = now - _lastProcessCallTime;
|
||||
_lastProcessCallTime = now;
|
||||
_averageProcessCallTime.updateAverage(elapsedSinceLastCall);
|
||||
|
||||
|
@ -165,7 +165,7 @@ bool PacketSender::nonThreadedProcess() {
|
|||
if (_lastPPSCheck == 0) {
|
||||
_lastPPSCheck = now;
|
||||
// pretend like our lifetime began once call cycle for now, this makes our lifetime PPS start out most accurately
|
||||
_started = now - (uint64_t)averageCallTime;
|
||||
_started = now - (quint64)averageCallTime;
|
||||
}
|
||||
|
||||
|
||||
|
@ -215,7 +215,7 @@ bool PacketSender::nonThreadedProcess() {
|
|||
|
||||
// So no mater whether or not we're getting called more or less than once per second, we still need to do some bookkeeping
|
||||
// to make sure we send a few extra packets to even out our flow rate.
|
||||
uint64_t elapsedSinceLastCheck = now - _lastPPSCheck;
|
||||
quint64 elapsedSinceLastCheck = now - _lastPPSCheck;
|
||||
|
||||
// we might want to tun this in the future and only check after a certain number of call intervals. for now we check
|
||||
// each time and adjust accordingly
|
||||
|
|
|
@ -20,8 +20,8 @@ class PacketSender : public GenericThread {
|
|||
Q_OBJECT
|
||||
public:
|
||||
|
||||
static const uint64_t USECS_PER_SECOND;
|
||||
static const uint64_t SENDING_INTERVAL_ADJUST;
|
||||
static const quint64 USECS_PER_SECOND;
|
||||
static const quint64 SENDING_INTERVAL_ADJUST;
|
||||
static const int TARGET_FPS;
|
||||
static const int MAX_SLEEP_INTERVAL;
|
||||
|
||||
|
@ -72,46 +72,46 @@ public:
|
|||
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalBytesQueued / getLifetimeInSeconds()); }
|
||||
|
||||
/// returns lifetime of this object from first packet sent to now in usecs
|
||||
uint64_t getLifetimeInUsecs() const { return (usecTimestampNow() - _started); }
|
||||
quint64 getLifetimeInUsecs() const { return (usecTimestampNow() - _started); }
|
||||
|
||||
/// returns lifetime of this object from first packet sent to now in usecs
|
||||
float getLifetimeInSeconds() const { return ((float)getLifetimeInUsecs() / (float)USECS_PER_SECOND); }
|
||||
|
||||
/// returns the total packets sent by this object over its lifetime
|
||||
uint64_t getLifetimePacketsSent() const { return _totalPacketsSent; }
|
||||
quint64 getLifetimePacketsSent() const { return _totalPacketsSent; }
|
||||
|
||||
/// returns the total bytes sent by this object over its lifetime
|
||||
uint64_t getLifetimeBytesSent() const { return _totalBytesSent; }
|
||||
quint64 getLifetimeBytesSent() const { return _totalBytesSent; }
|
||||
|
||||
/// returns the total packets queued by this object over its lifetime
|
||||
uint64_t getLifetimePacketsQueued() const { return _totalPacketsQueued; }
|
||||
quint64 getLifetimePacketsQueued() const { return _totalPacketsQueued; }
|
||||
|
||||
/// returns the total bytes queued by this object over its lifetime
|
||||
uint64_t getLifetimeBytesQueued() const { return _totalBytesQueued; }
|
||||
quint64 getLifetimeBytesQueued() const { return _totalBytesQueued; }
|
||||
signals:
|
||||
void packetSent(quint64);
|
||||
protected:
|
||||
int _packetsPerSecond;
|
||||
int _usecsPerProcessCallHint;
|
||||
uint64_t _lastProcessCallTime;
|
||||
quint64 _lastProcessCallTime;
|
||||
SimpleMovingAverage _averageProcessCallTime;
|
||||
|
||||
private:
|
||||
std::vector<NetworkPacket> _packets;
|
||||
uint64_t _lastSendTime;
|
||||
quint64 _lastSendTime;
|
||||
|
||||
bool threadedProcess();
|
||||
bool nonThreadedProcess();
|
||||
|
||||
uint64_t _lastPPSCheck;
|
||||
quint64 _lastPPSCheck;
|
||||
int _packetsOverCheckInterval;
|
||||
|
||||
uint64_t _started;
|
||||
uint64_t _totalPacketsSent;
|
||||
uint64_t _totalBytesSent;
|
||||
quint64 _started;
|
||||
quint64 _totalPacketsSent;
|
||||
quint64 _totalBytesSent;
|
||||
|
||||
uint64_t _totalPacketsQueued;
|
||||
uint64_t _totalBytesQueued;
|
||||
quint64 _totalPacketsQueued;
|
||||
quint64 _totalBytesQueued;
|
||||
};
|
||||
|
||||
#endif // __shared__PacketSender__
|
||||
|
|
|
@ -23,8 +23,8 @@ bool PerformanceWarning::_suppressShortTimings = false;
|
|||
|
||||
// Destructor handles recording all of our stats
|
||||
PerformanceWarning::~PerformanceWarning() {
|
||||
uint64_t end = usecTimestampNow();
|
||||
uint64_t elapsedusec = (end - _start);
|
||||
quint64 end = usecTimestampNow();
|
||||
quint64 elapsedusec = (end - _start);
|
||||
double elapsedmsec = elapsedusec / 1000.0;
|
||||
if ((_alwaysDisplay || _renderWarningsOn) && elapsedmsec > 1) {
|
||||
if (elapsedmsec > 1000) {
|
||||
|
|
|
@ -28,17 +28,17 @@
|
|||
|
||||
class PerformanceWarning {
|
||||
private:
|
||||
uint64_t _start;
|
||||
quint64 _start;
|
||||
const char* _message;
|
||||
bool _renderWarningsOn;
|
||||
bool _alwaysDisplay;
|
||||
uint64_t* _runningTotal;
|
||||
uint64_t* _totalCalls;
|
||||
quint64* _runningTotal;
|
||||
quint64* _totalCalls;
|
||||
static bool _suppressShortTimings;
|
||||
public:
|
||||
|
||||
PerformanceWarning(bool renderWarnings, const char* message, bool alwaysDisplay = false,
|
||||
uint64_t* runningTotal = NULL, uint64_t* totalCalls = NULL) :
|
||||
quint64* runningTotal = NULL, quint64* totalCalls = NULL) :
|
||||
_start(usecTimestampNow()),
|
||||
_message(message),
|
||||
_renderWarningsOn(renderWarnings),
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace type_traits { // those are needed for the declaration, see below
|
|||
template< typename T > struct make_unsigned< T, 1 > { typedef uint8_t type; };
|
||||
template< typename T > struct make_unsigned< T, 2 > { typedef uint16_t type; };
|
||||
template< typename T > struct make_unsigned< T, 4 > { typedef uint32_t type; };
|
||||
template< typename T > struct make_unsigned< T, 8 > { typedef uint64_t type; };
|
||||
template< typename T > struct make_unsigned< T, 8 > { typedef quint64 type; };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ bool ReceivedPacketProcessor::process() {
|
|||
// If a derived class handles process sleeping, like the JurisdiciontListener, then it can set
|
||||
// this _dontSleep member and we will honor that request.
|
||||
if (_packets.size() == 0 && !_dontSleep) {
|
||||
const uint64_t RECEIVED_THREAD_SLEEP_INTERVAL = (1000 * 1000)/60; // check at 60fps
|
||||
const quint64 RECEIVED_THREAD_SLEEP_INTERVAL = (1000 * 1000)/60; // check at 60fps
|
||||
usleep(RECEIVED_THREAD_SLEEP_INTERVAL);
|
||||
}
|
||||
while (_packets.size() > 0) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "PacketHeaders.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
uint64_t usecTimestamp(const timeval *time) {
|
||||
quint64 usecTimestamp(const timeval *time) {
|
||||
return (time->tv_sec * 1000000 + time->tv_usec);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ void usecTimestampNowForceClockSkew(int clockSkew) {
|
|||
::usecTimestampNowAdjust = clockSkew;
|
||||
}
|
||||
|
||||
uint64_t usecTimestampNow() {
|
||||
quint64 usecTimestampNow() {
|
||||
timeval now;
|
||||
gettimeofday(&now, NULL);
|
||||
return (now.tv_sec * 1000000 + now.tv_usec) + ::usecTimestampNowAdjust;
|
||||
|
|
|
@ -57,12 +57,12 @@ static const float METER = 1.0f;
|
|||
static const float DECIMETER = 0.1f;
|
||||
static const float CENTIMETER = 0.01f;
|
||||
static const float MILLIIMETER = 0.001f;
|
||||
static const uint64_t USECS_PER_MSEC = 1000;
|
||||
static const uint64_t MSECS_PER_SECOND = 1000;
|
||||
static const uint64_t USECS_PER_SECOND = USECS_PER_MSEC * MSECS_PER_SECOND;
|
||||
static const quint64 USECS_PER_MSEC = 1000;
|
||||
static const quint64 MSECS_PER_SECOND = 1000;
|
||||
static const quint64 USECS_PER_SECOND = USECS_PER_MSEC * MSECS_PER_SECOND;
|
||||
|
||||
uint64_t usecTimestamp(const timeval *time);
|
||||
uint64_t usecTimestampNow();
|
||||
quint64 usecTimestamp(const timeval *time);
|
||||
quint64 usecTimestampNow();
|
||||
void usecTimestampNowForceClockSkew(int clockSkew);
|
||||
|
||||
float randFloat();
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
float getAverageSampleValuePerSecond();
|
||||
private:
|
||||
int _numSamples;
|
||||
uint64_t _lastEventTimestamp;
|
||||
quint64 _lastEventTimestamp;
|
||||
float _average;
|
||||
float _eventDeltaAverage;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ const glBufferIndex GLBUFFER_INDEX_UNKNOWN = ULONG_MAX;
|
|||
const float SIXTY_FPS_IN_MILLISECONDS = 1000.0f / 60.0f;
|
||||
const float VIEW_CULLING_RATE_IN_MILLISECONDS = 1000.0f; // once a second is fine
|
||||
|
||||
const uint64_t CLIENT_TO_SERVER_VOXEL_SEND_INTERVAL_USECS = 1000 * 5; // 1 packet every 50 milliseconds
|
||||
const quint64 CLIENT_TO_SERVER_VOXEL_SEND_INTERVAL_USECS = 1000 * 5; // 1 packet every 50 milliseconds
|
||||
|
||||
|
||||
const int DEFAULT_MAX_VOXEL_PPS = 600; // the default maximum PPS we think a voxel server should send to a client
|
||||
|
|
|
@ -44,8 +44,8 @@ bool createVoxelEditMessage(PacketType command, short int sequence,
|
|||
*sequenceAt = sequence;
|
||||
|
||||
// pack in timestamp
|
||||
uint64_t now = usecTimestampNow();
|
||||
uint64_t* timeAt = (uint64_t*)&messageBuffer[numBytesPacketHeader + sizeof(sequence)];
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64* timeAt = (quint64*)&messageBuffer[numBytesPacketHeader + sizeof(sequence)];
|
||||
*timeAt = now;
|
||||
|
||||
unsigned char* copyAt = &messageBuffer[numBytesPacketHeader + sizeof(sequence) + sizeof(now)];
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
typedef unsigned char VOXEL_PACKET_FLAGS;
|
||||
typedef uint16_t VOXEL_PACKET_SEQUENCE;
|
||||
typedef uint64_t VOXEL_PACKET_SENT_TIME;
|
||||
typedef quint64 VOXEL_PACKET_SENT_TIME;
|
||||
typedef uint16_t VOXEL_PACKET_INTERNAL_SECTION_SIZE;
|
||||
const int MAX_VOXEL_PACKET_SIZE = MAX_PACKET_SIZE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue