From f736d2365d4ee7dd9cd9c6e0d1472e1cb8a5fbee Mon Sep 17 00:00:00 2001 From: terelius Date: Thu, 4 Aug 2016 10:00:11 -0700 Subject: [PATCH] Add fraction loss in visualization tool. Review-Url: https://codereview.webrtc.org/2204713005 Cr-Commit-Position: refs/heads/master@{#13644} --- webrtc/tools/event_log_visualizer/analyzer.cc | 17 +++++++++++++++++ webrtc/tools/event_log_visualizer/analyzer.h | 2 ++ .../event_log_visualizer/generate_timeseries.cc | 8 ++++++++ 3 files changed, 27 insertions(+) diff --git a/webrtc/tools/event_log_visualizer/analyzer.cc b/webrtc/tools/event_log_visualizer/analyzer.cc index b1f87227a7..cb8455c5fc 100644 --- a/webrtc/tools/event_log_visualizer/analyzer.cc +++ b/webrtc/tools/event_log_visualizer/analyzer.cc @@ -538,6 +538,23 @@ void EventLogAnalyzer::CreateAccumulatedDelayChangeGraph(Plot* plot) { plot->SetTitle("Accumulated network latency change"); } +// Plot the fraction of packets lost (as perceived by the loss-based BWE). +void EventLogAnalyzer::CreateFractionLossGraph(Plot* plot) { + plot->series_list_.push_back(TimeSeries()); + for (auto& bwe_update : bwe_loss_updates_) { + float x = static_cast(bwe_update.timestamp - begin_time_) / 1000000; + float y = static_cast(bwe_update.fraction_loss) / 255 * 100; + plot->series_list_.back().points.emplace_back(x, y); + } + plot->series_list_.back().label = "Fraction lost"; + plot->series_list_.back().style = LINE_DOT_GRAPH; + + plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); + plot->SetSuggestedYAxis(0, 10, "Percent lost packets", kBottomMargin, + kTopMargin); + plot->SetTitle("Reported packet loss"); +} + // Plot the total bandwidth used by all RTP streams. void EventLogAnalyzer::CreateTotalBitrateGraph( PacketDirection desired_direction, diff --git a/webrtc/tools/event_log_visualizer/analyzer.h b/webrtc/tools/event_log_visualizer/analyzer.h index 2853e86ad0..dc56c5fd16 100644 --- a/webrtc/tools/event_log_visualizer/analyzer.h +++ b/webrtc/tools/event_log_visualizer/analyzer.h @@ -41,6 +41,8 @@ class EventLogAnalyzer { void CreateAccumulatedDelayChangeGraph(Plot* plot); + void CreateFractionLossGraph(Plot* plot); + void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot); void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); diff --git a/webrtc/tools/event_log_visualizer/generate_timeseries.cc b/webrtc/tools/event_log_visualizer/generate_timeseries.cc index 273dcfa337..27dc59c042 100644 --- a/webrtc/tools/event_log_visualizer/generate_timeseries.cc +++ b/webrtc/tools/event_log_visualizer/generate_timeseries.cc @@ -51,6 +51,10 @@ DEFINE_bool(plot_network_delay_feedback, false, "Compute network delay based on sent packets and the received " "transport feedback."); +DEFINE_bool(plot_fraction_loss, + false, + "Plot packet loss in percent for outgoing packets (as perceived by " + "the send-side bandwidth estimator)."); int main(int argc, char* argv[]) { std::string program_name = argv[0]; @@ -116,6 +120,10 @@ int main(int argc, char* argv[]) { } } + if (FLAGS_plot_all || FLAGS_plot_fraction_loss) { + analyzer.CreateFractionLossGraph(collection->AppendNewPlot()); + } + if (FLAGS_plot_all || FLAGS_plot_total_bitrate) { if (FLAGS_incoming) { analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket,