Delay based logging.

BUG=none

Review-Url: https://codereview.webrtc.org/2808833002
Cr-Commit-Position: refs/heads/master@{#17641}
This commit is contained in:
philipel
2017-04-11 01:50:23 -07:00
committed by Commit bot
parent 64e739aeae
commit 10fc0e6385
6 changed files with 37 additions and 25 deletions

View File

@ -491,10 +491,8 @@ void ParsedRtcEventLog::GetLossBasedBweUpdate(size_t index,
} }
} }
void ParsedRtcEventLog::GetDelayBasedBweUpdate( ParsedRtcEventLog::BweDelayBasedUpdate
size_t index, ParsedRtcEventLog::GetDelayBasedBweUpdate(size_t index) const {
int32_t* bitrate_bps,
BandwidthUsage* detector_state) const {
RTC_CHECK_LT(index, GetNumberOfEvents()); RTC_CHECK_LT(index, GetNumberOfEvents());
const rtclog::Event& event = events_[index]; const rtclog::Event& event = events_[index];
RTC_CHECK(event.has_type()); RTC_CHECK(event.has_type());
@ -502,14 +500,14 @@ void ParsedRtcEventLog::GetDelayBasedBweUpdate(
RTC_CHECK(event.has_delay_based_bwe_update()); RTC_CHECK(event.has_delay_based_bwe_update());
const rtclog::DelayBasedBweUpdate& delay_event = const rtclog::DelayBasedBweUpdate& delay_event =
event.delay_based_bwe_update(); event.delay_based_bwe_update();
BweDelayBasedUpdate res;
res.timestamp = GetTimestamp(index);
RTC_CHECK(delay_event.has_bitrate_bps()); RTC_CHECK(delay_event.has_bitrate_bps());
if (bitrate_bps != nullptr) { res.bitrate_bps = delay_event.bitrate_bps();
*bitrate_bps = delay_event.bitrate_bps();
}
RTC_CHECK(delay_event.has_detector_state()); RTC_CHECK(delay_event.has_detector_state());
if (detector_state != nullptr) { res.detector_state = GetRuntimeDetectorState(delay_event.detector_state());
*detector_state = GetRuntimeDetectorState(delay_event.detector_state()); return res;
}
} }
void ParsedRtcEventLog::GetAudioNetworkAdaptation( void ParsedRtcEventLog::GetAudioNetworkAdaptation(

View File

@ -50,6 +50,12 @@ class ParsedRtcEventLog {
rtc::Optional<ProbeFailureReason> failure_reason; rtc::Optional<ProbeFailureReason> failure_reason;
}; };
struct BweDelayBasedUpdate {
uint64_t timestamp;
int32_t bitrate_bps;
BandwidthUsage detector_state;
};
enum EventType { enum EventType {
UNKNOWN_EVENT = 0, UNKNOWN_EVENT = 0,
LOG_START = 1, LOG_START = 1,
@ -146,9 +152,7 @@ class ParsedRtcEventLog {
// and stores the values in the corresponding output parameters. Each output // and stores the values in the corresponding output parameters. Each output
// parameter can be set to nullptr if that // parameter can be set to nullptr if that
// value isn't needed. // value isn't needed.
void GetDelayBasedBweUpdate(size_t index, BweDelayBasedUpdate GetDelayBasedBweUpdate(size_t index) const;
int32_t* bitrate_bps,
BandwidthUsage* detector_state) const;
// Reads a audio network adaptation event to a (non-NULL) // Reads a audio network adaptation event to a (non-NULL)
// AudioEncoderRuntimeConfig struct. Only the fields that are // AudioEncoderRuntimeConfig struct. Only the fields that are

View File

@ -539,12 +539,10 @@ void RtcEventLogTestHelper::VerifyBweDelayEvent(
GetRuntimeDetectorState(bwe_event.detector_state())); GetRuntimeDetectorState(bwe_event.detector_state()));
// Check consistency of the parser. // Check consistency of the parser.
int32_t parsed_bitrate; ParsedRtcEventLog::BweDelayBasedUpdate res =
BandwidthUsage parsed_detector_state; parsed_log.GetDelayBasedBweUpdate(index);
parsed_log.GetDelayBasedBweUpdate(index, &parsed_bitrate, EXPECT_EQ(res.bitrate_bps, bitrate);
&parsed_detector_state); EXPECT_EQ(res.detector_state, detector_state);
EXPECT_EQ(bitrate, parsed_bitrate);
EXPECT_EQ(detector_state, parsed_detector_state);
} }
void RtcEventLogTestHelper::VerifyAudioNetworkAdaptation( void RtcEventLogTestHelper::VerifyAudioNetworkAdaptation(

View File

@ -467,6 +467,7 @@ EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log)
break; break;
} }
case ParsedRtcEventLog::DELAY_BASED_BWE_UPDATE: { case ParsedRtcEventLog::DELAY_BASED_BWE_UPDATE: {
bwe_delay_updates_.push_back(parsed_log_.GetDelayBasedBweUpdate(i));
break; break;
} }
case ParsedRtcEventLog::AUDIO_NETWORK_ADAPTATION_EVENT: { case ParsedRtcEventLog::AUDIO_NETWORK_ADAPTATION_EVENT: {
@ -933,13 +934,22 @@ void EventLogAnalyzer::CreateTotalBitrateGraph(
// Overlay the send-side bandwidth estimate over the outgoing bitrate. // Overlay the send-side bandwidth estimate over the outgoing bitrate.
if (desired_direction == kOutgoingPacket) { if (desired_direction == kOutgoingPacket) {
TimeSeries* time_series = TimeSeries* loss_series =
plot->AddTimeSeries("Loss-based estimate", LINE_STEP_GRAPH); plot->AddTimeSeries("Loss-based estimate", LINE_STEP_GRAPH);
for (auto& bwe_update : bwe_loss_updates_) { for (auto& loss_update : bwe_loss_updates_) {
float x = float x =
static_cast<float>(bwe_update.timestamp - begin_time_) / 1000000; static_cast<float>(loss_update.timestamp - begin_time_) / 1000000;
float y = static_cast<float>(bwe_update.new_bitrate) / 1000; float y = static_cast<float>(loss_update.new_bitrate) / 1000;
time_series->points.emplace_back(x, y); loss_series->points.emplace_back(x, y);
}
TimeSeries* delay_series =
plot->AddTimeSeries("Delay-based estimate", LINE_STEP_GRAPH);
for (auto& delay_update : bwe_delay_updates_) {
float x =
static_cast<float>(delay_update.timestamp - begin_time_) / 1000000;
float y = static_cast<float>(delay_update.bitrate_bps) / 1000;
delay_series->points.emplace_back(x, y);
} }
TimeSeries* created_series = TimeSeries* created_series =

View File

@ -173,6 +173,8 @@ class EventLogAnalyzer {
std::vector<ParsedRtcEventLog::BweProbeResultEvent> bwe_probe_result_events_; std::vector<ParsedRtcEventLog::BweProbeResultEvent> bwe_probe_result_events_;
std::vector<ParsedRtcEventLog::BweDelayBasedUpdate> bwe_delay_updates_;
// Window and step size used for calculating moving averages, e.g. bitrate. // Window and step size used for calculating moving averages, e.g. bitrate.
// The generated data points will be |step_| microseconds apart. // The generated data points will be |step_| microseconds apart.
// Only events occuring at most |window_duration_| microseconds before the // Only events occuring at most |window_duration_| microseconds before the

View File

@ -78,7 +78,7 @@ void PythonPlot::Draw() {
} else if (series_list_[i].style == DOT_GRAPH) { } else if (series_list_[i].style == DOT_GRAPH) {
printf( printf(
"plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', " "plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', "
"marker='.', ls=' ')\n", "marker='o', ls=' ')\n",
i, i, i, series_list_[i].label.c_str()); i, i, i, series_list_[i].label.c_str());
} else { } else {
printf("raise Exception(\"Unknown graph type\")\n"); printf("raise Exception(\"Unknown graph type\")\n");