BWE Simulation Framework: Standard plot logging
-- Made plot logging from MetricRecorder and from RateCounterFilter/PacketReceiver standard to fit python and shell plotting scripts likewise.
-- RateCounterFilter is initialized with algorithm name.
-- Removed spare commas and duplicated flow ids from RateCounterFilter name.
-- Added optional plot_delay and plot_loss in MetricRecorder.
-- PacketReceiver can plot directly plot delay if there is no metric_recorder_.
-- Added comments to plot scripts.
R=stefan@webrtc.org
Review URL: https://codereview.webrtc.org/1253473004 .
Cr-Commit-Position: refs/heads/master@{#9636}
diff --git a/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc b/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc
index f0e8198..35b3a86 100644
--- a/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc
+++ b/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc
@@ -51,9 +51,10 @@
TEST_P(BweSimulation, SprintUplinkTest) {
AdaptiveVideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
- RateCounterFilter counter1(&uplink_, 0, "sender_output");
+ RateCounterFilter counter1(&uplink_, 0, "sender_output",
+ bwe_names[GetParam()]);
TraceBasedDeliveryFilter filter(&uplink_, 0, "link_capacity");
- RateCounterFilter counter2(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter2(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
ASSERT_TRUE(filter.Init(test::ResourcePath("sprint-uplink", "rx")));
RunFor(60 * 1000);
@@ -62,9 +63,11 @@
TEST_P(BweSimulation, Verizon4gDownlinkTest) {
AdaptiveVideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&downlink_, &source, GetParam());
- RateCounterFilter counter1(&downlink_, 0, "sender_output");
+ RateCounterFilter counter1(&downlink_, 0, "sender_output",
+ bwe_names[GetParam()] + "_up");
TraceBasedDeliveryFilter filter(&downlink_, 0, "link_capacity");
- RateCounterFilter counter2(&downlink_, 0, "receiver_input");
+ RateCounterFilter counter2(&downlink_, 0, "Receiver",
+ bwe_names[GetParam()] + "_down");
PacketReceiver receiver(&downlink_, 0, GetParam(), true, true);
ASSERT_TRUE(filter.Init(test::ResourcePath("verizon4g-downlink", "rx")));
RunFor(22 * 60 * 1000);
@@ -78,14 +81,16 @@
AdaptiveVideoSource source(kFlowIds[0], 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
ChokeFilter choke(&uplink_, kFlowIds[0]);
- RateCounterFilter counter(&uplink_, kFlowIds[0], "receiver_input_0");
+ RateCounterFilter counter(&uplink_, kFlowIds[0], "Receiver_0",
+ bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, kFlowIds[0], GetParam(), true, false);
AdaptiveVideoSource source2(kFlowIds[1], 30, 300, 0, 0);
VideoSender sender2(&downlink_, &source2, GetParam());
ChokeFilter choke2(&downlink_, kFlowIds[1]);
DelayFilter delay(&downlink_, CreateFlowIds(kFlowIds, kNumFlows));
- RateCounterFilter counter2(&downlink_, kFlowIds[1], "receiver_input_1");
+ RateCounterFilter counter2(&downlink_, kFlowIds[1], "Receiver_1",
+ bwe_names[GetParam()]);
PacketReceiver receiver2(&downlink_, kFlowIds[1], GetParam(), true, false);
choke2.set_capacity_kbps(500);
@@ -105,7 +110,7 @@
AdaptiveVideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
ChokeFilter choke(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, false);
choke.set_capacity_kbps(1000);
@@ -121,7 +126,7 @@
AdaptiveVideoSource source(0, 30, 300, 0, 0);
PacedVideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
filter.set_capacity_kbps(1000);
filter.set_max_delay_ms(500);
@@ -136,7 +141,7 @@
PeriodicKeyFrameSource source(0, 30, 300, 0, 0, 1000);
PacedVideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
filter.set_capacity_kbps(10000);
filter.set_max_delay_ms(500);
@@ -147,7 +152,7 @@
AdaptiveVideoSource source(0, 30, 300, 0, 0);
PacedVideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
filter.set_capacity_kbps(200);
filter.set_max_delay_ms(500);
@@ -162,7 +167,7 @@
AdaptiveVideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
filter.set_capacity_kbps(200);
filter.set_max_delay_ms(500);
@@ -176,10 +181,11 @@
TEST_P(BweSimulation, GoogleWifiTrace3Mbps) {
AdaptiveVideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
- RateCounterFilter counter1(&uplink_, 0, "sender_output");
+ RateCounterFilter counter1(&uplink_, 0, "sender_output",
+ bwe_names[GetParam()]);
TraceBasedDeliveryFilter filter(&uplink_, 0, "link_capacity");
filter.set_max_delay_ms(500);
- RateCounterFilter counter2(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter2(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
ASSERT_TRUE(filter.Init(test::ResourcePath("google-wifi-3mbps", "rx")));
RunFor(300 * 1000);
@@ -189,7 +195,7 @@
PeriodicKeyFrameSource source(0, 30, 300, 0, 0, 1000000);
PacedVideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
filter.set_max_delay_ms(500);
const int kStartingCapacityKbps = 150;
@@ -208,7 +214,7 @@
PeriodicKeyFrameSource source(0, 30, 300, 0, 0, 1000000);
PacedVideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
filter.set_max_delay_ms(500);
const int kStartingCapacityKbps = 1500;
@@ -226,10 +232,11 @@
TEST_P(BweSimulation, PacerGoogleWifiTrace3Mbps) {
PeriodicKeyFrameSource source(0, 30, 300, 0, 0, 1000);
PacedVideoSender sender(&uplink_, &source, GetParam());
- RateCounterFilter counter1(&uplink_, 0, "sender_output");
+ RateCounterFilter counter1(&uplink_, 0, "sender_output",
+ bwe_names[GetParam()]);
TraceBasedDeliveryFilter filter(&uplink_, 0, "link_capacity");
filter.set_max_delay_ms(500);
- RateCounterFilter counter2(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter2(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
ASSERT_TRUE(filter.Init(test::ResourcePath("google-wifi-3mbps", "rx")));
RunFor(300 * 1000);
@@ -254,12 +261,14 @@
rtc::scoped_ptr<RateCounterFilter> rate_counters[kNumFlows];
for (size_t i = 0; i < kNumFlows; ++i) {
- rate_counters[i].reset(new RateCounterFilter(
- &uplink_, CreateFlowIds(&kAllFlowIds[i], 1), "receiver_input"));
+ rate_counters[i].reset(
+ new RateCounterFilter(&uplink_, CreateFlowIds(&kAllFlowIds[i], 1),
+ "Receiver", bwe_names[GetParam()]));
}
RateCounterFilter total_utilization(
- &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "total_utilization");
+ &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "total_utilization",
+ "Total_link_utilization");
rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows];
for (size_t i = 0; i < kNumFlows; ++i) {
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc
index 5790974..f02e167 100644
--- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc
+++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc
@@ -91,7 +91,7 @@
VideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
DelayFilter delay(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "");
+ RateCounterFilter counter(&uplink_, 0, "", "");
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
RunFor(1 * 60 * 1000);
for (int i = 1; i < 51; ++i) {
@@ -122,7 +122,7 @@
VideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
JitterFilter jitter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "");
+ RateCounterFilter counter(&uplink_, 0, "", "");
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
jitter.SetMaxJitter(20);
RunFor(2 * 60 * 1000);
@@ -211,7 +211,7 @@
VideoSender sender(&uplink_, &source, GetParam());
DelayFilter delay(&uplink_, 0);
ChokeFilter choke(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "");
+ RateCounterFilter counter(&uplink_, 0, "", "");
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
choke.set_capacity_kbps(1000);
RunFor(1 * 60 * 1000);
@@ -229,7 +229,7 @@
VideoSender sender(&uplink_, &source, GetParam());
ChokeFilter choke(&uplink_, 0);
JitterFilter jitter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "");
+ RateCounterFilter counter(&uplink_, 0, "", "");
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
choke.set_capacity_kbps(2000);
jitter.SetMaxJitter(120);
@@ -268,7 +268,7 @@
AdaptiveVideoSource source(0, 30, 300, 0, 0);
PacedVideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
const int kCapacityKbps = 1000;
filter.set_capacity_kbps(kCapacityKbps);
@@ -282,7 +282,7 @@
AdaptiveVideoSource source(0, 30, 300, 0, 0);
PacedVideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
const int kHighCapacityKbps = 1000;
const int kLowCapacityKbps = 500;
@@ -302,7 +302,7 @@
AdaptiveVideoSource source(0, 30, 300, 0, 0);
PacedVideoSender sender(&uplink_, &source, GetParam());
ChokeFilter filter(&uplink_, 0);
- RateCounterFilter counter(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
const int kHighCapacityKbps = 200;
const int kLowCapacityKbps = 30;
@@ -322,9 +322,10 @@
TEST_P(BweFeedbackTest, Verizon4gDownlinkTest) {
AdaptiveVideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
- RateCounterFilter counter1(&uplink_, 0, "sender_output");
+ RateCounterFilter counter1(&uplink_, 0, "sender_output",
+ bwe_names[GetParam()]);
TraceBasedDeliveryFilter filter(&uplink_, 0, "link_capacity");
- RateCounterFilter counter2(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter2(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
ASSERT_TRUE(filter.Init(test::ResourcePath("verizon4g-downlink", "rx")));
RunFor(22 * 60 * 1000);
@@ -336,10 +337,11 @@
TEST_P(BweFeedbackTest, GoogleWifiTrace3Mbps) {
AdaptiveVideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam());
- RateCounterFilter counter1(&uplink_, 0, "sender_output");
+ RateCounterFilter counter1(&uplink_, 0, "sender_output",
+ bwe_names[GetParam()]);
TraceBasedDeliveryFilter filter(&uplink_, 0, "link_capacity");
filter.set_max_delay_ms(500);
- RateCounterFilter counter2(&uplink_, 0, "receiver_input");
+ RateCounterFilter counter2(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
PacketReceiver receiver(&uplink_, 0, GetParam(), false, false);
ASSERT_TRUE(filter.Init(test::ResourcePath("google-wifi-3mbps", "rx")));
RunFor(300 * 1000);
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc
index e051ccb..52d7f38 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc
@@ -311,13 +311,17 @@
jitter.SetMaxJitter(max_jitter_ms);
std::vector<RateCounterFilter*> rate_counters;
- for (int flow : all_flow_ids) {
+ for (int flow : media_flow_ids) {
rate_counters.push_back(
- new RateCounterFilter(&uplink_, flow, "receiver_input"));
+ new RateCounterFilter(&uplink_, flow, "Receiver", bwe_names[bwe_type]));
+ }
+ for (int flow : tcp_flow_ids) {
+ rate_counters.push_back(new RateCounterFilter(&uplink_, flow, "Receiver",
+ bwe_names[kTcpEstimator]));
}
- RateCounterFilter total_utilization(&uplink_, all_flow_ids,
- "total_utilization");
+ RateCounterFilter total_utilization(
+ &uplink_, all_flow_ids, "total_utilization", "Total_link_utilization");
std::vector<PacketReceiver*> receivers;
// Delays is being plotted only for the first flow.
@@ -491,7 +495,8 @@
DefaultEvaluationFilter up_filter(&uplink_, flow_ids);
LinkShare link_share(&(up_filter.choke));
- RateCounterFilter total_utilization(&uplink_, flow_ids, "Total_utilization");
+ RateCounterFilter total_utilization(&uplink_, flow_ids, "Total_utilization",
+ "Total_link_utilization");
// Delays is being plotted only for the first flow.
// To plot all of them, replace "i == 0" with "true" on new PacketReceiver().
@@ -682,7 +687,8 @@
}
RateCounterFilter total_utilization(
- &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "Total_utilization");
+ &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "Total_utilization",
+ "Total_link_utilization");
// Delays is being plotted only for the first flow.
// To plot all of them, replace "i == 0" with "true" on new PacketReceiver().
@@ -797,7 +803,8 @@
LinkShare link_share(&(up_filter.choke));
- RateCounterFilter total_utilization(&uplink_, flow_ids, "Total_utilization");
+ RateCounterFilter total_utilization(&uplink_, flow_ids, "Total_utilization",
+ "Total_link_utilization");
// Delays is being plotted only for the first flow.
// To plot all of them, replace "i == 0" with "true" on new PacketReceiver().
@@ -884,7 +891,8 @@
LinkShare link_share(&(filter.choke));
RateCounterFilter total_utilization(
- &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "Total_utilization");
+ &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "Total_utilization",
+ "Total_link_utilization");
// Delays is being plotted only for the first flow.
// To plot all of them, replace "i == 0" with "true" on new PacketReceiver().
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
index fc6f01e..07ca63c 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
@@ -251,12 +251,13 @@
RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener,
int flow_id,
- const char* name)
+ const char* name,
+ const std::string& plot_name)
: PacketProcessor(listener, flow_id, kRegular),
packets_per_second_stats_(),
kbps_stats_(),
- name_(),
- start_plotting_time_ms_(0) {
+ start_plotting_time_ms_(0),
+ plot_name_(plot_name) {
std::stringstream ss;
ss << name << "_" << flow_id;
name_ = ss.str();
@@ -264,16 +265,19 @@
RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener,
const FlowIds& flow_ids,
- const char* name)
+ const char* name,
+ const std::string& plot_name)
: PacketProcessor(listener, flow_ids, kRegular),
packets_per_second_stats_(),
kbps_stats_(),
- name_(),
- start_plotting_time_ms_(0) {
+ start_plotting_time_ms_(0),
+ plot_name_(plot_name) {
std::stringstream ss;
- ss << name << "_";
+ ss << name;
+ char delimiter = '_';
for (int flow_id : flow_ids) {
- ss << flow_id << ",";
+ ss << delimiter << flow_id;
+ delimiter = ',';
}
name_ = ss.str();
}
@@ -281,8 +285,9 @@
RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener,
const FlowIds& flow_ids,
const char* name,
- int64_t start_plotting_time_ms)
- : RateCounterFilter(listener, flow_ids, name) {
+ int64_t start_plotting_time_ms,
+ const std::string& plot_name)
+ : RateCounterFilter(listener, flow_ids, name, plot_name) {
start_plotting_time_ms_ = start_plotting_time_ms;
}
@@ -307,7 +312,13 @@
plot_kbps = rate_counter_.bits_per_second() / 1000.0;
}
BWE_TEST_LOGGING_CONTEXT(name_.c_str());
- BWE_TEST_LOGGING_PLOT(0, "Throughput_#1", timestamp_ms, plot_kbps);
+ if (plot_name_.empty()) {
+ BWE_TEST_LOGGING_PLOT(0, "Throughput_kbps#1", timestamp_ms, plot_kbps);
+ } else {
+ BWE_TEST_LOGGING_PLOT_WITH_NAME(0, "Throughput_kbps#1", timestamp_ms,
+ plot_kbps, plot_name_);
+ }
+
RTC_UNUSED(plot_kbps);
}
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
index d62e6d0..ceaa637 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
@@ -252,14 +252,17 @@
public:
RateCounterFilter(PacketProcessorListener* listener,
int flow_id,
- const char* name);
- RateCounterFilter(PacketProcessorListener* listener,
- const FlowIds& flow_ids,
- const char* name);
+ const char* name,
+ const std::string& plot_name);
RateCounterFilter(PacketProcessorListener* listener,
const FlowIds& flow_ids,
const char* name,
- int64_t start_plotting_time_ms);
+ const std::string& plot_name);
+ RateCounterFilter(PacketProcessorListener* listener,
+ const FlowIds& flow_ids,
+ const char* name,
+ int64_t start_plotting_time_ms,
+ const std::string& plot_name);
virtual ~RateCounterFilter();
void LogStats();
@@ -272,6 +275,8 @@
Stats<double> kbps_stats_;
std::string name_;
int64_t start_plotting_time_ms_;
+ // Algorithm name if single flow, Total link utilization if all flows.
+ std::string plot_name_;
DISALLOW_IMPLICIT_CONSTRUCTORS(RateCounterFilter);
};
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
index aaded73..dc82b91 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
@@ -181,7 +181,8 @@
class BweTestFramework_RateCounterFilterTest : public ::testing::Test {
public:
- BweTestFramework_RateCounterFilterTest() : filter_(NULL, 0, ""), now_ms_(0) {}
+ BweTestFramework_RateCounterFilterTest()
+ : filter_(NULL, 0, "", ""), now_ms_(0) {}
virtual ~BweTestFramework_RateCounterFilterTest() {}
protected:
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
index bcf7e13..9423313 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
@@ -91,7 +91,7 @@
}
void Logging::Plot(int figure, double value) {
- Plot(figure, value, "");
+ Plot(figure, value, "-");
}
void Logging::Plot(int figure, double value, const std::string& alg_name) {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc b/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc
index 90554a3..25e8989 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc
@@ -130,7 +130,9 @@
}
void MetricRecorder::SetPlotInformation(
- const std::vector<std::string>& prefixes) {
+ const std::vector<std::string>& prefixes,
+ bool plot_delay,
+ bool plot_loss) {
assert(prefixes.size() == kNumMetrics);
for (size_t i = 0; i < kNumMetrics; ++i) {
plot_information_[i].prefix = prefixes[i];
@@ -144,10 +146,19 @@
for (int i = kThroughput; i < kNumMetrics; ++i) {
plot_information_[i].last_plot_ms = 0;
- if (i == kObjective || i == kAvailablePerFlow) {
- plot_information_[i].plot = false;
- } else {
- plot_information_[i].plot = true;
+ switch (i) {
+ case kAvailablePerFlow:
+ case kObjective:
+ plot_information_[i].plot = false;
+ break;
+ case kLoss:
+ plot_information_[i].plot = plot_loss;
+ break;
+ case kDelay:
+ plot_information_[i].plot = plot_delay;
+ break;
+ default:
+ plot_information_[i].plot = true;
}
}
}
diff --git a/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h b/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h
index 98db381..4c77999 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h
@@ -65,7 +65,9 @@
PacketSender* packet_sender,
LinkShare* link_share);
- void SetPlotInformation(const std::vector<std::string>& prefixes);
+ void SetPlotInformation(const std::vector<std::string>& prefixes,
+ bool plot_delay,
+ bool plot_loss);
template <typename T>
void PlotLine(int windows_id,
diff --git a/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc b/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc
index acae76e..7032b08 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc
@@ -32,34 +32,29 @@
MetricRecorder* metric_recorder)
: PacketProcessor(listener, flow_id, kReceiver),
bwe_receiver_(CreateBweReceiver(bwe_type, flow_id, plot_bwe)),
- metric_recorder_(metric_recorder) {
+ metric_recorder_(metric_recorder),
+ plot_delay_(plot_delay),
+ last_delay_plot_ms_(0),
+ // #2 aligns the plot with the right axis.
+ delay_prefix_("Delay_ms#2"),
+ bwe_type_(bwe_type) {
if (metric_recorder_ != nullptr) {
- // Setup the prefix ststd::rings used when logging.
+ // Setup the prefix std::strings used when logging.
std::vector<std::string> prefixes;
- std::stringstream ss1;
- ss1 << "Throughput_kbps_" << flow_id << "#2";
- prefixes.push_back(ss1.str()); // Throughput.
-
- std::stringstream ss2;
- ss2 << "Delay_ms_" << flow_id << "#2";
- prefixes.push_back(ss2.str()); // Delay.
-
- std::stringstream ss3;
- ss3 << "Packet_Loss_" << flow_id << "#2";
- prefixes.push_back(ss3.str()); // Loss.
-
- std::stringstream ss4;
- ss4 << "Objective_function_" << flow_id << "#2";
- prefixes.push_back(ss4.str()); // Objective.
+ // Metric recorder plots them in separated figures,
+ // alignment will take place with the #1 left axis.
+ prefixes.push_back("Throughput_kbps#1"); // Throughput.
+ prefixes.push_back("Delay_ms_#1"); // Delay.
+ prefixes.push_back("Packet_Loss_#1"); // Loss.
+ prefixes.push_back("Objective_function_#1"); // Objective.
// Plot Total/PerFlow Available capacity together with throughputs.
- std::stringstream ss5;
- ss5 << "Throughput_kbps" << flow_id << "#1";
- prefixes.push_back(ss5.str()); // Total Available.
- prefixes.push_back(ss5.str()); // Available per flow.
+ prefixes.push_back("Throughput_kbps#1"); // Total Available.
+ prefixes.push_back("Throughput_kbps#1"); // Available per flow.
- metric_recorder_->SetPlotInformation(prefixes);
+ bool plot_loss = plot_delay; // Plot loss if delay is plotted.
+ metric_recorder_->SetPlotInformation(prefixes, plot_delay, plot_loss);
}
}
@@ -102,6 +97,8 @@
UpdateMetrics(arrival_time_ms, send_time_ms,
media_packet->payload_size());
metric_recorder_->PlotAllDynamics();
+ } else if (plot_delay_) {
+ PlotDelay(arrival_time_ms, send_time_ms);
}
bwe_receiver_->ReceivePacket(arrival_time_ms, *media_packet);
@@ -127,6 +124,16 @@
metric_recorder_->UpdateObjective();
}
+void PacketReceiver::PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms) {
+ const int64_t kDelayPlotIntervalMs = 100;
+ if (arrival_time_ms >= last_delay_plot_ms_ + kDelayPlotIntervalMs) {
+ BWE_TEST_LOGGING_PLOT_WITH_NAME(0, delay_prefix_, arrival_time_ms,
+ arrival_time_ms - send_time_ms,
+ bwe_names[bwe_type_]);
+ last_delay_plot_ms_ = arrival_time_ms;
+ }
+}
+
float PacketReceiver::GlobalPacketLoss() {
return bwe_receiver_->GlobalReceiverPacketLossRatio();
}
diff --git a/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h b/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h
index 3019235..390a1f0 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h
@@ -56,7 +56,12 @@
rtc::scoped_ptr<BweReceiver> bwe_receiver_;
private:
+ void PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms);
MetricRecorder* metric_recorder_;
+ bool plot_delay_; // Used in case there isn't a metric recorder.
+ int64_t last_delay_plot_ms_;
+ std::string delay_prefix_;
+ BandwidthEstimatorType bwe_type_;
DISALLOW_IMPLICIT_CONSTRUCTORS(PacketReceiver);
};
diff --git a/webrtc/modules/remote_bitrate_estimator/test/plot_bars.sh b/webrtc/modules/remote_bitrate_estimator/test/plot_bars.sh
old mode 100644
new mode 100755
index e733bf6..f678d5e
--- a/webrtc/modules/remote_bitrate_estimator/test/plot_bars.sh
+++ b/webrtc/modules/remote_bitrate_estimator/test/plot_bars.sh
@@ -34,7 +34,7 @@
labels=$(echo "$log" | grep "^LABEL")
figures=($(echo "$bars" | cut -f 2 | sort | uniq))
- echo "reset"
+ echo "reset" # Clears previous settings.
echo "set title font 'Verdana,22'"
echo "set xtics font 'Verdana,24'"
@@ -45,12 +45,13 @@
echo "set style fill solid 0.5"
echo "set style fill solid border -1"
- ydist=11 # Used to correctly offset the y label.
+ declare -a ydist=(11.5 10.5 10.5) # Used to correctly offset the y label.
+ i=0
for figure in "${figures[@]}" ; do
echo "set terminal wxt $figure size 440,440 dashed"
- echo "set ylabel offset $ydist, -3"
- ((ydist--))
+ echo "set ylabel offset ${ydist[$i]}, -3"
+ (( i++ ))
title=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 3 | \
head -n 1 | sed 's/_/ /g')
@@ -107,48 +108,52 @@
y_max=0 # Used to scale the plot properly.
- # Since only the optimal bitrate for the first flow is being ploted,
- # consider only this one for scalling purposes.
- data_sets=$(echo "$bars" | grep "LIMITERRORBAR.$figure" | cut -f 3 | \
- sed 's/_/\t/g' | cut -f 1 | sort | uniq)
-
- if (( ${#data_sets} > "0" )); then
- for set in $data_sets ; do
- y=$(echo "$bars" | grep "LIMITERRORBAR.$figure.$set" | cut -f 8 | \
- head -n 1)
- if (( $(bc <<< "$y > $y_max") == 1 )); then
- y_max=$y
- fi
- done
- fi
-
- data_sets=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 3 | sort | uniq)
- if (( ${#data_sets} > "0" )); then
- for set in $data_sets ; do
- y=$(echo "$bars" | grep "ERRORBAR.$figure.$set" | cut -f 6 | head -n 1)
- if (( $(bc <<< "$y > $y_max") == 1 )) ; then
- y_max=$y
- fi
- done
- fi
-
- data_sets=$(echo "$bars" | grep "BAR.$figure" | cut -f 3 | sort | uniq)
-
- for set in $data_sets ; do
- y=$(echo "$bars" | grep "BAR.$figure.$set" | cut -f 4 | head -n 1)
- if (( $(bc <<< "$y > $y_max") == 1 )) ; then
- y_max=$y
- fi
- done
-
- y_max=$(echo $y_max*1.1 | bc)
-
# Scale all latency plots with the same vertical scale.
delay_figure=5
if (( $figure==$delay_figure )) ; then
y_max=250
+ else # Take y_max = 1.1 * highest plot value.
+
+ # Since only the optimal bitrate for the first flow is being ploted,
+ # consider only this one for scalling purposes.
+ data_sets=$(echo "$bars" | grep "LIMITERRORBAR.$figure" | cut -f 3 | \
+ sed 's/_/\t/g' | cut -f 1 | sort | uniq)
+
+ if (( ${#data_sets[@]} > "0" )); then
+ for set in $data_sets ; do
+ y=$(echo "$bars" | grep "LIMITERRORBAR.$figure.$set" | cut -f 8 | \
+ head -n 1)
+ if (( $(bc <<< "$y > $y_max") == 1 )); then
+ y_max=$y
+ fi
+ done
+ fi
+
+ data_sets=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 3 | \
+ sort | uniq)
+ if (( ${#data_sets[@]} > "0" )); then
+ for set in $data_sets ; do
+ y=$(echo "$bars" | grep "ERRORBAR.$figure.$set" | cut -f 6 | \
+ head -n 1)
+ if (( $(bc <<< "$y > $y_max") == 1 )) ; then
+ y_max=$y
+ fi
+ done
+ fi
+
+ data_sets=$(echo "$bars" | grep "BAR.$figure" | cut -f 3 | sort | uniq)
+
+ for set in $data_sets ; do
+ y=$(echo "$bars" | grep "BAR.$figure.$set" | cut -f 4 | head -n 1)
+ if (( $(bc <<< "$y > $y_max") == 1 )) ; then
+ y_max=$y
+ fi
+ done
+
+ y_max=$(echo $y_max*1.1 | bc)
fi
+
echo "set ylabel \"$y_label\""
echo "set yrange[0:$y_max]"
@@ -193,29 +198,31 @@
# Plot Baseline bars, e.g. one-way path delay on latency plots.
data_sets=$(echo "$log" | grep "BASELINE.$figure" | cut -f 3 | sort | uniq)
- echo "set xtics $x_labels"
- echo "plot '-' using 1:4:2 with boxes lc variable notitle"
+ if (( ${#data_sets} > "0" )); then
+ echo "set xtics $x_labels"
+ echo "plot '-' using 1:4:2 with boxes lc variable notitle"
- echo
+ echo
- color=18 # Gray.
- x_bar=$(echo $x_start + 0.5 + 0.5*$box_width | bc)
- for set in $data_sets ; do
- echo -n "$x_bar $color "
- echo "$log" | grep "BASELINE.$figure.$set" | cut -f 3,4
+ color=18 # Gray.
+ x_bar=$(echo $x_start + 0.5 + 0.5*$box_width | bc)
+ for set in $data_sets ; do
+ echo -n "$x_bar $color "
+ echo "$log" | grep "BASELINE.$figure.$set" | cut -f 3,4
- # Add extra space if TCP flows are being plotted.
- if $tcp_flow && \
- (( $(bc <<< "$x_bar < $x_start + 1.5 - 0.5*$tcp_space") == 1 )) && \
- (( $(bc <<< "$x_bar + $box_width > $x_start + 1.5 + 0.5*$tcp_space") \
- == 1 )); then
- x_bar=$(echo $x_bar + $tcp_space | bc)
- fi
+ # Add extra space if TCP flows are being plotted.
+ if $tcp_flow && \
+ (( $(bc <<< "$x_bar < $x_start + 1.5 - 0.5*$tcp_space") == 1 )) && \
+ (( $(bc <<< "$x_bar + $box_width > $x_start + 1.5 \
+ + 0.5*$tcp_space") == 1 )); then
+ x_bar=$(echo $x_bar + $tcp_space | bc)
+ fi
- x_bar=$(echo $x_bar + $box_width | bc)
+ x_bar=$(echo $x_bar + $box_width | bc)
- done
- echo "e"
+ done
+ echo "e"
+ fi
# Plot vertical error lines, e.g. y +- sigma.
data_sets=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 3 | sort | uniq)
@@ -275,4 +282,5 @@
echo "unset multiplot"
done
}
+
gen_gnuplot_bar_input | gnuplot -persist
diff --git a/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py b/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py
index f825be4..63104d7 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py
+++ b/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py
@@ -48,9 +48,13 @@
def addSample(self, line):
- groups = re.search(r'/\d_(\w+)#\d@(\w*)', line)
+ groups = re.search(r'_(((\d)+((,(\d)+)*))_(\D+))#\d@(\S+)', line)
+
+ # Each variable will be plotted in a separated box.
var_name = groups.group(1)
- alg_name = groups.group(2)
+ alg_name = groups.group(8)
+
+ alg_name = alg_name.replace('_', ' ')
if alg_name not in self._samples.keys():
self._samples[alg_name] = {}
@@ -59,6 +63,7 @@
self._samples[alg_name][var_name] = []
sample = re.search(r'(\d+\.\d+)\t([-]?\d+\.\d+)', line)
+
s = (sample.group(1),sample.group(2))
self._samples[alg_name][var_name].append(s)
@@ -86,19 +91,16 @@
'NADA2':'#A0A0FF',
'NADA3':'#0000FF',
'NADA4':'#C0A0FF',
- 'NADA5':'#9060B0',
- 'TCP1':'#AAAAAA',
- 'TCP2':'#AAAAAA',
- 'TCP3':'#AAAAAA',
- 'TCP4':'#AAAAAA',
- 'TCP5':'#AAAAAA',
- 'TCP6':'#AAAAAA',
- 'TCP7':'#AAAAAA',
- 'TCP8':'#AAAAAA',
- 'TCP9':'#AAAAAA',
- 'TCP10':'#AAAAAA',}
+ 'NADA5':'#9060B0',}
- plt.setp(line, color=colormap[alg + str(i)])
+ key = alg + str(i)
+ if key in colormap:
+ plt.setp(line, color=colormap[key])
+ elif alg == 'TCP':
+ plt.setp(line, color='#AAAAAA')
+ else:
+ plt.setp(line, color='#654321')
+
if alg.startswith('Available'):
plt.setp(line, linestyle='--')
plt.grid(True)
@@ -110,8 +112,8 @@
i += 1
if show_legend:
- legend = plt.legend(loc='upper right', shadow=True,
- fontsize='large', ncol=len(v._samples))
+ legend = plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.40),
+ shadow=True, fontsize='medium', ncol=len(v._samples))
if __name__ == '__main__':
diff --git a/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.sh b/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.sh
old mode 100644
new mode 100755
index cb31825..fd104a1
--- a/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.sh
+++ b/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.sh
@@ -29,35 +29,49 @@
function gen_gnuplot_input {
colors=(a7001f 0a60c2 b2582b 21a66c d6604d 4393c3 f4a582 92c5de edcbb7 b1c5d0)
plots=$(echo "$log" | grep "^PLOT")
+ # Each figure corresponds to a separate plot window.
figures=($(echo "$plots" | cut -f 2 | sort | uniq))
for figure in "${figures[@]}" ; do
+ # Each data set corresponds to a plot line.
data_sets=$(echo "$plots" | grep "^PLOT.$figure" | cut -f 3 | sort | uniq)
+ # Lines can be scaled on the left (1) or right (2) axis.
linetypes=($(echo "$data_sets" | grep "#" | cut -d '#' -f 2 | \
- cut -d ' ' -f 1))
+ cut -d '@' -f 1 | uniq))
+
+ # Set plot configurations.
echo "reset; "
echo "set terminal wxt $figure size 1440,900 font \"Arial,9\"; "
echo "set xlabel \"Seconds\"; "
- if (( "${#linetypes[@]}" > "0" )); then
- echo "set ylabel 'bitrate (kbps)';"
+ if (( "${#linetypes[@]}" > "1" )); then
+ echo "set ylabel 'Bitrate (kbps)';" # Left side.
echo "set ytics nomirror;"
- echo "set y2label 'time delta (ms)';"
+ echo "set y2label 'Time delta (ms)';" # Right side.
echo "set y2tics nomirror;"
+ else
+ # Single axis (left side), set its label according to data.
+ y_label=$(echo "$data_sets" | grep "#" | cut -d '#' -f 1 | \
+ cut -d ' ' -f 1 | cut -d '/' -f 3 | sed 's/[0-9]/#/g' | \
+ cut -d '#' -f 3 | head -n 1 | sed 's/_/ /g')
+ echo "set ylabel \"$y_label\";"
fi
- echo -n "plot "
+
i=0
+ echo -n "plot "
for set in $data_sets ; do
(( i++ )) && echo -n ","
echo -n "'-' with "
echo -n "linespoints "
echo -n "ps 0.5 "
echo -n "lc rgbcolor \"#${colors[$(($i % 10))]}\" "
- if (( "${#linetypes[@]}" > "0" )); then
- if (( "$i" <= "${#linetypes[@]}" )); then
- echo -n "axes x1y${linetypes[$i - 1]} "
+ if (( "${#linetypes[@]}" > "1" )); then
+ # Multiple sets can have a same line plot.
+ linetype=$(echo "$set" | grep "#" | cut -d '#' -f 2 | cut -d '@' -f 1)
+ if (( "${#linetype}" > "0")); then
+ echo -n "axes x1y$linetype "
else
# If no line type is specified, but line types are used, we will
- # default to the bitrate axis.
+ # default to scale on the left axis.
echo -n "axes x1y1 "
fi
fi