From 8686fecdaddf89ab6a079eb6baa868504a349329 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 28 Apr 2014 16:08:26 -0700 Subject: [PATCH 1/4] Switch OctreeSceneStats to quintX --- libraries/octree/src/OctreeSceneStats.cpp | 111 +++++++++------- libraries/octree/src/OctreeSceneStats.h | 153 +++++++++++----------- 2 files changed, 143 insertions(+), 121 deletions(-) diff --git a/libraries/octree/src/OctreeSceneStats.cpp b/libraries/octree/src/OctreeSceneStats.cpp index e7d34680a7..9b1a978447 100644 --- a/libraries/octree/src/OctreeSceneStats.cpp +++ b/libraries/octree/src/OctreeSceneStats.cpp @@ -657,40 +657,40 @@ void OctreeSceneStats::printDebugDetails() { qDebug(" moving: %s", debug::valueOf(_isMoving)); qDebug(); qDebug(" packets: %d", _packets); - qDebug(" bytes : %ld", _bytes); + qDebug(" bytes : %ld", (long int)_bytes); qDebug(); - qDebug(" total elements : %lu", _totalElements ); - qDebug(" internal : %lu", _totalInternal ); - qDebug(" leaves : %lu", _totalLeaves ); - qDebug(" traversed : %lu", _traversed ); - qDebug(" internal : %lu", _internal ); - qDebug(" leaves : %lu", _leaves ); - qDebug(" skipped distance : %lu", _skippedDistance ); - qDebug(" internal : %lu", _internalSkippedDistance ); - qDebug(" leaves : %lu", _leavesSkippedDistance ); - qDebug(" skipped out of view : %lu", _skippedOutOfView ); - qDebug(" internal : %lu", _internalSkippedOutOfView ); - qDebug(" leaves : %lu", _leavesSkippedOutOfView ); - qDebug(" skipped was in view : %lu", _skippedWasInView ); - qDebug(" internal : %lu", _internalSkippedWasInView ); - qDebug(" leaves : %lu", _leavesSkippedWasInView ); - qDebug(" skipped no change : %lu", _skippedNoChange ); - qDebug(" internal : %lu", _internalSkippedNoChange ); - qDebug(" leaves : %lu", _leavesSkippedNoChange ); - qDebug(" skipped occluded : %lu", _skippedOccluded ); - qDebug(" internal : %lu", _internalSkippedOccluded ); - qDebug(" leaves : %lu", _leavesSkippedOccluded ); + qDebug(" total elements : %lu", (long unsigned int)_totalElements ); + qDebug(" internal : %lu", (long unsigned int)_totalInternal ); + qDebug(" leaves : %lu", (long unsigned int)_totalLeaves ); + qDebug(" traversed : %lu", (long unsigned int)_traversed ); + qDebug(" internal : %lu", (long unsigned int)_internal ); + qDebug(" leaves : %lu", (long unsigned int)_leaves ); + qDebug(" skipped distance : %lu", (long unsigned int)_skippedDistance ); + qDebug(" internal : %lu", (long unsigned int)_internalSkippedDistance ); + qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedDistance ); + qDebug(" skipped out of view : %lu", (long unsigned int)_skippedOutOfView ); + qDebug(" internal : %lu", (long unsigned int)_internalSkippedOutOfView ); + qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedOutOfView ); + qDebug(" skipped was in view : %lu", (long unsigned int)_skippedWasInView ); + qDebug(" internal : %lu", (long unsigned int)_internalSkippedWasInView ); + qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedWasInView ); + qDebug(" skipped no change : %lu", (long unsigned int)_skippedNoChange ); + qDebug(" internal : %lu", (long unsigned int)_internalSkippedNoChange ); + qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedNoChange ); + qDebug(" skipped occluded : %lu", (long unsigned int)_skippedOccluded ); + qDebug(" internal : %lu", (long unsigned int)_internalSkippedOccluded ); + qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedOccluded ); qDebug(); - qDebug(" color sent : %lu", _colorSent ); - qDebug(" internal : %lu", _internalColorSent ); - qDebug(" leaves : %lu", _leavesColorSent ); - qDebug(" Didn't Fit : %lu", _didntFit ); - qDebug(" internal : %lu", _internalDidntFit ); - qDebug(" leaves : %lu", _leavesDidntFit ); - qDebug(" color bits : %lu", _colorBitsWritten ); - qDebug(" exists bits : %lu", _existsBitsWritten ); - qDebug(" in packet bit : %lu", _existsInPacketBitsWritten); - qDebug(" trees removed : %lu", _treesRemoved ); + qDebug(" color sent : %lu", (long unsigned int)_colorSent ); + qDebug(" internal : %lu", (long unsigned int)_internalColorSent ); + qDebug(" leaves : %lu", (long unsigned int)_leavesColorSent ); + qDebug(" Didn't Fit : %lu", (long unsigned int)_didntFit ); + qDebug(" internal : %lu", (long unsigned int)_internalDidntFit ); + qDebug(" leaves : %lu", (long unsigned int)_leavesDidntFit ); + qDebug(" color bits : %lu", (long unsigned int)_colorBitsWritten ); + qDebug(" exists bits : %lu", (long unsigned int)_existsBitsWritten ); + qDebug(" in packet bit : %lu", (long unsigned int)_existsInPacketBitsWritten); + qDebug(" trees removed : %lu", (long unsigned int)_treesRemoved ); } OctreeSceneStats::ItemInfo OctreeSceneStats::_ITEMS[] = { @@ -732,12 +732,14 @@ const char* OctreeSceneStats::getItemValue(Item item) { case ITEM_PACKETS: { float elapsedSecs = ((float)_elapsed / (float)USECS_PER_SECOND); calculatedKBPS = elapsedSecs == 0 ? 0 : ((_bytes * 8) / elapsedSecs) / 1000; - sprintf(_itemValueBuffer, "%d packets %lu bytes (%d kbps)", _packets, _bytes, calculatedKBPS); + sprintf(_itemValueBuffer, "%d packets %lu bytes (%d kbps)", _packets, (long unsigned int)_bytes, calculatedKBPS); break; } case ITEM_VOXELS_SERVER: { - sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", - _totalElements, _totalInternal, _totalLeaves); + sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", + (long unsigned int)_totalElements, + (long unsigned int)_totalInternal, + (long unsigned int)_totalLeaves); break; } case ITEM_VOXELS: { @@ -745,12 +747,14 @@ const char* OctreeSceneStats::getItemValue(Item item) { float calculatedBPV = total == 0 ? 0 : (_bytes * 8) / total; float averageBPV = _bitsPerOctreeAverage.getAverage(); sprintf(_itemValueBuffer, "%lu (%.2f bits/octree Average: %.2f bits/octree) %lu internal %lu leaves", - total, calculatedBPV, averageBPV, _existsInPacketBitsWritten, _colorSent); + total, calculatedBPV, averageBPV, + (long unsigned int)_existsInPacketBitsWritten, + (long unsigned int)_colorSent); break; } case ITEM_TRAVERSED: { sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", - _traversed, _internal, _leaves); + (long unsigned int)_traversed, (long unsigned int)_internal, (long unsigned int)_leaves); break; } case ITEM_SKIPPED: { @@ -769,42 +773,59 @@ const char* OctreeSceneStats::getItemValue(Item item) { } case ITEM_SKIPPED_DISTANCE: { sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", - _skippedDistance, _internalSkippedDistance, _leavesSkippedDistance); + (long unsigned int)_skippedDistance, + (long unsigned int)_internalSkippedDistance, + (long unsigned int)_leavesSkippedDistance); break; } case ITEM_SKIPPED_OUT_OF_VIEW: { sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", - _skippedOutOfView, _internalSkippedOutOfView, _leavesSkippedOutOfView); + (long unsigned int)_skippedOutOfView, + (long unsigned int)_internalSkippedOutOfView, + (long unsigned int)_leavesSkippedOutOfView); break; } case ITEM_SKIPPED_WAS_IN_VIEW: { sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", - _skippedWasInView, _internalSkippedWasInView, _leavesSkippedWasInView); + (long unsigned int)_skippedWasInView, + (long unsigned int)_internalSkippedWasInView, + (long unsigned int)_leavesSkippedWasInView); break; } case ITEM_SKIPPED_NO_CHANGE: { sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", - _skippedNoChange, _internalSkippedNoChange, _leavesSkippedNoChange); + (long unsigned int)_skippedNoChange, + (long unsigned int)_internalSkippedNoChange, + (long unsigned int)_leavesSkippedNoChange); break; } case ITEM_SKIPPED_OCCLUDED: { sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", - _skippedOccluded, _internalSkippedOccluded, _leavesSkippedOccluded); + (long unsigned int)_skippedOccluded, + (long unsigned int)_internalSkippedOccluded, + (long unsigned int)_leavesSkippedOccluded); break; } case ITEM_COLORS: { sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves", - _colorSent, _internalColorSent, _leavesColorSent); + (long unsigned int)_colorSent, + (long unsigned int)_internalColorSent, + (long unsigned int)_leavesColorSent); break; } case ITEM_DIDNT_FIT: { sprintf(_itemValueBuffer, "%lu total %lu internal %lu leaves (removed: %lu)", - _didntFit, _internalDidntFit, _leavesDidntFit, _treesRemoved); + (long unsigned int)_didntFit, + (long unsigned int)_internalDidntFit, + (long unsigned int)_leavesDidntFit, + (long unsigned int)_treesRemoved); break; } case ITEM_BITS: { sprintf(_itemValueBuffer, "colors: %lu, exists: %lu, in packets: %lu", - _colorBitsWritten, _existsBitsWritten, _existsInPacketBitsWritten); + (long unsigned int)_colorBitsWritten, + (long unsigned int)_existsBitsWritten, + (long unsigned int)_existsInPacketBitsWritten); break; } case ITEM_MODE: { diff --git a/libraries/octree/src/OctreeSceneStats.h b/libraries/octree/src/OctreeSceneStats.h index 140e33aedf..e451da0308 100644 --- a/libraries/octree/src/OctreeSceneStats.h +++ b/libraries/octree/src/OctreeSceneStats.h @@ -88,10 +88,10 @@ public: void childBitsRemoved(bool includesExistsBits, bool includesColors); /// Pack the details of the statistics into a buffer for sending as a network packet - int packIntoMessage(unsigned char* destinationBuffer, int availableBytes); + int packIntoMessage(quint8* destinationBuffer, int availableBytes); /// Unpack the details of the statistics from a buffer typically received as a network packet - int unpackFromMessage(const unsigned char* sourceBuffer, int availableBytes); + int unpackFromMessage(const quint8* sourceBuffer, int availableBytes); /// Indicates that a scene has been completed and the statistics are ready to be sent bool isReadyToSend() const { return _isReadyToSend; } @@ -99,8 +99,8 @@ public: /// Mark that the scene statistics have been sent void markAsSent() { _isReadyToSend = false; } - unsigned char* getStatsMessage() { return &_statsMessage[0]; } - int getStatsMessageLength() const { return _statsMessageLength; } + quint8* getStatsMessage() { return &_statsMessage[0]; } + qint32 getStatsMessageLength() const { return _statsMessageLength; } /// List of various items tracked by OctreeSceneStats which can be accessed via getItemInfo() and getItemValue() enum Item { @@ -140,36 +140,36 @@ public: const char* getItemValue(Item item); /// Returns OctCode for root element of the jurisdiction of this particular octree server - unsigned char* getJurisdictionRoot() const { return _jurisdictionRoot; } + quint8* getJurisdictionRoot() const { return _jurisdictionRoot; } /// Returns list of OctCodes for end elements of the jurisdiction of this particular octree server - const std::vector& getJurisdictionEndNodes() const { return _jurisdictionEndNodes; } + const std::vector& getJurisdictionEndNodes() const { return _jurisdictionEndNodes; } bool isMoving() const { return _isMoving; }; - unsigned long getTotalElements() const { return _totalElements; } - unsigned long getTotalInternal() const { return _totalInternal; } - unsigned long getTotalLeaves() const { return _totalLeaves; } - unsigned long getTotalEncodeTime() const { return _totalEncodeTime; } - unsigned long getElapsedTime() const { return _elapsed; } + quint64 getTotalElements() const { return _totalElements; } + quint64 getTotalInternal() const { return _totalInternal; } + quint64 getTotalLeaves() const { return _totalLeaves; } + quint64 getTotalEncodeTime() const { return _totalEncodeTime; } + quint64 getElapsedTime() const { return _elapsed; } - unsigned long getLastFullElapsedTime() const { return _lastFullElapsed; } - unsigned long getLastFullTotalEncodeTime() const { return _lastFullTotalEncodeTime; } - unsigned int getLastFullTotalPackets() const { return _lastFullTotalPackets; } - unsigned long getLastFullTotalBytes() const { return _lastFullTotalBytes; } + quint64 getLastFullElapsedTime() const { return _lastFullElapsed; } + quint64 getLastFullTotalEncodeTime() const { return _lastFullTotalEncodeTime; } + quint32 getLastFullTotalPackets() const { return _lastFullTotalPackets; } + quint64 getLastFullTotalBytes() const { return _lastFullTotalBytes; } // Used in client implementations to track individual octree packets void trackIncomingOctreePacket(const QByteArray& packet, bool wasStatsPacket, int nodeClockSkewUsec); - unsigned int getIncomingPackets() const { return _incomingPacket; } - unsigned long getIncomingBytes() const { return _incomingBytes; } - unsigned long getIncomingWastedBytes() const { return _incomingWastedBytes; } - unsigned int getIncomingOutOfOrder() const { return _incomingLate + _incomingEarly; } - unsigned int getIncomingLikelyLost() const { return _incomingLikelyLost; } - unsigned int getIncomingRecovered() const { return _incomingRecovered; } - unsigned int getIncomingEarly() const { return _incomingEarly; } - unsigned int getIncomingLate() const { return _incomingLate; } - unsigned int getIncomingReallyLate() const { return _incomingReallyLate; } - unsigned int getIncomingPossibleDuplicate() const { return _incomingPossibleDuplicate; } + quint32 getIncomingPackets() const { return _incomingPacket; } + quint64 getIncomingBytes() const { return _incomingBytes; } + quint64 getIncomingWastedBytes() const { return _incomingWastedBytes; } + quint32 getIncomingOutOfOrder() const { return _incomingLate + _incomingEarly; } + quint32 getIncomingLikelyLost() const { return _incomingLikelyLost; } + quint32 getIncomingRecovered() const { return _incomingRecovered; } + quint32 getIncomingEarly() const { return _incomingEarly; } + quint32 getIncomingLate() const { return _incomingLate; } + quint32 getIncomingReallyLate() const { return _incomingReallyLate; } + quint32 getIncomingPossibleDuplicate() const { return _incomingPossibleDuplicate; } float getIncomingFlightTimeAverage() { return _incomingFlightTimeAverage.getAverage(); } private: @@ -177,8 +177,9 @@ private: void copyFromOther(const OctreeSceneStats& other); bool _isReadyToSend; - unsigned char _statsMessage[MAX_PACKET_SIZE]; - int _statsMessageLength; + quint8 _statsMessage[MAX_PACKET_SIZE]; + + qint32 _statsMessageLength; // scene timing data in usecs bool _isStarted; @@ -188,8 +189,8 @@ private: quint64 _lastFullElapsed; quint64 _lastFullTotalEncodeTime; - unsigned int _lastFullTotalPackets; - unsigned long _lastFullTotalBytes; + quint32 _lastFullTotalPackets; + quint64 _lastFullTotalBytes; SimpleMovingAverage _elapsedAverage; SimpleMovingAverage _bitsPerOctreeAverage; @@ -198,46 +199,46 @@ private: quint64 _encodeStart; // scene octree related data - unsigned long _totalElements; - unsigned long _totalInternal; - unsigned long _totalLeaves; + quint64 _totalElements; + quint64 _totalInternal; + quint64 _totalLeaves; - unsigned long _traversed; - unsigned long _internal; - unsigned long _leaves; + quint64 _traversed; + quint64 _internal; + quint64 _leaves; - unsigned long _skippedDistance; - unsigned long _internalSkippedDistance; - unsigned long _leavesSkippedDistance; + quint64 _skippedDistance; + quint64 _internalSkippedDistance; + quint64 _leavesSkippedDistance; - unsigned long _skippedOutOfView; - unsigned long _internalSkippedOutOfView; - unsigned long _leavesSkippedOutOfView; + quint64 _skippedOutOfView; + quint64 _internalSkippedOutOfView; + quint64 _leavesSkippedOutOfView; - unsigned long _skippedWasInView; - unsigned long _internalSkippedWasInView; - unsigned long _leavesSkippedWasInView; + quint64 _skippedWasInView; + quint64 _internalSkippedWasInView; + quint64 _leavesSkippedWasInView; - unsigned long _skippedNoChange; - unsigned long _internalSkippedNoChange; - unsigned long _leavesSkippedNoChange; + quint64 _skippedNoChange; + quint64 _internalSkippedNoChange; + quint64 _leavesSkippedNoChange; - unsigned long _skippedOccluded; - unsigned long _internalSkippedOccluded; - unsigned long _leavesSkippedOccluded; + quint64 _skippedOccluded; + quint64 _internalSkippedOccluded; + quint64 _leavesSkippedOccluded; - unsigned long _colorSent; - unsigned long _internalColorSent; - unsigned long _leavesColorSent; + quint64 _colorSent; + quint64 _internalColorSent; + quint64 _leavesColorSent; - unsigned long _didntFit; - unsigned long _internalDidntFit; - unsigned long _leavesDidntFit; + quint64 _didntFit; + quint64 _internalDidntFit; + quint64 _leavesDidntFit; - unsigned long _colorBitsWritten; - unsigned long _existsBitsWritten; - unsigned long _existsInPacketBitsWritten; - unsigned long _treesRemoved; + quint64 _colorBitsWritten; + quint64 _existsBitsWritten; + quint64 _existsInPacketBitsWritten; + quint64 _treesRemoved; // Accounting Notes: // @@ -255,22 +256,22 @@ private: // // scene network related data - unsigned int _packets; - unsigned long _bytes; - unsigned int _passes; + quint32 _packets; + quint64 _bytes; + quint32 _passes; // incoming packets stats - unsigned int _incomingPacket; - unsigned long _incomingBytes; - unsigned long _incomingWastedBytes; + quint32 _incomingPacket; + quint64 _incomingBytes; + quint64 _incomingWastedBytes; - uint16_t _incomingLastSequence; /// last incoming sequence number - unsigned int _incomingLikelyLost; /// count of packets likely lost, may be off by _incomingReallyLate count - unsigned int _incomingRecovered; /// packets that were late, and we had in our missing list, we consider recovered - unsigned int _incomingEarly; /// out of order earlier than expected - unsigned int _incomingLate; /// out of order later than expected - unsigned int _incomingReallyLate; /// out of order and later than MAX_MISSING_SEQUENCE_OLD_AGE late - unsigned int _incomingPossibleDuplicate; /// out of order possibly a duplicate + quint16 _incomingLastSequence; /// last incoming sequence number + quint32 _incomingLikelyLost; /// count of packets likely lost, may be off by _incomingReallyLate count + quint32 _incomingRecovered; /// packets that were late, and we had in our missing list, we consider recovered + quint32 _incomingEarly; /// out of order earlier than expected + quint32 _incomingLate; /// out of order later than expected + quint32 _incomingReallyLate; /// out of order and later than MAX_MISSING_SEQUENCE_OLD_AGE late + quint32 _incomingPossibleDuplicate; /// out of order possibly a duplicate QSet _missingSequenceNumbers; SimpleMovingAverage _incomingFlightTimeAverage; @@ -280,11 +281,11 @@ private: static ItemInfo _ITEMS[]; - static int const MAX_ITEM_VALUE_LENGTH = 128; + static const int MAX_ITEM_VALUE_LENGTH = 128; char _itemValueBuffer[MAX_ITEM_VALUE_LENGTH]; - unsigned char* _jurisdictionRoot; - std::vector _jurisdictionEndNodes; + quint8* _jurisdictionRoot; + std::vector _jurisdictionEndNodes; }; /// Map between element IDs and their reported OctreeSceneStats. Typically used by classes that need to know which elements sent From 6595b29a4ffde5e8d75215913d7185a0b7029e8e Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 29 Apr 2014 10:55:30 -0700 Subject: [PATCH 2/4] More bug tracking --- libraries/shared/src/SharedUtil.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index c65b7505ee..5cfd8961ec 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -615,7 +615,7 @@ int unpackClipValueFromTwoByte(const unsigned char* buffer, float& clipValue) { } int packFloatToByte(unsigned char* buffer, float value, float scaleBy) { - unsigned char holder; + quint8 holder; const float CONVERSION_RATIO = (255 / scaleBy); holder = floorf(value * CONVERSION_RATIO); memcpy(buffer, &holder, sizeof(holder)); @@ -623,7 +623,7 @@ int packFloatToByte(unsigned char* buffer, float value, float scaleBy) { } int unpackFloatFromByte(const unsigned char* buffer, float& value, float scaleBy) { - unsigned char holder; + quint8 holder; memcpy(&holder, buffer, sizeof(holder)); value = ((float)holder / (float) 255) * scaleBy; return sizeof(holder); From f74bd491d6197f576798ac843c0cd8e1eff6f4e7 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 29 Apr 2014 12:48:50 -0700 Subject: [PATCH 3/4] CR --- libraries/octree/src/OctreeSceneStats.cpp | 114 +++++++++++----------- libraries/octree/src/OctreeSceneStats.h | 18 ++-- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/libraries/octree/src/OctreeSceneStats.cpp b/libraries/octree/src/OctreeSceneStats.cpp index 9b1a978447..1dc1459771 100644 --- a/libraries/octree/src/OctreeSceneStats.cpp +++ b/libraries/octree/src/OctreeSceneStats.cpp @@ -646,70 +646,70 @@ int OctreeSceneStats::unpackFromMessage(const unsigned char* sourceBuffer, int a void OctreeSceneStats::printDebugDetails() { - qDebug("\n------------------------------"); - qDebug("OctreeSceneStats:"); - qDebug(" start : %llu", (long long unsigned int)_start); - qDebug(" end : %llu", (long long unsigned int)_end); - qDebug(" elapsed : %llu", (long long unsigned int)_elapsed); - qDebug(" encoding : %llu", (long long unsigned int)_totalEncodeTime); + qDebug() << "\n------------------------------"; + qDebug() << "OctreeSceneStats:"; + qDebug() << "start: " << _start; + qDebug() << "end: " << _end; + qDebug() << "elapsed: " << _elapsed; + qDebug() << "encoding: " << _totalEncodeTime; qDebug(); - qDebug(" full scene: %s", debug::valueOf(_isFullScene)); - qDebug(" moving: %s", debug::valueOf(_isMoving)); + qDebug() << "full scene: " << debug::valueOf(_isFullScene); + qDebug() << "moving: " << debug::valueOf(_isMoving); qDebug(); - qDebug(" packets: %d", _packets); - qDebug(" bytes : %ld", (long int)_bytes); + qDebug() << "packets: " << _packets; + qDebug() << "bytes: " << _bytes; qDebug(); - qDebug(" total elements : %lu", (long unsigned int)_totalElements ); - qDebug(" internal : %lu", (long unsigned int)_totalInternal ); - qDebug(" leaves : %lu", (long unsigned int)_totalLeaves ); - qDebug(" traversed : %lu", (long unsigned int)_traversed ); - qDebug(" internal : %lu", (long unsigned int)_internal ); - qDebug(" leaves : %lu", (long unsigned int)_leaves ); - qDebug(" skipped distance : %lu", (long unsigned int)_skippedDistance ); - qDebug(" internal : %lu", (long unsigned int)_internalSkippedDistance ); - qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedDistance ); - qDebug(" skipped out of view : %lu", (long unsigned int)_skippedOutOfView ); - qDebug(" internal : %lu", (long unsigned int)_internalSkippedOutOfView ); - qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedOutOfView ); - qDebug(" skipped was in view : %lu", (long unsigned int)_skippedWasInView ); - qDebug(" internal : %lu", (long unsigned int)_internalSkippedWasInView ); - qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedWasInView ); - qDebug(" skipped no change : %lu", (long unsigned int)_skippedNoChange ); - qDebug(" internal : %lu", (long unsigned int)_internalSkippedNoChange ); - qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedNoChange ); - qDebug(" skipped occluded : %lu", (long unsigned int)_skippedOccluded ); - qDebug(" internal : %lu", (long unsigned int)_internalSkippedOccluded ); - qDebug(" leaves : %lu", (long unsigned int)_leavesSkippedOccluded ); + qDebug() << "total elements: " << _totalElements; + qDebug() << "internal: " << _totalInternal; + qDebug() << "leaves: " << _totalLeaves; + qDebug() << "traversed: " << _traversed; + qDebug() << "internal: " << _internal; + qDebug() << "leaves: " << _leaves; + qDebug() << "skipped distance: " << _skippedDistance; + qDebug() << "internal: " << _internalSkippedDistance; + qDebug() << "leaves: " << _leavesSkippedDistance; + qDebug() << "skipped out of view: " << _skippedOutOfView; + qDebug() << "internal: " << _internalSkippedOutOfView; + qDebug() << "leaves: " << _leavesSkippedOutOfView; + qDebug() << "skipped was in view: " << _skippedWasInView; + qDebug() << "internal: " << _internalSkippedWasInView; + qDebug() << "leaves: " << _leavesSkippedWasInView; + qDebug() << "skipped no change: " << _skippedNoChange; + qDebug() << "internal: " << _internalSkippedNoChange; + qDebug() << "leaves: " << _leavesSkippedNoChange; + qDebug() << "skipped occluded: " << _skippedOccluded; + qDebug() << "internal: " << _internalSkippedOccluded; + qDebug() << "leaves: " << _leavesSkippedOccluded; qDebug(); - qDebug(" color sent : %lu", (long unsigned int)_colorSent ); - qDebug(" internal : %lu", (long unsigned int)_internalColorSent ); - qDebug(" leaves : %lu", (long unsigned int)_leavesColorSent ); - qDebug(" Didn't Fit : %lu", (long unsigned int)_didntFit ); - qDebug(" internal : %lu", (long unsigned int)_internalDidntFit ); - qDebug(" leaves : %lu", (long unsigned int)_leavesDidntFit ); - qDebug(" color bits : %lu", (long unsigned int)_colorBitsWritten ); - qDebug(" exists bits : %lu", (long unsigned int)_existsBitsWritten ); - qDebug(" in packet bit : %lu", (long unsigned int)_existsInPacketBitsWritten); - qDebug(" trees removed : %lu", (long unsigned int)_treesRemoved ); + qDebug() << "color sent: " << _colorSent; + qDebug() << "internal: " << _internalColorSent; + qDebug() << "leaves: " << _leavesColorSent; + qDebug() << "Didn't Fit: " << _didntFit; + qDebug() << "internal: " << _internalDidntFit; + qDebug() << "leaves: " << _leavesDidntFit; + qDebug() << "color bits: " << _colorBitsWritten; + qDebug() << "exists bits: " << _existsBitsWritten; + qDebug() << "in packet bit: " << _existsInPacketBitsWritten; + qDebug() << "trees removed: " << _treesRemoved; } OctreeSceneStats::ItemInfo OctreeSceneStats::_ITEMS[] = { - { "Elapsed" , GREENISH , 2 , "Elapsed,fps" }, - { "Encode" , YELLOWISH , 2 , "Time,fps" }, - { "Network" , GREYISH , 3 , "Packets,Bytes,KBPS" }, - { "Octrees on Server" , GREENISH , 3 , "Total,Internal,Leaves" }, - { "Octrees Sent" , YELLOWISH , 5 , "Total,Bits/Octree,Avg Bits/Octree,Internal,Leaves" }, - { "Colors Sent" , GREYISH , 3 , "Total,Internal,Leaves" }, - { "Bitmasks Sent" , GREENISH , 3 , "Colors,Exists,In Packets" }, - { "Traversed" , YELLOWISH , 3 , "Total,Internal,Leaves" }, - { "Skipped - Total" , GREYISH , 3 , "Total,Internal,Leaves" }, - { "Skipped - Distance" , GREENISH , 3 , "Total,Internal,Leaves" }, - { "Skipped - Out of View", YELLOWISH , 3 , "Total,Internal,Leaves" }, - { "Skipped - Was in View", GREYISH , 3 , "Total,Internal,Leaves" }, - { "Skipped - No Change" , GREENISH , 3 , "Total,Internal,Leaves" }, - { "Skipped - Occluded" , YELLOWISH , 3 , "Total,Internal,Leaves" }, - { "Didn't fit in packet" , GREYISH , 4 , "Total,Internal,Leaves,Removed" }, - { "Mode" , GREENISH , 4 , "Moving,Stationary,Partial,Full" }, + { "Elapsed", GREENISH, 2, "Elapsed,fps" }, + { "Encode", YELLOWISH, 2, "Time,fps" }, + { "Network", GREYISH, 3, "Packets,Bytes,KBPS" }, + { "Octrees on Server", GREENISH, 3, "Total,Internal,Leaves" }, + { "Octrees Sent", YELLOWISH, 5, "Total,Bits/Octree,Avg Bits/Octree,Internal,Leaves" }, + { "Colors Sent", GREYISH, 3, "Total,Internal,Leaves" }, + { "Bitmasks Sent", GREENISH, 3, "Colors,Exists,In Packets" }, + { "Traversed", YELLOWISH, 3, "Total,Internal,Leaves" }, + { "Skipped - Total", GREYISH, 3, "Total,Internal,Leaves" }, + { "Skipped - Distance", GREENISH, 3, "Total,Internal,Leaves" }, + { "Skipped - Out of View", YELLOWISH, 3, "Total,Internal,Leaves" }, + { "Skipped - Was in View", GREYISH, 3, "Total,Internal,Leaves" }, + { "Skipped - No Change", GREENISH, 3, "Total,Internal,Leaves" }, + { "Skipped - Occluded", YELLOWISH, 3, "Total,Internal,Leaves" }, + { "Didn't fit in packet", GREYISH, 4, "Total,Internal,Leaves,Removed" }, + { "Mode", GREENISH, 4, "Moving,Stationary,Partial,Full" }, }; const char* OctreeSceneStats::getItemValue(Item item) { diff --git a/libraries/octree/src/OctreeSceneStats.h b/libraries/octree/src/OctreeSceneStats.h index e451da0308..ef22fd7c1c 100644 --- a/libraries/octree/src/OctreeSceneStats.h +++ b/libraries/octree/src/OctreeSceneStats.h @@ -88,10 +88,10 @@ public: void childBitsRemoved(bool includesExistsBits, bool includesColors); /// Pack the details of the statistics into a buffer for sending as a network packet - int packIntoMessage(quint8* destinationBuffer, int availableBytes); + int packIntoMessage(unsigned char* destinationBuffer, int availableBytes); /// Unpack the details of the statistics from a buffer typically received as a network packet - int unpackFromMessage(const quint8* sourceBuffer, int availableBytes); + int unpackFromMessage(const unsigned char* sourceBuffer, int availableBytes); /// Indicates that a scene has been completed and the statistics are ready to be sent bool isReadyToSend() const { return _isReadyToSend; } @@ -99,8 +99,8 @@ public: /// Mark that the scene statistics have been sent void markAsSent() { _isReadyToSend = false; } - quint8* getStatsMessage() { return &_statsMessage[0]; } - qint32 getStatsMessageLength() const { return _statsMessageLength; } + unsigned char* getStatsMessage() { return &_statsMessage[0]; } + int getStatsMessageLength() const { return _statsMessageLength; } /// List of various items tracked by OctreeSceneStats which can be accessed via getItemInfo() and getItemValue() enum Item { @@ -140,10 +140,10 @@ public: const char* getItemValue(Item item); /// Returns OctCode for root element of the jurisdiction of this particular octree server - quint8* getJurisdictionRoot() const { return _jurisdictionRoot; } + unsigned char* getJurisdictionRoot() const { return _jurisdictionRoot; } /// Returns list of OctCodes for end elements of the jurisdiction of this particular octree server - const std::vector& getJurisdictionEndNodes() const { return _jurisdictionEndNodes; } + const std::vector& getJurisdictionEndNodes() const { return _jurisdictionEndNodes; } bool isMoving() const { return _isMoving; }; quint64 getTotalElements() const { return _totalElements; } @@ -177,7 +177,7 @@ private: void copyFromOther(const OctreeSceneStats& other); bool _isReadyToSend; - quint8 _statsMessage[MAX_PACKET_SIZE]; + unsigned char _statsMessage[MAX_PACKET_SIZE]; qint32 _statsMessageLength; @@ -284,8 +284,8 @@ private: static const int MAX_ITEM_VALUE_LENGTH = 128; char _itemValueBuffer[MAX_ITEM_VALUE_LENGTH]; - quint8* _jurisdictionRoot; - std::vector _jurisdictionEndNodes; + unsigned char* _jurisdictionRoot; + std::vector _jurisdictionEndNodes; }; /// Map between element IDs and their reported OctreeSceneStats. Typically used by classes that need to know which elements sent From 49eadac02473b2f7ed413b54df89b1d5d9bcbde2 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 29 Apr 2014 13:52:07 -0700 Subject: [PATCH 4/4] Bumped octree stats packet version --- libraries/networking/src/PacketHeaders.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/networking/src/PacketHeaders.cpp b/libraries/networking/src/PacketHeaders.cpp index 29238220e1..0955759097 100644 --- a/libraries/networking/src/PacketHeaders.cpp +++ b/libraries/networking/src/PacketHeaders.cpp @@ -62,6 +62,8 @@ PacketVersion versionForPacketType(PacketType type) { case PacketTypeVoxelSet: case PacketTypeVoxelSetDestructive: return 1; + case PacketTypeOctreeStats: + return 1; default: return 0; }