Skip to content

Commit

Permalink
[core] Renamed m_iRTT variable to m_iSRTT (#1971)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbakholdina authored Apr 29, 2021
1 parent d898f1c commit 782a27f
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 87 deletions.
19 changes: 4 additions & 15 deletions docs/API/statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,21 +539,10 @@ at that moment.

#### msRTT

Calculated Round trip time (RTT), in milliseconds. Sender and Receiver. \
The value is calculated by the receiver based on the incoming ACKACK control packets
(used by sender to acknowledge ACKs from receiver).

The RTT (Round-Trip time) is the sum of two STT (Single-Trip time)
values, one from agent to peer, and one from peer to agent. Note that **the
measurement method is different than in TCP**. SRT measures only the "reverse
RTT", that is, the time measured at the receiver between sending a `UMSG_ACK`
message until receiving the sender's `UMSG_ACKACK` response message (with the
same journal). This happens to be a little different from the "forward RTT"
measured in TCP, which is the time between sending a data packet of a particular
sequence number and receiving `UMSG_ACK` with a sequence number that is later
by 1. Forward RTT isn't being measured or reported in SRT, although some
research works have shown that these values, even though they should be the same,
happen to differ; "reverse RTT" seems to be more optimistic.
Smoothed round-trip time (SRTT), an exponentially-weighted moving average (EWMA) of an endpoint's RTT samples, in milliseconds.
Available both for sender and receiver.

See [Section 4.10. Round-Trip Time Estimation](https://tools.ietf.org/html/draft-sharabayko-srt-00#section-4.10) of the [SRT RFC](https://datatracker.ietf.org/doc/html/draft-sharabayko-srt-00) and [[RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, "Computing TCP's Retransmission Timer"](https://datatracker.ietf.org/doc/html/rfc6298) for more details.

#### mbpsBandwidth

Expand Down
28 changes: 14 additions & 14 deletions srtcore/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ using namespace std;
CInfoBlock& CInfoBlock::copyFrom(const CInfoBlock& obj)
{
std::copy(obj.m_piIP, obj.m_piIP + 4, m_piIP);
m_iIPversion = obj.m_iIPversion;
m_ullTimeStamp = obj.m_ullTimeStamp;
m_iRTT = obj.m_iRTT;
m_iBandwidth = obj.m_iBandwidth;
m_iLossRate = obj.m_iLossRate;
m_iIPversion = obj.m_iIPversion;
m_ullTimeStamp = obj.m_ullTimeStamp;
m_iSRTT = obj.m_iSRTT;
m_iBandwidth = obj.m_iBandwidth;
m_iLossRate = obj.m_iLossRate;
m_iReorderDistance = obj.m_iReorderDistance;
m_dInterval = obj.m_dInterval;
m_dCWnd = obj.m_dCWnd;
m_dInterval = obj.m_dInterval;
m_dCWnd = obj.m_dCWnd;

return *this;
}
Expand All @@ -84,14 +84,14 @@ CInfoBlock* CInfoBlock::clone()
CInfoBlock* obj = new CInfoBlock;

std::copy(m_piIP, m_piIP + 4, obj->m_piIP);
obj->m_iIPversion = m_iIPversion;
obj->m_ullTimeStamp = m_ullTimeStamp;
obj->m_iRTT = m_iRTT;
obj->m_iBandwidth = m_iBandwidth;
obj->m_iLossRate = m_iLossRate;
obj->m_iIPversion = m_iIPversion;
obj->m_ullTimeStamp = m_ullTimeStamp;
obj->m_iSRTT = m_iSRTT;
obj->m_iBandwidth = m_iBandwidth;
obj->m_iLossRate = m_iLossRate;
obj->m_iReorderDistance = m_iReorderDistance;
obj->m_dInterval = m_dInterval;
obj->m_dCWnd = m_dCWnd;
obj->m_dInterval = m_dInterval;
obj->m_dCWnd = m_dCWnd;

return obj;
}
Expand Down
18 changes: 9 additions & 9 deletions srtcore/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@ template<typename T> class CCache
class CInfoBlock
{
public:
uint32_t m_piIP[4]; // IP address, machine read only, not human readable format
int m_iIPversion; // Address family: AF_INET or AF_INET6
uint64_t m_ullTimeStamp; // last update time
int m_iRTT; // RTT
int m_iBandwidth; // estimated bandwidth
int m_iLossRate; // average loss rate
int m_iReorderDistance; // packet reordering distance
double m_dInterval; // inter-packet time, congestion control
double m_dCWnd; // congestion window size, congestion control
uint32_t m_piIP[4]; // IP address, machine read only, not human readable format.
int m_iIPversion; // Address family: AF_INET or AF_INET6.
uint64_t m_ullTimeStamp; // Last update time.
int m_iSRTT; // Smoothed RTT.
int m_iBandwidth; // Estimated link bandwidth.
int m_iLossRate; // Average loss rate.
int m_iReorderDistance; // Packet reordering distance.
double m_dInterval; // Inter-packet time (Congestion Control).
double m_dCWnd; // Congestion window size (Congestion Control).

public:
CInfoBlock() {} // NOTE: leaves uninitialized
Expand Down
2 changes: 1 addition & 1 deletion srtcore/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ enum ETransmissionEvent
{
TEV_INIT, // --> After creation, and after any parameters were updated.
TEV_ACK, // --> When handling UMSG_ACK - older CCC:onAck()
TEV_ACKACK, // --> UDT does only RTT sync, can be read from CUDT::RTT().
TEV_ACKACK, // --> UDT does only RTT sync, can be read from CUDT::SRTT().
TEV_LOSSREPORT, // --> When handling UMSG_LOSSREPORT - older CCC::onLoss()
TEV_CHECKTIMER, // --> See TEV_CHT_REXMIT
TEV_SEND, // --> When the packet is scheduled for sending - older CCC::onPktSent
Expand Down
18 changes: 9 additions & 9 deletions srtcore/congctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ class FileCC : public SrtCongestionControlBase
}
else
{
m_dPktSndPeriod = m_dCWndSize / (m_parent->RTT() + m_iRCInterval);
m_dPktSndPeriod = m_dCWndSize / (m_parent->SRTT() + m_iRCInterval);
HLOGC(cclog.Debug, log << "FileCC: UPD (slowstart:ENDED) wndsize="
<< m_dCWndSize << "/" << m_dMaxCWndSize
<< " sndperiod=" << m_dPktSndPeriod << "us = wndsize/(RTT+RCIV) RTT="
<< m_parent->RTT() << " RCIV=" << m_iRCInterval);
<< m_parent->SRTT() << " RCIV=" << m_iRCInterval);
}
}
else
Expand All @@ -374,9 +374,9 @@ class FileCC : public SrtCongestionControlBase
}
else
{
m_dCWndSize = m_parent->deliveryRate() / 1000000.0 * (m_parent->RTT() + m_iRCInterval) + 16;
m_dCWndSize = m_parent->deliveryRate() / 1000000.0 * (m_parent->SRTT() + m_iRCInterval) + 16;
HLOGC(cclog.Debug, log << "FileCC: UPD (speed mode) wndsize="
<< m_dCWndSize << "/" << m_dMaxCWndSize << " RTT = " << m_parent->RTT()
<< m_dCWndSize << "/" << m_dMaxCWndSize << " RTT = " << m_parent->SRTT()
<< " sndperiod=" << m_dPktSndPeriod << "us. deliverRate = "
<< m_parent->deliveryRate() << " pkts/s)");
}
Expand Down Expand Up @@ -481,17 +481,17 @@ class FileCC : public SrtCongestionControlBase
}
else
{
m_dPktSndPeriod = m_dCWndSize / (m_parent->RTT() + m_iRCInterval);
m_dPktSndPeriod = m_dCWndSize / (m_parent->SRTT() + m_iRCInterval);
HLOGC(cclog.Debug, log << "FileCC: LOSS, SLOWSTART:OFF, sndperiod=" << m_dPktSndPeriod << "us AS wndsize/(RTT+RCIV) (RTT="
<< m_parent->RTT() << " RCIV=" << m_iRCInterval << ")");
<< m_parent->SRTT() << " RCIV=" << m_iRCInterval << ")");
}

}

