more status page formatting, and include max total packets in packets per client interval

This commit is contained in:
ZappoMan 2014-02-26 21:21:10 -08:00
parent 85a42849a8
commit 6f1136c417
2 changed files with 23 additions and 1 deletions

View file

@ -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;
}

View file

@ -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; }