Printing internal state of GoogCC.

This is useful for debugging and has minimal effect on production code.

Bug: webrtc:9510
Change-Id: I3a71f484a0d4e54999e376b7924b73230d86cd96
Reviewed-on: https://webrtc-review.googlesource.com/97607
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24557}
This commit is contained in:
Sebastian Jansson 2018-09-04 18:55:14 +02:00 committed by Commit Bot
parent 9de4ef4b24
commit d0e0ec959f
8 changed files with 25 additions and 1 deletions

View File

@ -147,6 +147,7 @@ if (rtc_include_tests) {
"test/goog_cc_printer.h",
]
deps = [
":estimators",
":goog_cc",
"..:test_controller_printer",
]

View File

@ -55,6 +55,7 @@ class AlrDetector {
void UpdateBudgetWithBytesSent(size_t bytes_sent);
private:
friend class GoogCcStatePrinter;
int bandwidth_usage_percent_;
int alr_start_budget_level_percent_;
int alr_stop_budget_level_percent_;

View File

@ -56,6 +56,7 @@ class DelayBasedBwe {
int64_t GetExpectedBwePeriodMs() const;
private:
friend class GoogCcStatePrinter;
void IncomingPacketFeedback(const PacketFeedback& packet_feedback,
int64_t at_time_ms);
Result OnLongFeedbackDelay(int64_t arrival_time_ms);

View File

@ -52,6 +52,7 @@ class GoogCcNetworkController : public NetworkControllerInterface {
NetworkControlUpdate GetNetworkState(Timestamp at_time) const;
private:
friend class GoogCcStatePrinter;
std::vector<ProbeClusterConfig> UpdateBitrateConstraints(
TargetRateConstraints constraints,
absl::optional<DataRate> starting_rate);

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/congestion_controller/goog_cc/test/goog_cc_printer.h"
#include "modules/congestion_controller/goog_cc/trendline_estimator.h"
namespace webrtc {
GoogCcStatePrinter::GoogCcStatePrinter() = default;
@ -21,10 +23,23 @@ bool GoogCcStatePrinter::Attached() const {
return controller_ != nullptr;
}
void GoogCcStatePrinter::PrintHeaders(FILE* out) {}
void GoogCcStatePrinter::PrintHeaders(FILE* out) {
fprintf(out,
"rate_control_state rate_control_region alr_state"
" trendline trendline_modified_offset trendline_offset_threshold");
}
void GoogCcStatePrinter::PrintValues(FILE* out) {
RTC_CHECK(controller_);
auto* detector = controller_->delay_based_bwe_->delay_detector_.get();
auto* trendline_estimator = reinterpret_cast<TrendlineEstimator*>(detector);
fprintf(out, "%i %i %i %.6lf %.6lf %.6lf",
controller_->delay_based_bwe_->rate_control_.rate_control_state_,
controller_->delay_based_bwe_->rate_control_.rate_control_region_,
controller_->alr_detector_->alr_started_time_ms_.has_value(),
trendline_estimator->trendline_,
trendline_estimator->prev_modified_offset_,
trendline_estimator->threshold_);
}
NetworkControlUpdate GoogCcStatePrinter::GetState(Timestamp at_time) const {

View File

@ -70,6 +70,7 @@ TrendlineEstimator::TrendlineEstimator(size_t window_size,
k_down_(0.039),
overusing_time_threshold_(kOverUsingTimeThreshold),
threshold_(12.5),
prev_modified_offset_(NAN),
last_update_ms_(-1),
prev_offset_(0.0),
time_over_using_(-1),
@ -162,6 +163,7 @@ void TrendlineEstimator::Detect(double offset,
void TrendlineEstimator::UpdateThreshold(double modified_offset,
int64_t now_ms) {
prev_modified_offset_ = modified_offset;
if (last_update_ms_ == -1)
last_update_ms_ = now_ms;

View File

@ -53,6 +53,7 @@ class TrendlineEstimator : public DelayIncreaseDetectorInterface {
unsigned int num_of_deltas() const { return num_of_deltas_; }
private:
friend class GoogCcStatePrinter;
void Detect(double offset,
double ts_delta,
int num_of_deltas,
@ -79,6 +80,7 @@ class TrendlineEstimator : public DelayIncreaseDetectorInterface {
const double k_down_;
double overusing_time_threshold_;
double threshold_;
double prev_modified_offset_;
int64_t last_update_ms_;
double prev_offset_;
double time_over_using_;

View File

@ -54,6 +54,7 @@ class AimdRateControl {
int GetExpectedBandwidthPeriodMs() const;
private:
friend class GoogCcStatePrinter;
// Update the target bitrate based on, among other things, the current rate
// control state, the current target bitrate and the estimated throughput.
// When in the "increase" state the bitrate will be increased either