History

Merge branch 'master' into 20280

David Rowe committed 11 years ago

Commit d9e353e2 parents 3c7cdc1 b5e629234 files · +818 −433Browse files

Showing the changes to interface/src/Application.cpp (1 of 34 files). Show all

Unified · Split

interface/src/Application.cpp+9−35
@@ -201,6 +201,7 @@ bool setupEssentials(int& argc, char** argv) { · 200 unmodified lines
201201 auto lodManager = DependencyManager::set<LODManager>();
202202 auto jsConsole = DependencyManager::set<StandAloneJSConsole>();
203203 auto dialogsManager = DependencyManager::set<DialogsManager>();
204+ auto bandwidthRecorder = DependencyManager::set<BandwidthRecorder>();
204205 #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
205206 auto speechRecognizer = DependencyManager::set<SpeechRecognizer>();
206207 #endif
@@ -241,10 +242,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 34 unmodified lines
241242 _mousePressed(false),
242243 _enableProcessOctreeThread(true),
243244 _octreeProcessor(),
244− _inPacketsPerSecond(0),
245− _outPacketsPerSecond(0),
246− _inBytesPerSecond(0),
247− _outBytesPerSecond(0),
248245 _nodeBoundsDisplay(this),
249246 _previousScriptLocation(),
250247 _applicationOverlay(),
@@ -435,6 +432,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 184 unmodified lines
435432 connect(this, SIGNAL(aboutToQuit()), this, SLOT(saveScripts()));
436433 connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
437434
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+
438442 // check first run...
439443 bool firstRun = SettingHandles::firstRun.get();
440444 if (firstRun) {
@@ -774,25 +778,8 @@ void Application::updateProjectionMatrix(Camera& camera, bool updateViewFrustum) · 333 unmodified lines
774778
775779 void Application::controlledBroadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes) {
776780 foreach(NodeType_t type, destinationNodeTypes) {
777−
778781 // Perform the broadcast for one type
779− int nReceivingNodes = 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− }
782+ DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << type);
796783 }
797784 }
798785
@@ -1393,15 +1380,8 @@ void Application::timer() { · 594 unmodified lines
13931380 float diffTime = (float)_timerStart.nsecsElapsed() / 1000000000.0f;
13941381
13951382 _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;
14011383 _frameCount = 0;
1402−
14031384 _datagramProcessor.resetCounters();
1404−
14051385 _timerStart.start();
14061386
14071387 // 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
23862366
23872367 // make sure we still have an active socket
23882368 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);
23932369 }
23942370 });
23952371 }
@@ -3377,8 +3353,6 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin · 981 unmodified lines
33773353 }
33783354
33793355 void Application::packetSent(quint64 length) {
3380− _bandwidthRecorder.octreeChannel->output.updateValue(length);
3381− _bandwidthRecorder.totalChannel->output.updateValue(length);
33823356 }
33833357
33843358 const QString SETTINGS_KEY = "Settings";

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t