catchunks: adapt to recent RttEstimator API changes

Refs: #4887
Change-Id: Ie39a1c5f7ad8b225397f41bb0f3c4d7c2a9cdb2a
This commit is contained in:
Davide Pesavento committed 2019-06-26 22:48:14 -04:00
1 parent 0353bae5f6
commit ba56066683
7 files changed
+48 -42

No files matched your search

+5 -3
View File
@@ -78,8 +78,10 @@ private:
rttOptions.alpha = 0.125;
rttOptions.beta = 0.25;
rttOptions.k = 4;
rttOptions.minRto = RttEstimator::MillisecondsDouble(200);
rttOptions.maxRto = RttEstimator::MillisecondsDouble(4000);
rttOptions.initialRto = 1_s;
rttOptions.minRto = 200_ms;
rttOptions.maxRto = 4_s;
rttOptions.rtoBackoffMultiplier = 2;
return rttOptions;
}
@@ -87,7 +89,7 @@ protected:
PipelineInterestsAdaptive::Options opt;
RttEstimator rttEstimator;
PipelineInterestsAdaptive* pipeline;
static constexpr double MARGIN = 0.01;
static constexpr double MARGIN = 0.001;
};
constexpr double PipelineInterestAimdFixture::MARGIN;
+5 -3
View File
@@ -80,8 +80,10 @@ private:
rttOptions.alpha = 0.125;
rttOptions.beta = 0.25;
rttOptions.k = 8;
rttOptions.minRto = RttEstimator::MillisecondsDouble(200);
rttOptions.maxRto = RttEstimator::MillisecondsDouble(4000);
rttOptions.initialRto = 1_s;
rttOptions.minRto = 200_ms;
rttOptions.maxRto = 4_s;
rttOptions.rtoBackoffMultiplier = 2;
return rttOptions;
}
@@ -89,7 +91,7 @@ protected:
PipelineInterestsCubic::Options opt;
RttEstimator rttEstimator;
PipelineInterestsCubic* pipeline;
static constexpr double MARGIN = 0.01;
static constexpr double MARGIN = 0.001;
};
constexpr double PipelineInterestCubicFixture::MARGIN;
+21 -19
View File
@@ -53,13 +53,12 @@ main(int argc, char* argv[])
size_t maxPipelineSize(1);
std::string uri;
// congestion control parameters, CWA refers to conservative window adaptation,
// i.e. only reduce window size at most once per RTT
// congestion control parameters
bool disableCwa(false), resetCwndToInit(false),
ignoreCongMarks(false), enableFastConv(false);
double aiStep(1.0), rtoAlpha(0.125), rtoBeta(0.25), minRto(200.0), maxRto(4000.0),
aimdBeta(0.5), cubicBeta(0.7);
int initCwnd(1), initSsthresh(std::numeric_limits<int>::max()), k(8);
double aiStep(1.0), rtoAlpha(0.125), rtoBeta(0.25), aimdBeta(0.5), cubicBeta(0.7);
int64_t minRto(200), maxRto(60000);
std::string cwndPath, rttPath;
namespace po = boost::program_options;
@@ -67,7 +66,7 @@ main(int argc, char* argv[])
basicDesc.add_options()
("help,h", "print this help message and exit")
("pipeline-type,p", po::value<std::string>(&pipelineType)->default_value(pipelineType),
"type of Interest pipeline to use; valid values are: 'fixed', 'aimd', 'cubic'")
"type of Interest pipeline to use; valid values are: 'fixed', 'aimd', 'cubic'")
("fresh,f", po::bool_switch(&options.mustBeFresh), "only return fresh content")
("lifetime,l", po::value<int64_t>()->default_value(options.interestLifetime.count()),
"lifetime of expressed Interests, in milliseconds")
@@ -103,15 +102,15 @@ main(int argc, char* argv[])
("aimd-beta", po::value<double>(&aimdBeta)->default_value(aimdBeta),
"multiplicative decrease factor (AIMD)")
("rto-alpha", po::value<double>(&rtoAlpha)->default_value(rtoAlpha),
"alpha value for rto calculation")
"alpha value for RTO calculation")
("rto-beta", po::value<double>(&rtoBeta)->default_value(rtoBeta),
"beta value for rto calculation")
"beta value for RTO calculation")
("rto-k", po::value<int>(&k)->default_value(k),
"k value for rto calculation")
("min-rto", po::value<double>(&minRto)->default_value(minRto),
"minimum rto value in milliseconds")
("max-rto", po::value<double>(&maxRto)->default_value(maxRto),
"maximum rto value in milliseconds")
"k value for RTO calculation")
("min-rto", po::value<int64_t>(&minRto)->default_value(minRto),
"minimum RTO value in milliseconds")
("max-rto", po::value<int64_t>(&maxRto)->default_value(maxRto),
"maximum RTO value in milliseconds")
("log-cwnd", po::value<std::string>(&cwndPath), "log file for congestion window stats")
("log-rtt", po::value<std::string>(&rttPath), "log file for round-trip time stats")
;
@@ -165,11 +164,11 @@ main(int argc, char* argv[])
}
if (vm.count("discover-version") > 0) {
std::cout << "WARNING: -d option is deprecated and will be removed in the near future" << std::endl;
std::cerr << "WARNING: -d option is deprecated and will be removed in the near future" << std::endl;
}
if (vm.count("discovery-timeout") > 0) {
std::cout << "WARNING: -t option is deprecated and will be removed in the near future" << std::endl;
std::cerr << "WARNING: -t option is deprecated and will be removed in the near future" << std::endl;
}
if (vm.count("version") > 0) {
@@ -223,18 +222,21 @@ main(int argc, char* argv[])
optionsRttEst.alpha = rtoAlpha;
optionsRttEst.beta = rtoBeta;
optionsRttEst.k = k;
optionsRttEst.minRto = RttEstimator::MillisecondsDouble(minRto);
optionsRttEst.maxRto = RttEstimator::MillisecondsDouble(maxRto);
optionsRttEst.initialRto = 1_s;
optionsRttEst.minRto = time::milliseconds(minRto);
optionsRttEst.maxRto = time::milliseconds(maxRto);
optionsRttEst.rtoBackoffMultiplier = 2;
rttEstimator = make_unique<RttEstimator>(optionsRttEst);
if (options.isVerbose) {
using namespace ndn::time;
std::cerr << "RTT estimator parameters:\n"
<< "\tAlpha = " << optionsRttEst.alpha << "\n"
<< "\tBeta = " << optionsRttEst.beta << "\n"
<< "\tK = " << optionsRttEst.k << "\n"
<< "\tInitial RTO = " << optionsRttEst.initialRto << "\n"
<< "\tMin RTO = " << optionsRttEst.minRto << "\n"
<< "\tMax RTO = " << optionsRttEst.maxRto << "\n"
<< "\tInitial RTO = " << duration_cast<milliseconds>(optionsRttEst.initialRto) << "\n"
<< "\tMin RTO = " << duration_cast<milliseconds>(optionsRttEst.minRto) << "\n"
<< "\tMax RTO = " << duration_cast<milliseconds>(optionsRttEst.maxRto) << "\n"
<< "\tBackoff multiplier = " << optionsRttEst.rtoBackoffMultiplier << "\n";
}
@@ -235,11 +235,11 @@ PipelineInterestsAdaptive::handleData(const Interest& interest, const Data& data
}
SegmentInfo& segInfo = segIt->second;
RttEstimator::MillisecondsDouble rtt = time::steady_clock::now() - segInfo.timeSent;
time::nanoseconds rtt = time::steady_clock::now() - segInfo.timeSent;
if (m_options.isVerbose) {
std::cerr << "Received segment #" << recvSegNo
<< ", rtt=" << rtt.count() << "ms"
<< ", rto=" << segInfo.rto.count() << "ms" << std::endl;
<< ", rtt=" << rtt.count() / 1e6 << "ms"
<< ", rto=" << segInfo.rto.count() / 1e6 << "ms" << std::endl;
}
if (m_highData < recvSegNo) {
@@ -418,19 +418,19 @@ PipelineInterestsAdaptive::printSummary() const
std::cerr << "Congestion marks: " << m_nCongMarks << " (caused " << m_nMarkDecr << " window decreases)\n"
<< "Timeouts: " << m_nTimeouts << " (caused " << m_nLossDecr << " window decreases)\n"
<< "Retransmitted segments: " << m_nRetransmitted
<< " (" << (m_nSent == 0 ? 0 : (static_cast<double>(m_nRetransmitted) / m_nSent * 100.0)) << "%)"
<< " (" << (m_nSent == 0 ? 0 : (m_nRetransmitted * 100.0 / m_nSent)) << "%)"
<< ", skipped: " << m_nSkippedRetx << "\n"
<< "RTT ";
if (m_rttEstimator.getMinRtt().count() == std::numeric_limits<double>::max() ||
m_rttEstimator.getMaxRtt().count() == std::numeric_limits<double>::min()) {
if (m_rttEstimator.getMinRtt() == time::nanoseconds::max() ||
m_rttEstimator.getMaxRtt() == time::nanoseconds::min()) {
std::cerr << "stats unavailable\n";
}
else {
std::cerr << "min/avg/max = " << std::fixed << std::setprecision(3)
<< m_rttEstimator.getMinRtt().count() << "/"
<< m_rttEstimator.getAvgRtt().count() << "/"
<< m_rttEstimator.getMaxRtt().count() << " ms\n";
<< m_rttEstimator.getMinRtt().count() / 1e6 << "/"
<< m_rttEstimator.getAvgRtt().count() / 1e6 << "/"
<< m_rttEstimator.getMaxRtt().count() / 1e6 << " ms\n";
}
}
@@ -84,7 +84,7 @@ struct SegmentInfo
{
ScopedPendingInterestHandle interestHdl;
time::steady_clock::TimePoint timeSent;
RttEstimator::MillisecondsDouble rto;
time::nanoseconds rto;
SegmentState state;
};
@@ -133,13 +133,13 @@ void
PipelineInterests::printSummary() const
{
using namespace ndn::time;
duration<double, milliseconds::period> timeElapsed = steady_clock::now() - getStartTime();
double throughput = (8 * m_receivedSize * 1000) / timeElapsed.count();
duration<double, seconds::period> timeElapsed = steady_clock::now() - getStartTime();
double throughput = 8 * m_receivedSize / timeElapsed.count();
std::cerr << "\n\nAll segments have been received.\n"
<< "Time elapsed: " << timeElapsed << "\n"
<< "Segments received: " << m_nReceived << "\n"
<< "Total size: " << static_cast<double>(m_receivedSize) / 1000 << "kB" << "\n"
<< "Transferred size: " << m_receivedSize / 1e3 << " kB" << "\n"
<< "Goodput: " << formatThroughput(throughput) << "\n";
}
@@ -42,10 +42,10 @@ StatisticsCollector::StatisticsCollector(PipelineInterestsAdaptive& pipeline,
rttEstimator.afterMeasurement.connect(
[this] (const RttEstimator::Sample& sample) {
m_osRtt << *sample.segNum << '\t'
<< sample.rtt.count() << '\t'
<< sample.rttVar.count() << '\t'
<< sample.sRtt.count() << '\t'
<< sample.rto.count() << '\n';
<< sample.rtt.count() / 1e6 << '\t'
<< sample.rttVar.count() / 1e6 << '\t'
<< sample.sRtt.count() / 1e6 << '\t'
<< sample.rto.count() / 1e6 << '\n';
});
}