SoonyangZhang / ns3-tcp-bbr

implement TCP BBR in ns3.33
GNU General Public License v2.0
35 stars 21 forks source link

Is there an OWD fuction? #3

Closed wlwl1011 closed 1 year ago

wlwl1011 commented 1 year ago

Hello, I was checking out the QUIC code you posted and wanted to compare it to TCP, so I came across that as well! In the QUIC part, there was code for a one way delay, do you have that here too? I didn't find it, so I'm leaving an issue just in case!

If I wanted to add it, could I just add the onowd function to the tcptrace part?

void Ns3QuicServerTrace::OnOwd(int seq,int owd,int len){
    if(m_owd.is_open()||m_goodput.is_open()){
        Time now=Simulator::Now();
        if(Time(0)==m_firstPacketTime){
            m_firstPacketTime=now;
            m_lastRateTime=now;
        }
        m_readBytes+=len;
        if(m_owd.is_open()){
            m_owd<<now.GetSeconds()<<"\t"<<seq<<"\t"<<owd<<"\t"<<len<<std::endl;
            m_receiptTime=now;
        }
        LogGoodput(false);
    }

    if(m_lost.is_open()){
        if(seq>m_lastSeq-1){
            int lost=seq-m_lastSeq-1;
            m_lostPackets+=lost;
        }
        if(seq>m_lastSeq){
            m_lastSeq=seq;
        }
        if(seq>m_largestSeq){
            m_largestSeq=seq;
        }
    }
}
void Ns3QuicServerTrace::OpenOwdFile(const std::string& name){
    std::string path_name=name+"_owd.txt";
    m_owd.open(path_name.c_str(), std::fstream::out);
}

void Ns3QuicServerTraceDispatcher::OnOwd(const InetSocketAddress &c,const InetSocketAddress & s,int seq,int owd,int len){
    Time now=Simulator::Now();
    m_readBytes+=len;
    if(Time(0)==m_firstPacketTime){
        m_firstPacketTime=now;
    }
    m_receiptTime=now;
    Ns3QuicAddressPair addr_pair(c,s);
    auto it=m_traceDb.find(addr_pair);
    if(it!=m_traceDb.end()){
        it->second->OnOwd(seq,owd,len);
    }
}
SoonyangZhang commented 1 year ago

no, you can get rtt in tcp. To get one way delay, I add a tag in Packet, and the length of a packet will not count the tag. https://github.com/SoonyangZhang/quic-on-ns3/blob/main/quic/model/ns3-quic-client-app.cc#L186

wlwl1011 commented 1 year ago

Thanks as always! πŸ˜€πŸ˜€πŸ˜€πŸ˜€ ε₯½θΏοΌοΌοΌ πŸ€πŸ§§πŸ€πŸ§§

wlwl1011 commented 1 year ago

Hola! I was trying to compare the congestion control algorithms of TCP and QUIC, so I tried to add owd in TCP as well as QUIC! But it was too difficult... So I'm thinking of just halving the rtt for TCP and comparing it to QUIC's owd, but is this okay? I'd like to get some advice from someone who knows better than me!

SoonyangZhang commented 1 year ago

yeah, it is ok.