| Index: webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h
|
| diff --git a/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h b/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3fb5545116b3ecd8659dd6add416511bba790524
|
| --- /dev/null
|
| +++ b/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h
|
| @@ -0,0 +1,127 @@
|
| +/*
|
| + * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license
|
| + * that can be found in the LICENSE file in the root of the source
|
| + * tree. An additional intellectual property rights grant can be found
|
| + * in the file PATENTS. All contributing project authors may
|
| + * be found in the AUTHORS file in the root of the source tree.
|
| + */
|
| +
|
| +#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_METRIC_RECORDER_H_
|
| +#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_METRIC_RECORDER_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "webrtc/base/common.h"
|
| +#include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
|
| +
|
| +namespace webrtc {
|
| +namespace testing {
|
| +namespace bwe {
|
| +
|
| +class MetricRecorder {
|
| + public:
|
| + MetricRecorder(const std::string algorithm_name,
|
| + int flow_id,
|
| + PacketSender* packet_sender,
|
| + ChokeFilter* choke_filter);
|
| +
|
| + void PlotLine(int windows_id,
|
| + const std::string& prefix,
|
| + int64_t x,
|
| + int64_t y);
|
| +
|
| + void PlotThroughput(const std::string& prefix,
|
| + int64_t time_ms,
|
| + int64_t bitrate_kbps);
|
| +
|
| + void PlotDelay(const std::string& prefix, int64_t time_ms, int64_t delay_ms);
|
| +
|
| + void PlotLoss(const std::string& prefix, int64_t time_ms, double loss);
|
| +
|
| + void PlotObjective(const std::string& prefix, int64_t time_ms);
|
| +
|
| + void PlotTotalAvailableCapacity(const std::string& prefix, int64_t time_ms);
|
| +
|
| + void PlotAvailableCapacityPerFlow(const std::string& prefix, int64_t time_ms);
|
| +
|
| + void PlotThroughputHistogram(const std::string& title,
|
| + const std::string& bwe_name,
|
| + int num_flows,
|
| + int64_t extra_offset_ms,
|
| + const std::string optimum_id);
|
| +
|
| + void PlotThroughputHistogram(const std::string& title,
|
| + const std::string& bwe_name,
|
| + int num_flows,
|
| + int64_t extra_offset_ms);
|
| +
|
| + void PlotDelayHistogram(const std::string& title,
|
| + const std::string& bwe_name,
|
| + int num_flows);
|
| +
|
| + void PlotLossHistogram(const std::string& title,
|
| + const std::string& bwe_name,
|
| + int num_flows,
|
| + float global_loss_ratio);
|
| +
|
| + void PlotObjectiveHistogram(const std::string& title,
|
| + const std::string& bwe_name,
|
| + int num_flows);
|
| +
|
| + // Update time and previous available capacity per flow.
|
| + void Update(int64_t time_ms);
|
| +
|
| + void PushDelayMs(int64_t delay_ms, int64_t arrival_time_ms);
|
| + void PushThroughputBytes(size_t throughput_bytes, int64_t arrival_time_ms);
|
| +
|
| + void set_start_computing_metrics_ms(int64_t start_computing_metrics_ms) {
|
| + start_computing_metrics_ms_ = start_computing_metrics_ms;
|
| + }
|
| +
|
| + private:
|
| + uint32_t GetTotalAvailableKbps();
|
| + uint32_t GetAvailablePerFlowKbps();
|
| + uint32_t GetSendingEstimateKbps();
|
| + double ObjectiveFunction();
|
| +
|
| + double Renormalize(double x);
|
| + bool ShouldRecord(int64_t arrival_time_ms);
|
| +
|
| + enum Metrics {
|
| + kThroughput = 0,
|
| + kDelay,
|
| + kLoss,
|
| + kObjective,
|
| + kTotalAvailable,
|
| + kAvailablePerFlow,
|
| + kNumMetrics
|
| + };
|
| +
|
| + std::string algorithm_name_;
|
| + int flow_id_;
|
| + PacketSender* packet_sender_;
|
| + ChokeFilter* choke_filter_;
|
| +
|
| + int64_t now_ms_;
|
| +
|
| + bool plot_[kNumMetrics];
|
| + int64_t last_plot_ms_[kNumMetrics];
|
| +
|
| + std::vector<int64_t> delays_ms_;
|
| + std::vector<size_t> throughput_bytes_;
|
| + // (Receiving rate - available bitrate per flow) * time window.
|
| + std::vector<int64_t> weighted_estimate_error_;
|
| + int64_t last_unweighted_estimate_error_;
|
| + int64_t optimal_throughput_bits_;
|
| + int64_t last_available_bitrate_per_flow_kbps_;
|
| + int64_t start_computing_metrics_ms_;
|
| + bool started_computing_metrics_;
|
| +};
|
| +
|
| +} // namespace bwe
|
| +} // namespace testing
|
| +} // namespace webrtc
|
| +#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_METRIC_RECORDER_H_
|
|
|