10#include "ns3/simulator.h"
31 TypeId(
"ns3::TcpRateLinux")
33 .SetGroupName(
"Internet")
34 .AddTraceSource(
"TcpRateUpdated",
35 "Tcp rate information has been updated",
37 "ns3::TcpRateLinux::TcpRateUpdated")
38 .AddTraceSource(
"TcpRateSampleUpdated",
39 "Tcp rate sample has been updated",
41 "ns3::TcpRateLinux::TcpRateSampleUpdated");
61 NS_LOG_INFO(
"Updating RateSample m_ackedSacked=" << delivered <<
", m_bytesLoss=" << lost
62 <<
" and m_priorInFlight" << priorInFlight);
74 NS_LOG_INFO(
"PriorTime is zero, invalidating sample");
142 if (tailSeq - nextTx <
145 && lostOut <= retransOut)
160 m_rate.m_appLimited = std::max<uint32_t>(
m_rate.m_delivered + in_flight, 1);
221 if (isStartOfTransmission)
238 os <<
"m_delivered = " << rate.
m_delivered << std::endl;
241 os <<
"m_appLimited = " << rate.
m_appLimited << std::endl;
254 os <<
" m_interval = " << sample.
m_interval << std::endl;
255 os <<
" m_delivered = " << sample.
m_delivered << std::endl;
257 os <<
" m_priorTime = " << sample.
m_priorTime << std::endl;
258 os <<
" m_sendElapsed = " << sample.
m_sendElapsed << std::endl;
259 os <<
" m_ackElapsed = " << sample.
m_ackElapsed << std::endl;
260 os <<
" m_bytesLoss = " << sample.
m_bytesLoss << std::endl;
262 os <<
" m_ackedSacked = " << sample.
m_ackedSacked << std::endl;
Class for representing data rates.
static Time Now()
Return the current simulation virtual time.
Linux management and generation of Rate information for TCP.
TracedCallback< const TcpRateConnection & > m_rateTrace
Rate trace.
void SkbDelivered(TcpTxItem *skb) override
Update the Rate information after an item is received.
TracedCallback< const TcpRateSample & > m_rateSampleTrace
Rate Sample trace.
TcpRateSample m_rateSample
Rate sample (continuously updated)
TcpRateConnection m_rate
Rate information.
void SkbSent(TcpTxItem *skb, bool isStartOfTransmission) override
Put the rate information inside the sent skb.
const TcpRateSample & GenerateSample(uint32_t delivered, uint32_t lost, bool is_sack_reneg, uint32_t priorInFlight, const Time &minRtt) override
Generate a TcpRateSample to feed a congestion avoidance algorithm.
void SetAppLimited(uint32_t in_flight) override
Updates the app-limited state based on in-flight data.
static TypeId GetTypeId()
Get the type ID.
void CalculateAppLimited(uint32_t cWnd, uint32_t in_flight, uint32_t segmentSize, const SequenceNumber32 &tailSeq, const SequenceNumber32 &nextTx, const uint32_t lostOut, const uint32_t retransOut) override
If a gap is detected between sends, it means we are app-limited.
Interface for all operations that involve a Rate monitoring for TCP.
static TypeId GetTypeId()
Get the type ID.
Item that encloses the application packet and some flags for it.
uint32_t GetSeqSize() const
Get the size in the sequence number space.
const Time & GetLastSent() const
Get a reference to the time the packet was sent for the last time.
RateInformation & GetRateInformation()
Get (to modify) the Rate Information of this item.
Simulation virtual time values and global simulation resolution.
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator==(const EventId &a, const EventId &b)
std::ostream & operator<<(std::ostream &os, const Angles &a)
Information about the connection rate.
uint32_t m_txItemDelivered
The value of delivered when the acked item was sent.
Time m_deliveredTime
Simulator time when m_delivered was last updated.
int32_t m_rateDelivered
The amount of data delivered considered to calculate delivery rate.
uint64_t m_delivered
The total amount of data in bytes delivered so far.
uint32_t m_appLimited
The index of the last transmitted packet marked as application-limited.
bool m_rateAppLimited
Was sample was taken when data is app limited?
Time m_firstSentTime
The send time of the packet that was most recently marked as delivered.
Time m_rateInterval
The value of interval considered to calculate delivery rate.
Time m_ackElapsed
ACK time interval calculated from the most recent packet delivered.
bool m_isAppLimited
Indicates whether the rate sample is application-limited.
uint32_t m_ackedSacked
The amount of data acked and sacked in the last received ack.
DataRate m_deliveryRate
The delivery rate sample.
uint32_t m_priorInFlight
The value if bytes in flight prior to last received ack.
Time m_sendElapsed
Send time interval calculated from the most recent packet delivered.
Time m_interval
The length of the sampling interval.
uint32_t m_priorDelivered
The delivered count of the most recent packet delivered.
int32_t m_delivered
The amount of data marked as delivered over the sampling interval.
uint32_t m_bytesLoss
The amount of data marked as lost from the most recent ack received.
Time m_priorTime
The delivered time of the most recent packet delivered.