mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Merge pull request #8413 from huffman/feat/atp-bandwidth
Add asset server bandwidth to stats
This commit is contained in:
commit
3355a90e7d
8 changed files with 25 additions and 9 deletions
|
@ -99,6 +99,12 @@ Item {
|
|||
font.pixelSize: root.fontSize
|
||||
text: "Mbps In/Out: " + root.mbpsIn.toFixed(2) + "/" + root.mbpsOut.toFixed(2)
|
||||
}
|
||||
Text {
|
||||
color: root.fontColor;
|
||||
font.pixelSize: root.fontSize
|
||||
visible: root.expanded
|
||||
text: "Asset Mbps In/Out: " + root.assetMbpsIn.toFixed(2) + "/" + root.assetMbpsOut.toFixed(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -838,7 +838,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
|||
QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
|
||||
connect(nodeList.data(), &LimitedNodeList::dataSent,
|
||||
bandwidthRecorder.data(), &BandwidthRecorder::updateOutboundData);
|
||||
connect(&nodeList->getPacketReceiver(), &PacketReceiver::dataReceived,
|
||||
connect(nodeList.data(), &LimitedNodeList::dataReceived,
|
||||
bandwidthRecorder.data(), &BandwidthRecorder::updateInboundData);
|
||||
|
||||
// FIXME -- I'm a little concerned about this.
|
||||
|
|
|
@ -136,6 +136,9 @@ void Stats::updateStats(bool force) {
|
|||
STAT_UPDATE_FLOAT(mbpsIn, (float)bandwidthRecorder->getCachedTotalAverageInputKilobitsPerSecond() / 1000.0f, 0.01f);
|
||||
STAT_UPDATE_FLOAT(mbpsOut, (float)bandwidthRecorder->getCachedTotalAverageOutputKilobitsPerSecond() / 1000.0f, 0.01f);
|
||||
|
||||
STAT_UPDATE_FLOAT(assetMbpsIn, (float)bandwidthRecorder->getAverageInputKilobitsPerSecond(NodeType::AssetServer) / 1000.0f, 0.01f);
|
||||
STAT_UPDATE_FLOAT(assetMbpsOut, (float)bandwidthRecorder->getAverageOutputKilobitsPerSecond(NodeType::AssetServer) / 1000.0f, 0.01f);
|
||||
|
||||
// Second column: ping
|
||||
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NodeType::AvatarMixer);
|
||||
|
|
|
@ -43,6 +43,8 @@ class Stats : public QQuickItem {
|
|||
STATS_PROPERTY(int, packetOutCount, 0)
|
||||
STATS_PROPERTY(float, mbpsIn, 0)
|
||||
STATS_PROPERTY(float, mbpsOut, 0)
|
||||
STATS_PROPERTY(float, assetMbpsIn, 0)
|
||||
STATS_PROPERTY(float, assetMbpsOut, 0)
|
||||
STATS_PROPERTY(int, audioPing, 0)
|
||||
STATS_PROPERTY(int, avatarPing, 0)
|
||||
STATS_PROPERTY(int, entitiesPing, 0)
|
||||
|
@ -128,6 +130,8 @@ signals:
|
|||
void packetOutCountChanged();
|
||||
void mbpsInChanged();
|
||||
void mbpsOutChanged();
|
||||
void assetMbpsInChanged();
|
||||
void assetMbpsOutChanged();
|
||||
void audioPingChanged();
|
||||
void avatarPingChanged();
|
||||
void entitiesPingChanged();
|
||||
|
|
|
@ -175,7 +175,11 @@ QUdpSocket& LimitedNodeList::getDTLSSocket() {
|
|||
}
|
||||
|
||||
bool LimitedNodeList::isPacketVerified(const udt::Packet& packet) {
|
||||
return packetVersionMatch(packet) && packetSourceAndHashMatch(packet);
|
||||
// We track bandwidth when doing packet verification to avoid needing to do a node lookup
|
||||
// later when we already do it in packetSourceAndHashMatchAndTrackBandwidth. A node lookup
|
||||
// incurs a lock, so it is ideal to avoid needing to do it 2+ times for each packet
|
||||
// received.
|
||||
return packetVersionMatch(packet) && packetSourceAndHashMatchAndTrackBandwidth(packet);
|
||||
}
|
||||
|
||||
bool LimitedNodeList::packetVersionMatch(const udt::Packet& packet) {
|
||||
|
@ -224,11 +228,12 @@ bool LimitedNodeList::packetVersionMatch(const udt::Packet& packet) {
|
|||
}
|
||||
}
|
||||
|
||||
bool LimitedNodeList::packetSourceAndHashMatch(const udt::Packet& packet) {
|
||||
bool LimitedNodeList::packetSourceAndHashMatchAndTrackBandwidth(const udt::Packet& packet) {
|
||||
|
||||
PacketType headerType = NLPacket::typeInHeader(packet);
|
||||
|
||||
if (NON_SOURCED_PACKETS.contains(headerType)) {
|
||||
emit dataReceived(NodeType::Unassigned, packet.getPayloadSize());
|
||||
return true;
|
||||
} else {
|
||||
QUuid sourceID = NLPacket::sourceIDInHeader(packet);
|
||||
|
@ -260,6 +265,8 @@ bool LimitedNodeList::packetSourceAndHashMatch(const udt::Packet& packet) {
|
|||
// from this sending node
|
||||
matchingNode->setLastHeardMicrostamp(usecTimestampNow());
|
||||
|
||||
emit dataReceived(matchingNode->getType(), packet.getPayloadSize());
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
|
|
@ -243,6 +243,7 @@ public slots:
|
|||
|
||||
signals:
|
||||
void dataSent(quint8 channelType, int bytes);
|
||||
void dataReceived(quint8 channelType, int bytes);
|
||||
|
||||
// QUuid might be zero for non-sourced packet types.
|
||||
void packetVersionMismatch(PacketType type, const HifiSockAddr& senderSockAddr, const QUuid& senderUUID);
|
||||
|
@ -279,7 +280,7 @@ protected:
|
|||
|
||||
void setLocalSocket(const HifiSockAddr& sockAddr);
|
||||
|
||||
bool packetSourceAndHashMatch(const udt::Packet& packet);
|
||||
bool packetSourceAndHashMatchAndTrackBandwidth(const udt::Packet& packet);
|
||||
void processSTUNResponse(std::unique_ptr<udt::BasePacket> packet);
|
||||
|
||||
void handleNodeKill(const SharedNodePointer& node);
|
||||
|
|
|
@ -294,7 +294,6 @@ void PacketReceiver::handleVerifiedMessage(QSharedPointer<ReceivedMessage> recei
|
|||
PacketType packetType = receivedMessage->getType();
|
||||
|
||||
if (matchingNode) {
|
||||
emit dataReceived(matchingNode->getType(), receivedMessage->getSize());
|
||||
matchingNode->recordBytesReceived(receivedMessage->getSize());
|
||||
|
||||
QMetaMethod metaMethod = listener.method;
|
||||
|
@ -326,7 +325,6 @@ void PacketReceiver::handleVerifiedMessage(QSharedPointer<ReceivedMessage> recei
|
|||
}
|
||||
} else {
|
||||
// qDebug() << "Got verified unsourced packet list: " << QString(nlPacketList->getMessage());
|
||||
emit dataReceived(NodeType::Unassigned, receivedMessage->getSize());
|
||||
|
||||
// one final check on the QPointer before we invoke
|
||||
if (listener.object) {
|
||||
|
|
|
@ -67,9 +67,6 @@ public:
|
|||
void handleVerifiedPacket(std::unique_ptr<udt::Packet> packet);
|
||||
void handleVerifiedMessagePacket(std::unique_ptr<udt::Packet> message);
|
||||
void handleMessageFailure(HifiSockAddr from, udt::Packet::MessageNumber messageNumber);
|
||||
|
||||
signals:
|
||||
void dataReceived(quint8 channelType, int bytes);
|
||||
|
||||
private:
|
||||
struct Listener {
|
||||
|
|
Loading…
Reference in a new issue