diff --git a/interface/src/ui/VoxelStatsDialog.cpp b/interface/src/ui/VoxelStatsDialog.cpp index 455ea0cfb0..d365990dcf 100644 --- a/interface/src/ui/VoxelStatsDialog.cpp +++ b/interface/src/ui/VoxelStatsDialog.cpp @@ -41,6 +41,7 @@ VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, VoxelSceneStats* model) : rgb = ((rgb & 0xfefefeu) >> 1) + ((rgb & 0xf8f8f8) >> 3); palette.setColor(QPalette::WindowText, QColor::fromRgb(rgb)); label->setPalette(palette); + label->setText(" "); snprintf(strBuf, sizeof(strBuf), " %s:", itemInfo.caption); form->addRow(strBuf, label); @@ -50,7 +51,7 @@ VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, VoxelSceneStats* model) : void VoxelStatsDialog::paintEvent(QPaintEvent* event) { // Update labels - char strBuf[64]; + char strBuf[256]; for (int i = 0; i < VoxelSceneStats::ITEM_COUNT; ++i) { QLabel* label = _labels[i]; snprintf(strBuf, sizeof(strBuf), "%s", _model->getItemValue(i)); diff --git a/libraries/voxels/src/VoxelSceneStats.cpp b/libraries/voxels/src/VoxelSceneStats.cpp index 02ee47c6c1..3251c607f1 100644 --- a/libraries/voxels/src/VoxelSceneStats.cpp +++ b/libraries/voxels/src/VoxelSceneStats.cpp @@ -354,7 +354,7 @@ void VoxelSceneStats::printDebugDetails() { qDebug(" moving: %s\n", debug::valueOf(_moving)); qDebug("\n"); qDebug(" packets: %d\n", _packets); - qDebug(" bytes : %d\n", _bytes); + qDebug(" bytes : %ld\n", _bytes); qDebug("\n"); qDebug(" traversed : %lu\n", _traversed ); qDebug(" internal : %lu\n", _internal ); @@ -390,22 +390,30 @@ void VoxelSceneStats::printDebugDetails() { VoxelSceneStats::ItemInfo VoxelSceneStats::_ITEMS[] = { - { "Elapsed" , "usecs", 0x40ff40d0 }, - { "Encode" , "usecs", 0xffef40c0 }, - { "Packets" , "" , 0xd0d0d0a0 } + { "Elapsed" , 0x40ff40d0 }, + { "Encode" , 0xffef40c0 }, + { "Network" , 0xd0d0d0a0 } }; char* VoxelSceneStats::getItemValue(int item) { + const uint64_t USECS_PER_SECOND = 1000 * 1000; + int calcFPS; + int calculatedKBPS; switch(item) { case ITEM_ELAPSED: - sprintf(_itemValueBuffer, "%llu", _elapsed); + calcFPS = (float)USECS_PER_SECOND / (float)_elapsed; + sprintf(_itemValueBuffer, "%llu usecs (%d fps)", _elapsed, calcFPS); break; case ITEM_ENCODE: - sprintf(_itemValueBuffer, "%llu", _totalEncodeTime); + calcFPS = (float)USECS_PER_SECOND / (float)_totalEncodeTime; + sprintf(_itemValueBuffer, "%llu usecs (%d fps)", _totalEncodeTime, calcFPS); break; - case ITEM_PACKETS: - sprintf(_itemValueBuffer, "%d", _packets); + 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); break; + } default: sprintf(_itemValueBuffer, ""); break; diff --git a/libraries/voxels/src/VoxelSceneStats.h b/libraries/voxels/src/VoxelSceneStats.h index 99880c591d..d58d21d0e0 100644 --- a/libraries/voxels/src/VoxelSceneStats.h +++ b/libraries/voxels/src/VoxelSceneStats.h @@ -59,7 +59,6 @@ public: // Meta information about each stats item struct ItemInfo { char const* const caption; - char const* unitCaption; unsigned colorRGBA; }; @@ -134,7 +133,7 @@ private: // scene network related data unsigned int _packets; - unsigned int _bytes; + unsigned long _bytes; unsigned int _passes; // features related items @@ -143,7 +142,7 @@ private: static ItemInfo _ITEMS[]; - static int const MAX_ITEM_VALUE_LENGTH = 40; + static int const MAX_ITEM_VALUE_LENGTH = 128; char _itemValueBuffer[MAX_ITEM_VALUE_LENGTH]; };