From 6f1136c417323f81ffdd432805b874deabebe58e Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 26 Feb 2014 21:21:10 -0800 Subject: [PATCH] more status page formatting, and include max total packets in packets per client interval --- assignment-client/src/octree/OctreeServer.cpp | 22 +++++++++++++++++++ assignment-client/src/octree/OctreeServer.h | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/assignment-client/src/octree/OctreeServer.cpp b/assignment-client/src/octree/OctreeServer.cpp index f2ebe4a428..7bf5c12a22 100644 --- a/assignment-client/src/octree/OctreeServer.cpp +++ b/assignment-client/src/octree/OctreeServer.cpp @@ -163,12 +163,18 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QString& } } if (minutes > 0) { + if (hours > 0) { + statsString += QString(" "); + } statsString += QString("%1 minute").arg(minutes); if (minutes > 1) { statsString += QString("s"); } } if (seconds > 0) { + if (hours > 0 || minutes > 0) { + statsString += QString(" "); + } statsString += QString().sprintf("%.3f seconds", seconds); } statsString += "\r\n\r\n"; @@ -196,12 +202,18 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QString& } } if (minutes > 0) { + if (hours > 0) { + statsString += QString(" "); + } statsString += QString("%1 minute").arg(minutes); if (minutes > 1) { statsString += QString("s"); } } if (seconds >= 0) { + if (hours > 0 || minutes > 0) { + statsString += QString(" "); + } statsString += QString().sprintf("%.3f seconds", seconds); } statsString += "\r\n"; @@ -690,3 +702,13 @@ void OctreeServer::run() { connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes())); silentNodeTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000); } + + +int OctreeServer::getPacketsPerClientPerInterval() const { + int totalEvenly = getPacketsTotalPerInterval() / getCurrentClientCount(); + if (totalEvenly < 1) { + totalEvenly = 1; + } + int packetsPerClientPerInterval = std::min(_packetsPerClientPerInterval, totalEvenly); + return packetsPerClientPerInterval; +} diff --git a/assignment-client/src/octree/OctreeServer.h b/assignment-client/src/octree/OctreeServer.h index 1dcb3352ff..4a412d19b3 100644 --- a/assignment-client/src/octree/OctreeServer.h +++ b/assignment-client/src/octree/OctreeServer.h @@ -43,7 +43,7 @@ public: Octree* getOctree() { return _tree; } JurisdictionMap* getJurisdiction() { return _jurisdiction; } - int getPacketsPerClientPerInterval() const { return _packetsPerClientPerInterval; } + int getPacketsPerClientPerInterval() const; int getPacketsPerClientPerSecond() const { return getPacketsPerClientPerInterval() * INTERVALS_PER_SECOND; } int getPacketsTotalPerInterval() const { return _packetsTotalPerInterval; } int getPacketsTotalPerSecond() const { return getPacketsTotalPerInterval() * INTERVALS_PER_SECOND; }