mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 10:43:13 +02:00
Added new connection stats
This commit is contained in:
parent
4f8f9903c2
commit
da7a8f6e2f
2 changed files with 72 additions and 7 deletions
|
@ -21,8 +21,8 @@ ConnectionStats::ConnectionStats() {
|
|||
}
|
||||
|
||||
ConnectionStats::Stats ConnectionStats::sample() {
|
||||
Stats sample;
|
||||
std::swap(sample, _currentSample);
|
||||
Stats sample = _currentSample;
|
||||
_currentSample = Stats();
|
||||
|
||||
auto now = duration_cast<microseconds>(high_resolution_clock::now().time_since_epoch());
|
||||
sample.endTime = now;
|
||||
|
@ -81,12 +81,57 @@ void ConnectionStats::recordReceivedTimeoutNAK() {
|
|||
++_total.receivedTimeoutNAKs;
|
||||
}
|
||||
|
||||
void ConnectionStats::recordSentPackets() {
|
||||
|
||||
void ConnectionStats::recordSentPackets(int payload, int total) {
|
||||
++_currentSample.sentPackets;
|
||||
++_total.sentPackets;
|
||||
|
||||
_currentSample.sentUtilBytes += payload;
|
||||
_total.sentUtilBytes += payload;
|
||||
|
||||
_currentSample.sentBytes += total;
|
||||
_total.sentBytes += total;
|
||||
}
|
||||
|
||||
void ConnectionStats::recordReceivedPackets() {
|
||||
void ConnectionStats::recordReceivedPackets(int payload, int total) {
|
||||
++_currentSample.recievedPackets;
|
||||
++_total.recievedPackets;
|
||||
}
|
||||
|
||||
_currentSample.recievedUtilBytes += payload;
|
||||
_total.recievedUtilBytes += payload;
|
||||
|
||||
_currentSample.sentBytes += total;
|
||||
_total.recievedBytes += total;
|
||||
}
|
||||
|
||||
void ConnectionStats::recordUnreliableSentPackets(int payload, int total) {
|
||||
++_currentSample.sentUnreliablePackets;
|
||||
++_total.sentUnreliablePackets;
|
||||
|
||||
_currentSample.sentUnreliableUtilBytes += payload;
|
||||
_total.sentUnreliableUtilBytes += payload;
|
||||
|
||||
_currentSample.sentUnreliableBytes += total;
|
||||
_total.sentUnreliableBytes += total;
|
||||
}
|
||||
|
||||
void ConnectionStats::recordUnreliableReceivedPackets(int payload, int total) {
|
||||
++_currentSample.recievedUnreliablePackets;
|
||||
++_total.recievedUnreliablePackets;
|
||||
|
||||
_currentSample.recievedUnreliableUtilBytes += payload;
|
||||
_total.recievedUnreliableUtilBytes += payload;
|
||||
|
||||
_currentSample.sentUnreliableBytes += total;
|
||||
_total.recievedUnreliableBytes += total;
|
||||
}
|
||||
|
||||
void ConnectionStats::recordRetransmition() {
|
||||
++_currentSample.retransmissions;
|
||||
++_total.retransmissions;
|
||||
}
|
||||
|
||||
void ConnectionStats::recordDrop() {
|
||||
++_currentSample.drops;
|
||||
++_total.drops;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,20 @@ public:
|
|||
|
||||
int sentPackets { 0 };
|
||||
int recievedPackets { 0 };
|
||||
int sentUtilBytes { 0 };
|
||||
int recievedUtilBytes { 0 };
|
||||
int sentBytes { 0 };
|
||||
int recievedBytes { 0 };
|
||||
|
||||
int sentUnreliablePackets { 0 };
|
||||
int recievedUnreliablePackets { 0 };
|
||||
int sentUnreliableUtilBytes { 0 };
|
||||
int recievedUnreliableUtilBytes { 0 };
|
||||
int sentUnreliableBytes { 0 };
|
||||
int recievedUnreliableBytes { 0 };
|
||||
|
||||
int retransmissions { 0 };
|
||||
int drops { 0 };
|
||||
};
|
||||
|
||||
ConnectionStats();
|
||||
|
@ -54,8 +68,14 @@ public:
|
|||
void recordSentTimeoutNAK();
|
||||
void recordReceivedTimeoutNAK();
|
||||
|
||||
void recordSentPackets();
|
||||
void recordReceivedPackets();
|
||||
void recordSentPackets(int payload, int total);
|
||||
void recordReceivedPackets(int payload, int total);
|
||||
|
||||
void recordUnreliableSentPackets(int payload, int total);
|
||||
void recordUnreliableReceivedPackets(int payload, int total);
|
||||
|
||||
void recordRetransmition();
|
||||
void recordDrop();
|
||||
|
||||
private:
|
||||
Stats _currentSample;
|
||||
|
|
Loading…
Reference in a new issue