From 9648808618bda0b2b0eda07781b62f69dbef6403 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 18 Dec 2023 20:55:11 +0800 Subject: [PATCH] fix(cc): delay need time --- tools/cc/client/ndn-consumer.cpp | 7 ++++--- tools/cc/client/ndn-consumer.hpp | 1 + tools/cc/client/qsccp-consumer.cpp | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/cc/client/ndn-consumer.cpp b/tools/cc/client/ndn-consumer.cpp index d1e442e..964069f 100644 --- a/tools/cc/client/ndn-consumer.cpp +++ b/tools/cc/client/ndn-consumer.cpp @@ -38,8 +38,9 @@ namespace ndn m_traceTimes++; // print rate - std::cout << "cc:rate:<" << m_traceTimes << "," << m_recvBytes << ">" << std::endl; + std::cout << "cc:rate:<" << m_traceTimes << "," << m_recvBytes << ">" << m_nSent << std::endl; m_recvBytes = 0; + m_nSent = 0; } void Consumer::start() @@ -114,9 +115,9 @@ namespace ndn void Consumer::onData(const Data &data, uint64_t seq, const time::steady_clock::TimePoint &sendTime) { auto now = time::steady_clock::now(); - std::cout << "cc:delay:<" << seq << "," << (now - sendTime).count() << ">" << std::endl; + std::cout << "cc:delay:<" << (now - m_startTime).count() << "," << seq << "," << (now - sendTime).count() << ">" << std::endl; - afterData(seq, time::steady_clock::now() - sendTime); + afterData(seq, now - sendTime); m_recvBytes += data.wireEncode().size(); // finish(); } diff --git a/tools/cc/client/ndn-consumer.hpp b/tools/cc/client/ndn-consumer.hpp index 7195861..ee39211 100644 --- a/tools/cc/client/ndn-consumer.hpp +++ b/tools/cc/client/ndn-consumer.hpp @@ -74,6 +74,7 @@ namespace ndn uint64_t m_recvBytes; uint64_t m_traceTimes; + time::steady_clock::TimePoint m_startTime; /// @cond include_hidden /** * \struct This struct contains sequence numbers of packets to be retransmitted diff --git a/tools/cc/client/qsccp-consumer.cpp b/tools/cc/client/qsccp-consumer.cpp index 546185f..5fbda83 100644 --- a/tools/cc/client/qsccp-consumer.cpp +++ b/tools/cc/client/qsccp-consumer.cpp @@ -80,6 +80,7 @@ namespace ndn } if (this->m_firstTime) { + m_startTime = time::steady_clock::now(); this->m_firstTime = false; if (this->fixedRate > 0) @@ -114,6 +115,7 @@ namespace ndn void QsccpConsumer::sendPacket() { + scheduleNextPacket(); // send packet here uint32_t seq = std::numeric_limits::max(); // invalid while (m_retxSeqs.size()) @@ -152,8 +154,6 @@ namespace ndn ++m_nSent; ++m_nOutstanding; - - scheduleNextPacket(); } } }