Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: net/quic/congestion_control/rtt_stats.cc

Issue 2125303002: Use overloaded operators with QuicTime for addition, subtraction and scalar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@126402784
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/congestion_control/pacing_sender.cc ('k') | net/quic/congestion_control/rtt_stats_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/congestion_control/rtt_stats.cc
diff --git a/net/quic/congestion_control/rtt_stats.cc b/net/quic/congestion_control/rtt_stats.cc
index 4809f1ad510786c1c540e891c36e8193028cb44a..9d31caaa3889d7528508c6e2c6990c7a2abd337d 100644
--- a/net/quic/congestion_control/rtt_stats.cc
+++ b/net/quic/congestion_control/rtt_stats.cc
@@ -46,10 +46,9 @@ void RttStats::SampleNewWindowedMinRtt(uint32_t num_samples) {
}
void RttStats::ExpireSmoothedMetrics() {
- mean_deviation_ =
- max(mean_deviation_,
- QuicTime::Delta::FromMicroseconds(
- std::abs(smoothed_rtt_.Subtract(latest_rtt_).ToMicroseconds())));
+ mean_deviation_ = max(mean_deviation_,
+ QuicTime::Delta::FromMicroseconds(std::abs(
+ (smoothed_rtt_ - latest_rtt_).ToMicroseconds())));
smoothed_rtt_ = max(smoothed_rtt_, latest_rtt_);
}
@@ -80,7 +79,7 @@ void RttStats::UpdateRtt(QuicTime::Delta send_delta,
previous_srtt_ = smoothed_rtt_;
if (rtt_sample > ack_delay) {
- rtt_sample = rtt_sample.Subtract(ack_delay);
+ rtt_sample = rtt_sample - ack_delay;
}
latest_rtt_ = rtt_sample;
// First time call.
@@ -91,9 +90,8 @@ void RttStats::UpdateRtt(QuicTime::Delta send_delta,
} else {
mean_deviation_ = QuicTime::Delta::FromMicroseconds(static_cast<int64_t>(
kOneMinusBeta * mean_deviation_.ToMicroseconds() +
- kBeta * std::abs(smoothed_rtt_.Subtract(rtt_sample).ToMicroseconds())));
- smoothed_rtt_ =
- smoothed_rtt_.Multiply(kOneMinusAlpha).Add(rtt_sample.Multiply(kAlpha));
+ kBeta * std::abs((smoothed_rtt_ - rtt_sample).ToMicroseconds())));
+ smoothed_rtt_ = kOneMinusAlpha * smoothed_rtt_ + kAlpha * rtt_sample;
DVLOG(1) << " smoothed_rtt(us):" << smoothed_rtt_.ToMicroseconds()
<< " mean_deviation(us):" << mean_deviation_.ToMicroseconds();
}
« no previous file with comments | « net/quic/congestion_control/pacing_sender.cc ('k') | net/quic/congestion_control/rtt_stats_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698