diff --git a/interface/src/ui/OctreeStatsDialog.cpp b/interface/src/ui/OctreeStatsDialog.cpp index 9426f2b2e0..c8784f69b8 100644 --- a/interface/src/ui/OctreeStatsDialog.cpp +++ b/interface/src/ui/OctreeStatsDialog.cpp @@ -209,9 +209,9 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) { // Entity Edits update time label = _labels[_entityUpdateTime]; - auto entites = Application::getInstance()->getEntities()->getTree(); - auto averageEditDelta = entites->getAverageEditDeltas(); - auto maxEditDelta = entites->getMaxEditDelta(); + auto entities = Application::getInstance()->getEntities()->getTree(); + auto averageEditDelta = entities->getAverageEditDeltas(); + auto maxEditDelta = entities->getMaxEditDelta(); QString averageEditDeltaString = locale.toString((uint)averageEditDelta); QString maxEditDeltaString = locale.toString((uint)maxEditDelta); @@ -225,7 +225,8 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) { // Entity Edits label = _labels[_entityUpdates]; - auto totalTrackedEdits = entites->getTotalTrackedEdits(); + auto totalTrackedEdits = entities->getTotalTrackedEdits(); + auto bytesPerEdit = entities->getAverageEditBytes(); // track our updated per second const quint64 SAMPLING_WINDOW = USECS_PER_SECOND / SAMPLES_PER_SECOND; @@ -247,11 +248,13 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) { QString totalTrackedEditsString = locale.toString((uint)totalTrackedEdits); QString updatesPerSecondString = locale.toString(updatesPerSecond); + QString bytesPerEditString = locale.toString(bytesPerEdit); statsValue.str(""); statsValue << "" << qPrintable(updatesPerSecondString) << " updates per second / " << - "" << qPrintable(totalTrackedEditsString) << " total updates "; + "" << qPrintable(totalTrackedEditsString) << " total updates / " << + "Average Size: " << qPrintable(bytesPerEditString) << " bytes "; label->setText(statsValue.str().c_str()); diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index e24f6846fd..0f681ba5f7 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -415,13 +415,6 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef bytesRead += sizeof(lastEditedFromBuffer); lastEditedFromBufferAdjusted = lastEditedFromBuffer - clockSkew; - // Tracking for editing roundtrips here. We will tell our EntityTree that we just got incoming data about - // and entity that was edited at some time in the past. The tree will determine how it wants to track this - // information. - if (_element && _element->getTree()) { - _element->getTree()->trackIncomingEntityLastEdited(lastEditedFromBufferAdjusted); - } - if (lastEditedFromBufferAdjusted > now) { lastEditedFromBufferAdjusted = now; } @@ -646,6 +639,14 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef } } + // Tracking for editing roundtrips here. We will tell our EntityTree that we just got incoming data about + // and entity that was edited at some time in the past. The tree will determine how it wants to track this + // information. + if (_element && _element->getTree()) { + _element->getTree()->trackIncomingEntityLastEdited(lastEditedFromBufferAdjusted, bytesRead); + } + + return bytesRead; } diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 0fbe6d40ed..ae4d8ab236 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -1117,7 +1117,7 @@ void EntityTree::resetClientEditStats() { -void EntityTree::trackIncomingEntityLastEdited(quint64 lastEditedTime) { +void EntityTree::trackIncomingEntityLastEdited(quint64 lastEditedTime, int bytesRead) { // we don't want to track all edit deltas, just those edits that have happend // since we connected to this domain. This will filter out all previously created // content and only track new edits @@ -1126,6 +1126,7 @@ void EntityTree::trackIncomingEntityLastEdited(quint64 lastEditedTime) { quint64 sinceEdit = now - lastEditedTime; _totalEditDeltas += sinceEdit; + _totalEditBytes += bytesRead; _totalTrackedEdits++; if (sinceEdit > _maxEditDelta) { _maxEditDelta = sinceEdit; diff --git a/libraries/entities/src/EntityTree.h b/libraries/entities/src/EntityTree.h index 92c726729d..263cff2171 100644 --- a/libraries/entities/src/EntityTree.h +++ b/libraries/entities/src/EntityTree.h @@ -185,9 +185,11 @@ public: virtual quint64 getAverageCreateTime() const { return _totalCreates == 0 ? 0 : _totalCreateTime / _totalCreates; } virtual quint64 getAverageLoggingTime() const { return _totalEditMessages == 0 ? 0 : _totalLoggingTime / _totalEditMessages; } - void trackIncomingEntityLastEdited(quint64 lastEditedTime); + void trackIncomingEntityLastEdited(quint64 lastEditedTime, int bytesRead); quint64 getAverageEditDeltas() const { return _totalTrackedEdits == 0 ? 0 : _totalEditDeltas / _totalTrackedEdits; } + quint64 getAverageEditBytes() const + { return _totalTrackedEdits == 0 ? 0 : _totalEditBytes / _totalTrackedEdits; } quint64 getMaxEditDelta() const { return _maxEditDelta; } quint64 getTotalTrackedEdits() const { return _totalTrackedEdits; } @@ -240,6 +242,7 @@ private: // these performance statistics are only used in the client void resetClientEditStats(); int _totalTrackedEdits = 0; + quint64 _totalEditBytes = 0; quint64 _totalEditDeltas = 0; quint64 _maxEditDelta = 0; quint64 _treeResetTime = 0;