m_bLoss = true;

// TODO: const int pktsInFlight = CSeqNo::seqoff(m_iLastAck, m_parent->sndSeqNo());
const int pktsInFlight = m_parent->RTT() / m_dPktSndPeriod;
const int pktsInFlight = m_parent->SRTT() / m_dPktSndPeriod;
const int numPktsLost = m_parent->sndLossLength();
const int lost_pcent_x10 = pktsInFlight > 0 ? (numPktsLost * 1000) / pktsInFlight : 0;

Expand Down Expand Up @@ -581,9 +581,9 @@ class FileCC : public SrtCongestionControlBase
}
else
{
m_dPktSndPeriod = m_dCWndSize / (m_parent->RTT() + m_iRCInterval);
m_dPktSndPeriod = m_dCWndSize / (m_parent->SRTT() + m_iRCInterval);
HLOGC(cclog.Debug, log << "FileCC: CHKTIMER, SLOWSTART:OFF, sndperiod=" << m_dPktSndPeriod << "us AS wndsize/(RTT+RCIV) (wndsize="
<< setprecision(6) << m_dCWndSize << " RTT=" << m_parent->RTT() << " RCIV=" << m_iRCInterval << ")");
<< setprecision(6) << m_dCWndSize << " RTT=" << m_parent->SRTT() << " RCIV=" << m_iRCInterval << ")");
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion srtcore/congctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class SrtCongestionControlBase
//int m_iMSS; // NOT REQUIRED. Use m_parent->MSS() instead.
//int32_t m_iSndCurrSeqNo; // NOT REQUIRED. Use m_parent->sndSeqNo().
//int m_iRcvRate; // NOT REQUIRED. Use m_parent->deliveryRate() instead.
//int m_RTT; // NOT REQUIRED. Use m_parent->RTT() instead.
//int m_RTT; // NOT REQUIRED. Use m_parent->SRTT() instead.
//char* m_pcParam; // Used to access m_llMaxBw. Use m_parent->maxBandwidth() instead.

// Constructor in protected section so that this class is semi-abstract.
Expand Down
Loading

0 comments on commit 782a27f

Please sign in to comment.