From 57ba7e1276edb948e0ad438925f4847660f009b0 Mon Sep 17 00:00:00 2001 From: Bjorn Terelius Date: Thu, 25 Oct 2018 15:31:35 +0200 Subject: [PATCH] Normalize baseline in network delay plot to RTT/2. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: None Change-Id: I0d4266216adf9283ceb335281f9332f66a04324e Reviewed-on: https://webrtc-review.googlesource.com/c/107648 Commit-Queue: Björn Terelius Reviewed-by: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#25369} --- rtc_tools/event_log_visualizer/analyzer.cc | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/rtc_tools/event_log_visualizer/analyzer.cc b/rtc_tools/event_log_visualizer/analyzer.cc index b1a9734827..880bec3195 100644 --- a/rtc_tools/event_log_visualizer/analyzer.cc +++ b/rtc_tools/event_log_visualizer/analyzer.cc @@ -1296,9 +1296,10 @@ void EventLogAnalyzer::CreateReceiveSideBweSimulationGraph(Plot* plot) { void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) { TimeSeries late_feedback_series("Late feedback results.", LineStyle::kNone, PointStyle::kHighlight); - TimeSeries time_series("Network Delay Change", LineStyle::kLine, + TimeSeries time_series("Network delay", LineStyle::kLine, PointStyle::kHighlight); - int64_t estimated_base_delay_ms = std::numeric_limits::max(); + int64_t min_send_receive_diff_ms = std::numeric_limits::max(); + int64_t min_rtt_ms = std::numeric_limits::max(); int64_t prev_y = 0; for (auto packet : GetNetworkTrace(parsed_log_)) { @@ -1311,16 +1312,22 @@ void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) { } int64_t y = packet.arrival_time_ms - packet.send_time_ms; prev_y = y; - estimated_base_delay_ms = std::min(y, estimated_base_delay_ms); + int64_t rtt_ms = packet.feedback_arrival_time_ms - packet.send_time_ms; + min_rtt_ms = std::min(rtt_ms, min_rtt_ms); + min_send_receive_diff_ms = std::min(y, min_send_receive_diff_ms); time_series.points.emplace_back(x, y); } - // We assume that the base network delay (w/o queues) is the min delay - // observed during the call. + // We assume that the base network delay (w/o queues) is equal to half + // the minimum RTT. Therefore rescale the delays by subtracting the minimum + // observed 1-ways delay and add half the minumum RTT. + const int64_t estimated_clock_offset_ms = + min_send_receive_diff_ms - min_rtt_ms / 2; for (TimeSeriesPoint& point : time_series.points) - point.y -= estimated_base_delay_ms; + point.y -= estimated_clock_offset_ms; for (TimeSeriesPoint& point : late_feedback_series.points) - point.y -= estimated_base_delay_ms; + point.y -= estimated_clock_offset_ms; + // Add the data set to the plot. plot->AppendTimeSeriesIfNotEmpty(std::move(time_series)); plot->AppendTimeSeriesIfNotEmpty(std::move(late_feedback_series)); @@ -1328,7 +1335,7 @@ void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) { plot->SetXAxis(ToCallTimeSec(begin_time_), call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); - plot->SetTitle("Network Delay Change."); + plot->SetTitle("Network delay (based on per-packet feedback)"); } void EventLogAnalyzer::CreatePacerDelayGraph(Plot* plot) {