Showing the changes to interface/src/Application.cpp (1 of 34 files). Show all
Unified · Split
| @@ -201,6 +201,7 @@ bool setupEssentials(int& argc, char** argv) { · 200 unmodified lines | |||
| 201 | auto lodManager = DependencyManager::set<LODManager>(); | 201 | auto lodManager = DependencyManager::set<LODManager>(); |
| 202 | auto jsConsole = DependencyManager::set<StandAloneJSConsole>(); | 202 | auto jsConsole = DependencyManager::set<StandAloneJSConsole>(); |
| 203 | auto dialogsManager = DependencyManager::set<DialogsManager>(); | 203 | auto dialogsManager = DependencyManager::set<DialogsManager>(); |
| 204 | auto bandwidthRecorder = DependencyManager::set<BandwidthRecorder>(); | ||
| 204 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) | 205 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) |
| 205 | auto speechRecognizer = DependencyManager::set<SpeechRecognizer>(); | 206 | auto speechRecognizer = DependencyManager::set<SpeechRecognizer>(); |
| 206 | #endif | 207 | #endif |
| @@ -241,10 +242,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 34 unmodified lines | |||
| 241 | _mousePressed(false), | 242 | _mousePressed(false), |
| 242 | _enableProcessOctreeThread(true), | 243 | _enableProcessOctreeThread(true), |
| 243 | _octreeProcessor(), | 244 | _octreeProcessor(), |
| 244 | _inPacketsPerSecond(0), | ||
| 245 | _outPacketsPerSecond(0), | ||
| 246 | _inBytesPerSecond(0), | ||
| 247 | _outBytesPerSecond(0), | ||
| 248 | _nodeBoundsDisplay(this), | 245 | _nodeBoundsDisplay(this), |
| 249 | _previousScriptLocation(), | 246 | _previousScriptLocation(), |
| 250 | _applicationOverlay(), | 247 | _applicationOverlay(), |
| @@ -435,6 +432,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 184 unmodified lines | |||
| 435 | connect(this, SIGNAL(aboutToQuit()), this, SLOT(saveScripts())); | 432 | connect(this, SIGNAL(aboutToQuit()), this, SLOT(saveScripts())); |
| 436 | connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit())); | 433 | connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit())); |
| 437 | 434 | ||
| 435 | // hook up bandwidth estimator | ||
| 436 | QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>(); | ||
| 437 | connect(nodeList.data(), SIGNAL(dataSent(const quint8, const int)), | ||
| 438 | bandwidthRecorder.data(), SLOT(updateOutboundData(const quint8, const int))); | ||
| 439 | connect(nodeList.data(), SIGNAL(dataReceived(const quint8, const int)), | ||
| 440 | bandwidthRecorder.data(), SLOT(updateInboundData(const quint8, const int))); | ||
| 441 | |||
| 438 | // check first run... | 442 | // check first run... |
| 439 | bool firstRun = SettingHandles::firstRun.get(); | 443 | bool firstRun = SettingHandles::firstRun.get(); |
| 440 | if (firstRun) { | 444 | if (firstRun) { |
| @@ -774,25 +778,8 @@ void Application::updateProjectionMatrix(Camera& camera, bool updateViewFrustum) · 333 unmodified lines | |||
| 774 | 778 | ||
| 775 | void Application::controlledBroadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes) { | 779 | void Application::controlledBroadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes) { |
| 776 | foreach(NodeType_t type, destinationNodeTypes) { | 780 | foreach(NodeType_t type, destinationNodeTypes) { |
| 777 | |||
| 778 | // Perform the broadcast for one type | 781 | // Perform the broadcast for one type |
| 779 | int nReceivingNodes = DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << type); | 782 | DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << type); |
| 780 | |||
| 781 | // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise) | ||
| 782 | double bandwidth_amount = nReceivingNodes * packet.size(); | ||
| 783 | switch (type) { | ||
| 784 | case NodeType::Agent: | ||
| 785 | case NodeType::AvatarMixer: | ||
| 786 | _bandwidthRecorder.avatarsChannel->output.updateValue(bandwidth_amount); | ||
| 787 | _bandwidthRecorder.totalChannel->input.updateValue(bandwidth_amount); | ||
| 788 | break; | ||
| 789 | case NodeType::EntityServer: | ||
| 790 | _bandwidthRecorder.octreeChannel->output.updateValue(bandwidth_amount); | ||
| 791 | _bandwidthRecorder.totalChannel->output.updateValue(bandwidth_amount); | ||
| 792 | break; | ||
| 793 | default: | ||
| 794 | continue; | ||
| 795 | } | ||
| 796 | } | 783 | } |
| 797 | } | 784 | } |
| 798 | 785 | ||
| @@ -1393,15 +1380,8 @@ void Application::timer() { · 594 unmodified lines | |||
| 1393 | float diffTime = (float)_timerStart.nsecsElapsed() / 1000000000.0f; | 1380 | float diffTime = (float)_timerStart.nsecsElapsed() / 1000000000.0f; |
| 1394 | 1381 | ||
| 1395 | _fps = (float)_frameCount / diffTime; | 1382 | _fps = (float)_frameCount / diffTime; |
| 1396 | |||
| 1397 | _inPacketsPerSecond = (float) _datagramProcessor.getInPacketCount() / diffTime; | ||
| 1398 | _outPacketsPerSecond = (float) _datagramProcessor.getOutPacketCount() / diffTime; | ||
| 1399 | _inBytesPerSecond = (float) _datagramProcessor.getInByteCount() / diffTime; | ||
| 1400 | _outBytesPerSecond = (float) _datagramProcessor.getOutByteCount() / diffTime; | ||
| 1401 | _frameCount = 0; | 1383 | _frameCount = 0; |
| 1402 | |||
| 1403 | _datagramProcessor.resetCounters(); | 1384 | _datagramProcessor.resetCounters(); |
| 1404 | |||
| 1405 | _timerStart.start(); | 1385 | _timerStart.start(); |
| 1406 | 1386 | ||
| 1407 | // ask the node list to check in with the domain server | 1387 | // ask the node list to check in with the domain server |
| @@ -2386,10 +2366,6 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 978 unmodified lines | |||
| 2386 | 2366 | ||
| 2387 | // make sure we still have an active socket | 2367 | // make sure we still have an active socket |
| 2388 | nodeList->writeUnverifiedDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node); | 2368 | nodeList->writeUnverifiedDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node); |
| 2389 | |||
| 2390 | // Feed number of bytes to corresponding channel of the bandwidth meter | ||
| 2391 | _bandwidthRecorder.octreeChannel->output.updateValue(packetLength); | ||
| 2392 | _bandwidthRecorder.totalChannel->output.updateValue(packetLength); | ||
| 2393 | } | 2369 | } |
| 2394 | }); | 2370 | }); |
| 2395 | } | 2371 | } |
| @@ -3377,8 +3353,6 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin · 981 unmodified lines | |||
| 3377 | } | 3353 | } |
| 3378 | 3354 | ||
| 3379 | void Application::packetSent(quint64 length) { | 3355 | void Application::packetSent(quint64 length) { |
| 3380 | _bandwidthRecorder.octreeChannel->output.updateValue(length); | ||
| 3381 | _bandwidthRecorder.totalChannel->output.updateValue(length); | ||
| 3382 | } | 3356 | } |
| 3383 | 3357 | ||
| 3384 | const QString SETTINGS_KEY = "Settings"; | 3358 | const QString SETTINGS_KEY = "Settings"; |