mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #13023 from SimonWalton-HiFi/connection-stats-dump
Add a utility function to dump ConnectionStats
This commit is contained in:
commit
8c6d83ad67
2 changed files with 32 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include "ConnectionStats.h"
|
||||
|
||||
using namespace udt;
|
||||
|
@ -112,3 +113,31 @@ void ConnectionStats::recordPacketSendPeriod(int sample) {
|
|||
_currentSample.packetSendPeriod = sample;
|
||||
_total.packetSendPeriod = (int)((_total.packetSendPeriod * EWMA_PREVIOUS_SAMPLES_WEIGHT) + (sample * EWMA_CURRENT_SAMPLE_WEIGHT));
|
||||
}
|
||||
|
||||
QDebug& operator<<(QDebug&& debug, const udt::ConnectionStats::Stats& stats) {
|
||||
debug << "Connection stats:\n";
|
||||
#define HIFI_LOG_EVENT(x) << " " #x " events: " << stats.events[ConnectionStats::Stats::Event::x] << "\n"
|
||||
debug
|
||||
HIFI_LOG_EVENT(SentACK)
|
||||
HIFI_LOG_EVENT(ReceivedACK)
|
||||
HIFI_LOG_EVENT(ProcessedACK)
|
||||
HIFI_LOG_EVENT(SentLightACK)
|
||||
HIFI_LOG_EVENT(ReceivedLightACK)
|
||||
HIFI_LOG_EVENT(SentACK2)
|
||||
HIFI_LOG_EVENT(ReceivedACK2)
|
||||
HIFI_LOG_EVENT(SentNAK)
|
||||
HIFI_LOG_EVENT(ReceivedNAK)
|
||||
HIFI_LOG_EVENT(SentTimeoutNAK)
|
||||
HIFI_LOG_EVENT(ReceivedTimeoutNAK)
|
||||
HIFI_LOG_EVENT(Retransmission)
|
||||
HIFI_LOG_EVENT(Duplicate)
|
||||
;
|
||||
#undef HIFI_LOG_EVENT
|
||||
|
||||
debug << " Sent packets: " << stats.sentPackets;
|
||||
debug << "\n Received packets: " << stats.receivedPackets;
|
||||
debug << "\n Sent util bytes: " << stats.sentUtilBytes;
|
||||
debug << "\n Sent bytes: " << stats.sentBytes;
|
||||
debug << "\n Received bytes: " << stats.receivedBytes << "\n";
|
||||
return debug;
|
||||
}
|
||||
|
|
|
@ -101,4 +101,7 @@ private:
|
|||
|
||||
}
|
||||
|
||||
class QDebug;
|
||||
QDebug& operator<<(QDebug&& debug, const udt::ConnectionStats::Stats& stats);
|
||||
|
||||
#endif // hifi_ConnectionStats_h
|
||||
|
|
Loading…
Reference in a new issue