mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
change display style of bandwidth detail dialog, include a totals line
This commit is contained in:
parent
dd9d054286
commit
620efb2bbe
13 changed files with 94 additions and 55 deletions
|
@ -241,8 +241,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_mousePressed(false),
|
||||
_enableProcessOctreeThread(true),
|
||||
_octreeProcessor(),
|
||||
_packetsPerSecond(0),
|
||||
_bytesPerSecond(0),
|
||||
_inPacketsPerSecond(0),
|
||||
_outPacketsPerSecond(0),
|
||||
_inBytesPerSecond(0),
|
||||
_outBytesPerSecond(0),
|
||||
_nodeBoundsDisplay(this),
|
||||
_previousScriptLocation(),
|
||||
_applicationOverlay(),
|
||||
|
@ -779,9 +781,11 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet, const Nod
|
|||
case NodeType::Agent:
|
||||
case NodeType::AvatarMixer:
|
||||
_bandwidthRecorder.avatarsChannel->output.updateValue(bandwidth_amount);
|
||||
_bandwidthRecorder.totalChannel->input.updateValue(bandwidth_amount);
|
||||
break;
|
||||
case NodeType::EntityServer:
|
||||
_bandwidthRecorder.octreeChannel->output.updateValue(bandwidth_amount);
|
||||
_bandwidthRecorder.totalChannel->output.updateValue(bandwidth_amount);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
|
@ -1387,8 +1391,10 @@ void Application::timer() {
|
|||
|
||||
_fps = (float)_frameCount / diffTime;
|
||||
|
||||
_packetsPerSecond = (float) _datagramProcessor.getPacketCount() / diffTime;
|
||||
_bytesPerSecond = (float) _datagramProcessor.getByteCount() / diffTime;
|
||||
_inPacketsPerSecond = (float) _datagramProcessor.getInPacketCount() / diffTime;
|
||||
_outPacketsPerSecond = (float) _datagramProcessor.getOutPacketCount() / diffTime;
|
||||
_inBytesPerSecond = (float) _datagramProcessor.getInByteCount() / diffTime;
|
||||
_outBytesPerSecond = (float) _datagramProcessor.getOutByteCount() / diffTime;
|
||||
_frameCount = 0;
|
||||
|
||||
_datagramProcessor.resetCounters();
|
||||
|
@ -2380,6 +2386,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
|
|||
|
||||
// Feed number of bytes to corresponding channel of the bandwidth meter
|
||||
_bandwidthRecorder.octreeChannel->output.updateValue(packetLength);
|
||||
_bandwidthRecorder.totalChannel->output.updateValue(packetLength);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -3368,6 +3375,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin
|
|||
|
||||
void Application::packetSent(quint64 length) {
|
||||
_bandwidthRecorder.octreeChannel->output.updateValue(length);
|
||||
_bandwidthRecorder.totalChannel->output.updateValue(length);
|
||||
}
|
||||
|
||||
const QString SETTINGS_KEY = "Settings";
|
||||
|
|
|
@ -209,8 +209,10 @@ public:
|
|||
Overlays& getOverlays() { return _overlays; }
|
||||
|
||||
float getFps() const { return _fps; }
|
||||
float getPacketsPerSecond() const { return _packetsPerSecond; }
|
||||
float getBytesPerSecond() const { return _bytesPerSecond; }
|
||||
float getInPacketsPerSecond() const { return _inPacketsPerSecond; }
|
||||
float getOutPacketsPerSecond() const { return _outPacketsPerSecond; }
|
||||
float getInBytesPerSecond() const { return _inBytesPerSecond; }
|
||||
float getOutBytesPerSecond() const { return _outBytesPerSecond; }
|
||||
const glm::vec3& getViewMatrixTranslation() const { return _viewMatrixTranslation; }
|
||||
void setViewMatrixTranslation(const glm::vec3& translation) { _viewMatrixTranslation = translation; }
|
||||
|
||||
|
@ -534,8 +536,10 @@ private:
|
|||
OctreePacketProcessor _octreeProcessor;
|
||||
EntityEditPacketSender _entityEditSender;
|
||||
|
||||
int _packetsPerSecond;
|
||||
int _bytesPerSecond;
|
||||
int _inPacketsPerSecond;
|
||||
int _outPacketsPerSecond;
|
||||
int _inBytesPerSecond;
|
||||
int _outBytesPerSecond;
|
||||
|
||||
StDev _idleLoopStdev;
|
||||
float _idleLoopMeasuredJitter;
|
||||
|
|
|
@ -769,9 +769,8 @@ void Audio::handleAudioInput() {
|
|||
nodeList->writeDatagram(audioDataPacket, packetBytes, audioMixer);
|
||||
_outgoingAvatarAudioSequenceNumber++;
|
||||
|
||||
// Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::AUDIO).updateValue(packetBytes);
|
||||
Application::getInstance()->
|
||||
getBandwidthRecorder()->audioChannel->output.updateValue(packetBytes);
|
||||
Application::getInstance()->getBandwidthRecorder()->audioChannel->output.updateValue(packetBytes);
|
||||
Application::getInstance()->getBandwidthRecorder()->totalChannel->output.updateValue(packetBytes);
|
||||
}
|
||||
delete[] inputAudioSamples;
|
||||
}
|
||||
|
@ -830,10 +829,8 @@ void Audio::addReceivedAudioToStream(const QByteArray& audioByteArray) {
|
|||
_receivedAudioStream.parseData(audioByteArray);
|
||||
}
|
||||
|
||||
// Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::AUDIO).updateValue(audioByteArray.size());
|
||||
Application::getInstance()->
|
||||
getBandwidthRecorder()->audioChannel->input.updateValue(audioByteArray.size());
|
||||
|
||||
Application::getInstance()->getBandwidthRecorder()->audioChannel->input.updateValue(audioByteArray.size());
|
||||
Application::getInstance()->getBandwidthRecorder()->totalChannel->input.updateValue(audioByteArray.size());
|
||||
}
|
||||
|
||||
void Audio::parseAudioEnvironmentData(const QByteArray &packet) {
|
||||
|
|
|
@ -37,6 +37,7 @@ BandwidthRecorder::~BandwidthRecorder() {
|
|||
delete avatarsChannel;
|
||||
delete octreeChannel;
|
||||
delete metavoxelsChannel;
|
||||
delete totalChannel;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ class BandwidthRecorder {
|
|||
Channel* avatarsChannel = new Channel("Avatars", "Kbps", 8000.0 / 1024.0, 0xffef40c0);
|
||||
Channel* octreeChannel = new Channel("Octree", "Kbps", 8000.0 / 1024.0, 0xd0d0d0a0);
|
||||
Channel* metavoxelsChannel = new Channel("Metavoxels", "Kbps", 8000.0 / 1024.0, 0xd0d0d0a0);
|
||||
Channel* totalChannel = new Channel("Total", "Kbps", 8000.0 / 1024.0, 0xd0d0d0a0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,8 +42,8 @@ void DatagramProcessor::processDatagrams() {
|
|||
nodeList->getNodeSocket().readDatagram(incomingPacket.data(), incomingPacket.size(),
|
||||
senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
|
||||
|
||||
_packetCount++;
|
||||
_byteCount += incomingPacket.size();
|
||||
_inPacketCount++;
|
||||
_inByteCount += incomingPacket.size();
|
||||
|
||||
if (nodeList->packetVersionAndHashMatch(incomingPacket)) {
|
||||
|
||||
|
@ -82,6 +82,8 @@ void DatagramProcessor::processDatagrams() {
|
|||
// this will keep creatorTokenIDs to IDs mapped correctly
|
||||
EntityItemID::handleAddEntityResponse(incomingPacket);
|
||||
application->getEntities()->getTree()->handleAddEntityResponse(incomingPacket);
|
||||
application->_bandwidthRecorder.octreeChannel->input.updateValue(incomingPacket.size());
|
||||
application->_bandwidthRecorder.totalChannel->input.updateValue(incomingPacket.size());
|
||||
break;
|
||||
case PacketTypeEntityData:
|
||||
case PacketTypeEntityErase:
|
||||
|
@ -95,7 +97,8 @@ void DatagramProcessor::processDatagrams() {
|
|||
// add this packet to our list of octree packets and process them on the octree data processing
|
||||
application->_octreeProcessor.queueReceivedPacket(matchedNode, incomingPacket);
|
||||
}
|
||||
|
||||
application->_bandwidthRecorder.octreeChannel->input.updateValue(incomingPacket.size());
|
||||
application->_bandwidthRecorder.totalChannel->input.updateValue(incomingPacket.size());
|
||||
break;
|
||||
}
|
||||
case PacketTypeMetavoxelData:
|
||||
|
@ -118,6 +121,7 @@ void DatagramProcessor::processDatagrams() {
|
|||
}
|
||||
|
||||
application->_bandwidthRecorder.avatarsChannel->input.updateValue(incomingPacket.size());
|
||||
application->_bandwidthRecorder.totalChannel->input.updateValue(incomingPacket.size());
|
||||
break;
|
||||
}
|
||||
case PacketTypeDomainConnectionDenied: {
|
||||
|
|
|
@ -19,16 +19,20 @@ class DatagramProcessor : public QObject {
|
|||
public:
|
||||
DatagramProcessor(QObject* parent = 0);
|
||||
|
||||
int getPacketCount() const { return _packetCount; }
|
||||
int getByteCount() const { return _byteCount; }
|
||||
int getInPacketCount() const { return _inPacketCount; }
|
||||
int getOutPacketCount() const { return _outPacketCount; }
|
||||
int getInByteCount() const { return _inByteCount; }
|
||||
int getOutByteCount() const { return _outByteCount; }
|
||||
|
||||
void resetCounters() { _packetCount = 0; _byteCount = 0; }
|
||||
void resetCounters() { _inPacketCount = 0; _outPacketCount = 0; _inByteCount = 0; _outByteCount = 0; }
|
||||
public slots:
|
||||
void processDatagrams();
|
||||
|
||||
private:
|
||||
int _packetCount;
|
||||
int _byteCount;
|
||||
int _inPacketCount;
|
||||
int _outPacketCount;
|
||||
int _inByteCount;
|
||||
int _outByteCount;
|
||||
};
|
||||
|
||||
#endif // hifi_DatagramProcessor_h
|
||||
|
|
|
@ -899,7 +899,8 @@ int MetavoxelSystemClient::parseData(const QByteArray& packet) {
|
|||
} else {
|
||||
QMetaObject::invokeMethod(&_sequencer, "receivedDatagram", Q_ARG(const QByteArray&, packet));
|
||||
}
|
||||
Application::getInstance()->getBandwidthRecorder()->metavoxelsChannel->input.updateValue (packet.size());
|
||||
Application::getInstance()->getBandwidthRecorder()->metavoxelsChannel->input.updateValue(packet.size());
|
||||
Application::getInstance()->getBandwidthRecorder()->totalChannel->input.updateValue(packet.size());
|
||||
}
|
||||
return packet.size();
|
||||
}
|
||||
|
@ -1015,7 +1016,8 @@ void MetavoxelSystemClient::sendDatagram(const QByteArray& data) {
|
|||
} else {
|
||||
DependencyManager::get<NodeList>()->writeDatagram(data, _node);
|
||||
}
|
||||
Application::getInstance()->getBandwidthRecorder()->metavoxelsChannel->output.updateValue (data.size());
|
||||
Application::getInstance()->getBandwidthRecorder()->metavoxelsChannel->output.updateValue(data.size());
|
||||
Application::getInstance()->getBandwidthRecorder()->totalChannel->output.updateValue(data.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -919,7 +919,11 @@ void ApplicationOverlay::renderStatsAndLogs() {
|
|||
int voxelPacketsToProcess = octreePacketProcessor.packetsToProcessCount();
|
||||
// Onscreen text about position, servers, etc
|
||||
Stats::getInstance()->display(WHITE_TEXT, horizontalOffset, application->getFps(),
|
||||
application->getPacketsPerSecond(), application->getBytesPerSecond(), voxelPacketsToProcess);
|
||||
application->getInPacketsPerSecond(),
|
||||
application->getOutPacketsPerSecond(),
|
||||
application->getInBytesPerSecond(),
|
||||
application->getOutBytesPerSecond(),
|
||||
voxelPacketsToProcess);
|
||||
}
|
||||
|
||||
// Show on-screen msec timer
|
||||
|
|
|
@ -23,12 +23,11 @@
|
|||
|
||||
BandwidthDialog::ChannelDisplay::ChannelDisplay(BandwidthRecorder::Channel *ch, QFormLayout* form) {
|
||||
this->ch = ch;
|
||||
this->input_label = setupLabel(form, "input");
|
||||
this->output_label = setupLabel(form, "output");
|
||||
this->label = setupLabel(form);
|
||||
}
|
||||
|
||||
|
||||
QLabel* BandwidthDialog::ChannelDisplay::setupLabel(QFormLayout* form, std::string i_or_o) {
|
||||
QLabel* BandwidthDialog::ChannelDisplay::setupLabel(QFormLayout* form) {
|
||||
QLabel* label = new QLabel();
|
||||
char strBuf[64];
|
||||
|
||||
|
@ -38,10 +37,9 @@ QLabel* BandwidthDialog::ChannelDisplay::setupLabel(QFormLayout* form, std::stri
|
|||
unsigned rgb = ch->colorRGBA >> 8;
|
||||
rgb = ((rgb & 0xfefefeu) >> 1) + ((rgb & 0xf8f8f8) >> 3);
|
||||
palette.setColor(QPalette::WindowText, QColor::fromRgb(rgb));
|
||||
|
||||
label->setPalette(palette);
|
||||
|
||||
snprintf(strBuf, sizeof(strBuf), " %s %s Bandwidth:", i_or_o.c_str(), ch->caption);
|
||||
snprintf(strBuf, sizeof(strBuf), " %s Bandwidth In/Out:", ch->caption);
|
||||
form->addRow(strBuf, label);
|
||||
|
||||
return label;
|
||||
|
@ -51,10 +49,11 @@ QLabel* BandwidthDialog::ChannelDisplay::setupLabel(QFormLayout* form, std::stri
|
|||
|
||||
void BandwidthDialog::ChannelDisplay::setLabelText() {
|
||||
char strBuf[64];
|
||||
snprintf(strBuf, sizeof(strBuf), "%0.0f %s", ch->input.getValue() * ch->unitScale, ch->unitCaption);
|
||||
input_label->setText(strBuf);
|
||||
snprintf(strBuf, sizeof(strBuf), "%0.0f %s", ch->output.getValue() * ch->unitScale, ch->unitCaption);
|
||||
output_label->setText(strBuf);
|
||||
snprintf(strBuf, sizeof(strBuf), "%0.0f/%0.0f %s",
|
||||
ch->input.getValue() * ch->unitScale,
|
||||
ch->output.getValue() * ch->unitScale,
|
||||
ch->unitCaption);
|
||||
label->setText(strBuf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,6 +72,7 @@ BandwidthDialog::BandwidthDialog(QWidget* parent, BandwidthRecorder* model) :
|
|||
avatarsChannelDisplay = new ChannelDisplay(_model->avatarsChannel, form);
|
||||
octreeChannelDisplay = new ChannelDisplay(_model->octreeChannel, form);
|
||||
metavoxelsChannelDisplay = new ChannelDisplay(_model->metavoxelsChannel, form);
|
||||
totalChannelDisplay = new ChannelDisplay(_model->totalChannel, form);
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,6 +81,7 @@ BandwidthDialog::~BandwidthDialog() {
|
|||
delete avatarsChannelDisplay;
|
||||
delete octreeChannelDisplay;
|
||||
delete metavoxelsChannelDisplay;
|
||||
delete totalChannelDisplay;
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,6 +90,7 @@ void BandwidthDialog::paintEvent(QPaintEvent* event) {
|
|||
avatarsChannelDisplay->setLabelText();
|
||||
octreeChannelDisplay->setLabelText();
|
||||
metavoxelsChannelDisplay->setLabelText();
|
||||
totalChannelDisplay->setLabelText();
|
||||
|
||||
this->QDialog::paintEvent(event);
|
||||
this->setFixedSize(this->width(), this->height());
|
||||
|
|
|
@ -29,14 +29,13 @@ public:
|
|||
class ChannelDisplay {
|
||||
public:
|
||||
ChannelDisplay(BandwidthRecorder::Channel *ch, QFormLayout* form);
|
||||
QLabel* setupLabel(QFormLayout* form, std::string i_or_o);
|
||||
QLabel* setupLabel(QFormLayout* form);
|
||||
void setLabelText();
|
||||
|
||||
private:
|
||||
BandwidthRecorder::Channel *ch;
|
||||
|
||||
QLabel* input_label;
|
||||
QLabel* output_label;
|
||||
QLabel* label;
|
||||
};
|
||||
|
||||
ChannelDisplay* audioChannelDisplay;
|
||||
|
@ -44,6 +43,9 @@ public:
|
|||
ChannelDisplay* octreeChannelDisplay;
|
||||
ChannelDisplay* metavoxelsChannelDisplay;
|
||||
|
||||
// sums of all the other channels
|
||||
ChannelDisplay* totalChannelDisplay;
|
||||
|
||||
signals:
|
||||
|
||||
void closed();
|
||||
|
|
|
@ -35,7 +35,7 @@ using namespace std;
|
|||
const int STATS_PELS_PER_LINE = 20;
|
||||
|
||||
const int STATS_GENERAL_MIN_WIDTH = 165;
|
||||
const int STATS_BANDWIDTH_MIN_WIDTH = 150;
|
||||
const int STATS_BANDWIDTH_MIN_WIDTH = 250;
|
||||
const int STATS_PING_MIN_WIDTH = 190;
|
||||
const int STATS_GEO_MIN_WIDTH = 240;
|
||||
const int STATS_OCTREE_MIN_WIDTH = 410;
|
||||
|
@ -199,8 +199,10 @@ void Stats::display(
|
|||
const float* color,
|
||||
int horizontalOffset,
|
||||
float fps,
|
||||
int packetsPerSecond,
|
||||
int bytesPerSecond,
|
||||
int inPacketsPerSecond,
|
||||
int outPacketsPerSecond,
|
||||
int inBytesPerSecond,
|
||||
int outBytesPerSecond,
|
||||
int voxelPacketsToProcess)
|
||||
{
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
@ -264,18 +266,6 @@ void Stats::display(
|
|||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, avatarNodes, color);
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, framesPerSecond, color);
|
||||
|
||||
if (_expanded) {
|
||||
char packetsPerSecondString[30];
|
||||
sprintf(packetsPerSecondString, "Pkts/sec: %d", packetsPerSecond);
|
||||
char averageMegabitsPerSecond[30];
|
||||
sprintf(averageMegabitsPerSecond, "Mbps: %3.2f", (float)bytesPerSecond * 8.0f / 1000000.0f);
|
||||
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, packetsPerSecondString, color);
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, averageMegabitsPerSecond, color);
|
||||
}
|
||||
|
||||
// TODO: the display of these timing details should all be moved to JavaScript
|
||||
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayTimingDetails)) {
|
||||
|
@ -317,8 +307,27 @@ void Stats::display(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
verticalOffset = 0;
|
||||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth +1;
|
||||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + 1;
|
||||
|
||||
char packetsPerSecondString[30];
|
||||
sprintf(packetsPerSecondString, "Packets In/Out: %d/%d", inPacketsPerSecond, outPacketsPerSecond);
|
||||
char averageMegabitsPerSecond[30];
|
||||
sprintf(averageMegabitsPerSecond, "Mbps In/Out: %3.2f/%3.2f",
|
||||
(float)inBytesPerSecond * 8.0f / 1000000.0f,
|
||||
(float)outBytesPerSecond * 8.0f / 1000000.0f);
|
||||
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, packetsPerSecondString, color);
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, averageMegabitsPerSecond, color);
|
||||
|
||||
|
||||
|
||||
verticalOffset = 0;
|
||||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + _bandwidthStatsWidth +1;
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||
int pingAudio = -1, pingAvatar = -1, pingVoxel = -1, pingOctreeMax = -1;
|
||||
|
|
|
@ -29,7 +29,8 @@ public:
|
|||
void toggleExpanded();
|
||||
void checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset);
|
||||
void resetWidth(int width, int horizontalOffset);
|
||||
void display(const float* color, int horizontalOffset, float fps, int packetsPerSecond, int bytesPerSecond, int voxelPacketsToProcess);
|
||||
void display(const float* color, int horizontalOffset, float fps, int inPacketsPerSecond, int outPacketsPerSecond,
|
||||
int inBytesPerSecond, int outBytesPerSecond, int voxelPacketsToProcess);
|
||||
bool includeTimingRecord(const QString& name);
|
||||
|
||||
Q_INVOKABLE void setMetavoxelStats(int internal, int leaves, int sendProgress,
|
||||
|
|
Loading…
Reference in a new issue