added bytes per edit stats

This commit is contained in:
ZappoMan 2015-07-02 13:44:28 -07:00
parent 63b585da0f
commit 5c4d4893de
4 changed files with 22 additions and 14 deletions

View file

@ -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());

View file

@ -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;
}

View file

@ -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;

View file

@ -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;