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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h

Issue 1202253003: More Simulation Framework features (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed Created 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_METRIC_RECORDER_H_
12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_METRIC_RECORDER_H_
13
14 #include <string>
15 #include <vector>
16
17 #include "webrtc/base/common.h"
18 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
19
20 namespace webrtc {
21 namespace testing {
22 namespace bwe {
23
24 class MetricRecorder {
25 public:
26 MetricRecorder(const std::string algorithm_name,
27 int flow_id,
28 PacketSender* packet_sender,
29 ChokeFilter* choke_filter);
30
31 void PlotLine(int windows_id,
32 const std::string& prefix,
33 int64_t x,
34 int64_t y);
35
36 void PlotThroughput(const std::string& prefix,
37 int64_t time_ms,
38 int64_t bitrate_kbps);
39
40 void PlotDelay(const std::string& prefix, int64_t time_ms, int64_t delay_ms);
41
42 void PlotLoss(const std::string& prefix, int64_t time_ms, double loss);
43
44 void PlotObjective(const std::string& prefix, int64_t time_ms);
45
46 void PlotTotalAvailableCapacity(const std::string& prefix, int64_t time_ms);
47
48 void PlotAvailableCapacityPerFlow(const std::string& prefix, int64_t time_ms);
49
50 void PlotThroughputHistogram(const std::string& title,
51 const std::string& bwe_name,
52 int num_flows,
53 int64_t extra_offset_ms,
54 const std::string optimum_id);
55
56 void PlotThroughputHistogram(const std::string& title,
57 const std::string& bwe_name,
58 int num_flows,
59 int64_t extra_offset_ms);
60
61 void PlotDelayHistogram(const std::string& title,
62 const std::string& bwe_name,
63 int num_flows);
64
65 void PlotLossHistogram(const std::string& title,
66 const std::string& bwe_name,
67 int num_flows,
68 float global_loss_ratio);
69
70 void PlotObjectiveHistogram(const std::string& title,
71 const std::string& bwe_name,
72 int num_flows);
73
74 // Update time and previous available capacity per flow.
75 void Update(int64_t time_ms);
76
77 void PushDelayMs(int64_t delay_ms, int64_t arrival_time_ms);
78 void PushThroughputBytes(size_t throughput_bytes, int64_t arrival_time_ms);
79
80 void set_start_computing_metrics_ms(int64_t start_computing_metrics_ms) {
81 start_computing_metrics_ms_ = start_computing_metrics_ms;
82 }
83
84 private:
85 uint32_t GetTotalAvailableKbps();
86 uint32_t GetAvailablePerFlowKbps();
87 uint32_t GetSendingEstimateKbps();
88 double ObjectiveFunction();
89
90 double Renormalize(double x);
91 bool ShouldRecord(int64_t arrival_time_ms);
92
93 enum Metrics {
94 kThroughput = 0,
95 kDelay,
96 kLoss,
97 kObjective,
98 kTotalAvailable,
99 kAvailablePerFlow,
100 kNumMetrics
101 };
102
103 std::string algorithm_name_;
104 int flow_id_;
105 PacketSender* packet_sender_;
106 ChokeFilter* choke_filter_;
107
108 int64_t now_ms_;
109
110 bool plot_[kNumMetrics];
111 int64_t last_plot_ms_[kNumMetrics];
112
113 std::vector<int64_t> delays_ms_;
114 std::vector<size_t> throughput_bytes_;
115 // (Receiving rate - available bitrate per flow) * time window.
116 std::vector<int64_t> weighted_estimate_error_;
117 int64_t last_unweighted_estimate_error_;
118 int64_t optimal_throughput_bits_;
119 int64_t last_available_bitrate_per_flow_kbps_;
120 int64_t start_computing_metrics_ms_;
121 bool started_computing_metrics_;
122 };
123
124 } // namespace bwe
125 } // namespace testing
126 } // namespace webrtc
127 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_METRIC_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698