OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ | 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ |
12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ | 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <vector> | |
15 | 16 |
16 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
17 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" |
19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
22 namespace testing { | 23 namespace testing { |
23 namespace bwe { | 24 namespace bwe { |
24 | 25 |
25 class PacketReceiver : public PacketProcessor { | 26 class PacketReceiver : public PacketProcessor { |
26 public: | 27 public: |
27 PacketReceiver(PacketProcessorListener* listener, | 28 PacketReceiver(PacketProcessorListener* listener, |
28 int flow_id, | 29 int flow_id, |
29 BandwidthEstimatorType bwe_type, | 30 BandwidthEstimatorType bwe_type, |
30 bool plot_delay, | 31 bool plot_delay, |
31 bool plot_bwe); | 32 bool plot_bwe); |
32 ~PacketReceiver(); | 33 ~PacketReceiver(); |
33 | 34 |
34 // Implements PacketProcessor. | 35 // Implements PacketProcessor. |
35 void RunFor(int64_t time_ms, Packets* in_out) override; | 36 void RunFor(int64_t time_ms, Packets* in_out) override; |
36 | 37 |
37 void LogStats(); | 38 void LogStats(); |
38 | 39 |
39 Stats<double> GetDelayStats() const; | 40 Stats<double> GetDelayStats() const; |
40 | 41 |
42 void PlotThroughputHistogram(const std::string& title, | |
43 const std::string& bwe_name, | |
44 int num_flows, | |
45 int64_t extra_offset_ms); | |
46 void PlotThroughputHistogram(const std::string& title, | |
47 const std::string& bwe_name, | |
48 int num_flows, | |
49 int64_t extra_offset_ms, | |
50 const std::string optimum_id); | |
51 void PlotDelayHistogram(const std::string& title, | |
52 const std::string& bwe_name, | |
53 int num_flows); | |
54 void PlotLossHistogram(const std::string& title, | |
55 const std::string& bwe_name, | |
56 int num_flows); | |
57 void PlotObjectiveHistogram(const std::string& title, | |
58 const std::string& bwe_name, | |
59 int num_flows); | |
60 | |
61 void set_start_computing_metrics_ms(int64_t start_computing_metrics_ms) { | |
62 start_computing_metrics_ms_ = start_computing_metrics_ms; | |
63 } | |
64 | |
65 void set_plot_available_capacity(bool plot) { | |
66 plot_total_available_capacity_ = plot; | |
67 } | |
68 | |
41 protected: | 69 protected: |
42 void PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms); | 70 void PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms); |
71 void PlotThroughput(int64_t arrival_time_ms); | |
72 void PlotTotalAvailableCapacity(int64_t arrival_time_ms); | |
73 void PlotAvailableCapacityPerFlow(int64_t arrival_time_ms); | |
43 void PlotObjectiveFunction(int64_t arrival_time_ms); | 74 void PlotObjectiveFunction(int64_t arrival_time_ms); |
44 void PlotPacketLoss(int64_t arrival_time_ms); | 75 void PlotPacketLoss(int64_t arrival_time_ms); |
45 double ObjectiveFunction(); | 76 double ObjectiveFunction(); |
46 | 77 |
47 int64_t now_ms_; | 78 int64_t now_ms_; |
48 std::string delay_log_prefix_; | 79 std::string delay_log_prefix_; |
49 std::string metric_log_prefix_; | 80 std::string metric_log_prefix_; |
50 std::string packet_loss_log_prefix_; | 81 std::string packet_loss_log_prefix_; |
82 std::string available_capacity_log_prefix_; | |
83 std::string throughput_log_prefix_; | |
51 int64_t last_delay_plot_ms_; | 84 int64_t last_delay_plot_ms_; |
85 int64_t last_throughput_plot_ms_; | |
52 int64_t last_metric_plot_ms_; | 86 int64_t last_metric_plot_ms_; |
53 int64_t last_packet_loss_plot_ms_; | 87 int64_t last_packet_loss_plot_ms_; |
88 int64_t last_total_capacity_plot_ms_; | |
89 int64_t last_per_flow_capacity_plot_ms_; | |
stefan-webrtc
2015/06/25 14:44:05
We should group the string with the last plot time
magalhaesc
2015/07/01 12:48:41
Plot time and bool were moved to MetricRecorder, w
| |
54 bool plot_delay_; | 90 bool plot_delay_; |
91 bool plot_throughput_; | |
55 bool plot_objective_function_; | 92 bool plot_objective_function_; |
56 bool plot_packet_loss_; | 93 bool plot_packet_loss_; |
94 bool plot_total_available_capacity_; | |
95 bool plot_available_capacity_per_flow_; | |
57 Stats<double> delay_stats_; | 96 Stats<double> delay_stats_; |
58 rtc::scoped_ptr<BweReceiver> bwe_receiver_; | 97 rtc::scoped_ptr<BweReceiver> bwe_receiver_; |
59 | 98 |
60 int64_t total_delay_ms_; | 99 private: |
61 size_t total_throughput_; | 100 double Renormalize(double x); |
62 int number_packets_; | 101 std::vector<int64_t> delays_ms_; |
102 std::vector<size_t> throughput_bytes_; | |
103 // (Receiving rate - available bitrate per flow) * time window. | |
104 std::vector<int64_t> weighted_estimate_error_; | |
105 int64_t last_unweighted_estimate_error_; | |
106 int64_t optimal_throughput_bits_; | |
107 uint32_t last_total_available_bitrate_kbps_; | |
108 int64_t last_available_bitrate_per_flow_kbps_; | |
109 int64_t start_computing_metrics_ms_; | |
110 bool started_computing_metrics_; | |
111 std::string alg_name_; | |
63 | 112 |
64 private: | |
65 DISALLOW_IMPLICIT_CONSTRUCTORS(PacketReceiver); | 113 DISALLOW_IMPLICIT_CONSTRUCTORS(PacketReceiver); |
66 }; | 114 }; |
67 } // namespace bwe | 115 } // namespace bwe |
68 } // namespace testing | 116 } // namespace testing |
69 } // namespace webrtc | 117 } // namespace webrtc |
70 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ | 118 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ |
OLD | NEW |