Improved UI for event_log_analyzer tool

- Don't plot every graph by default.
- Change --plot_all to --plot_profile=(all|none|default).
- Some other minor cleanups.

BUG=webrtc:8017

Review-Url: https://codereview.webrtc.org/2983983002
Cr-Commit-Position: refs/heads/master@{#19348}
This commit is contained in:
terelius
2017-08-15 02:04:02 -07:00
committed by Commit Bot
parent 6bdcefce80
commit 2ee076dfa3
3 changed files with 172 additions and 131 deletions

View File

@ -825,7 +825,7 @@ void EventLogAnalyzer::CreateIncomingPacketLossGraph(Plot* plot) {
plot->SetTitle("Estimated incoming loss rate"); plot->SetTitle("Estimated incoming loss rate");
} }
void EventLogAnalyzer::CreateDelayChangeGraph(Plot* plot) { void EventLogAnalyzer::CreateIncomingDelayDeltaGraph(Plot* plot) {
for (auto& kv : rtp_packets_) { for (auto& kv : rtp_packets_) {
StreamId stream_id = kv.first; StreamId stream_id = kv.first;
const std::vector<LoggedRtpPacket>& packet_stream = kv.second; const std::vector<LoggedRtpPacket>& packet_stream = kv.second;
@ -855,10 +855,10 @@ void EventLogAnalyzer::CreateDelayChangeGraph(Plot* plot) {
plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
plot->SetSuggestedYAxis(0, 1, "Latency change (ms)", kBottomMargin, plot->SetSuggestedYAxis(0, 1, "Latency change (ms)", kBottomMargin,
kTopMargin); kTopMargin);
plot->SetTitle("Network latency change between consecutive packets"); plot->SetTitle("Network latency difference between consecutive packets");
} }
void EventLogAnalyzer::CreateAccumulatedDelayChangeGraph(Plot* plot) { void EventLogAnalyzer::CreateIncomingDelayGraph(Plot* plot) {
for (auto& kv : rtp_packets_) { for (auto& kv : rtp_packets_) {
StreamId stream_id = kv.first; StreamId stream_id = kv.first;
const std::vector<LoggedRtpPacket>& packet_stream = kv.second; const std::vector<LoggedRtpPacket>& packet_stream = kv.second;
@ -888,7 +888,7 @@ void EventLogAnalyzer::CreateAccumulatedDelayChangeGraph(Plot* plot) {
plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
plot->SetSuggestedYAxis(0, 1, "Latency change (ms)", kBottomMargin, plot->SetSuggestedYAxis(0, 1, "Latency change (ms)", kBottomMargin,
kTopMargin); kTopMargin);
plot->SetTitle("Accumulated network latency change"); plot->SetTitle("Network latency (relative to first packet)");
} }
// Plot the fraction of packets lost (as perceived by the loss-based BWE). // Plot the fraction of packets lost (as perceived by the loss-based BWE).
@ -1420,8 +1420,7 @@ void EventLogAnalyzer::CreateAudioEncoderFrameLengthGraph(Plot* plot) {
plot->SetTitle("Reported audio encoder frame length"); plot->SetTitle("Reported audio encoder frame length");
} }
void EventLogAnalyzer::CreateAudioEncoderUplinkPacketLossFractionGraph( void EventLogAnalyzer::CreateAudioEncoderPacketLossGraph(Plot* plot) {
Plot* plot) {
TimeSeries time_series("Audio encoder uplink packet loss fraction", TimeSeries time_series("Audio encoder uplink packet loss fraction",
LINE_DOT_GRAPH); LINE_DOT_GRAPH);
ProcessPoints<AudioNetworkAdaptationEvent>( ProcessPoints<AudioNetworkAdaptationEvent>(

View File

@ -79,9 +79,8 @@ class EventLogAnalyzer {
void CreateIncomingPacketLossGraph(Plot* plot); void CreateIncomingPacketLossGraph(Plot* plot);
void CreateDelayChangeGraph(Plot* plot); void CreateIncomingDelayDeltaGraph(Plot* plot);
void CreateIncomingDelayGraph(Plot* plot);
void CreateAccumulatedDelayChangeGraph(Plot* plot);
void CreateFractionLossGraph(Plot* plot); void CreateFractionLossGraph(Plot* plot);
@ -98,7 +97,7 @@ class EventLogAnalyzer {
void CreateAudioEncoderTargetBitrateGraph(Plot* plot); void CreateAudioEncoderTargetBitrateGraph(Plot* plot);
void CreateAudioEncoderFrameLengthGraph(Plot* plot); void CreateAudioEncoderFrameLengthGraph(Plot* plot);
void CreateAudioEncoderUplinkPacketLossFractionGraph(Plot* plot); void CreateAudioEncoderPacketLossGraph(Plot* plot);
void CreateAudioEncoderEnableFecGraph(Plot* plot); void CreateAudioEncoderEnableFecGraph(Plot* plot);
void CreateAudioEncoderEnableDtxGraph(Plot* plot); void CreateAudioEncoderEnableDtxGraph(Plot* plot);
void CreateAudioEncoderNumChannelsGraph(Plot* plot); void CreateAudioEncoderNumChannelsGraph(Plot* plot);

View File

@ -18,64 +18,87 @@
#include "webrtc/test/field_trial.h" #include "webrtc/test/field_trial.h"
#include "webrtc/test/testsupport/fileutils.h" #include "webrtc/test/testsupport/fileutils.h"
DEFINE_bool(incoming, true, "Plot statistics for incoming packets."); DEFINE_string(plot_profile,
DEFINE_bool(outgoing, true, "Plot statistics for outgoing packets."); "default",
DEFINE_bool(plot_all, true, "Plot all different data types."); "A profile that selects a certain subset of the plots. Currently "
DEFINE_bool(plot_packets, "defined profiles are \"all\", \"none\" and \"default\"");
DEFINE_bool(plot_incoming_packet_sizes,
false, false,
"Plot bar graph showing the size of each packet."); "Plot bar graph showing the size of each incoming packet.");
DEFINE_bool(plot_outgoing_packet_sizes,
false,
"Plot bar graph showing the size of each outgoing packet.");
DEFINE_bool(plot_incoming_packet_count,
false,
"Plot the accumulated number of packets for each incoming stream.");
DEFINE_bool(plot_outgoing_packet_count,
false,
"Plot the accumulated number of packets for each outgoing stream.");
DEFINE_bool(plot_audio_playout, DEFINE_bool(plot_audio_playout,
false, false,
"Plot bar graph showing the time between each audio playout."); "Plot bar graph showing the time between each audio playout.");
DEFINE_bool(plot_audio_level, DEFINE_bool(plot_audio_level,
false, false,
"Plot line graph showing the audio level."); "Plot line graph showing the audio level of incoming audio.");
DEFINE_bool(plot_incoming_sequence_number_delta,
false,
"Plot the sequence number difference between consecutive incoming "
"packets.");
DEFINE_bool( DEFINE_bool(
plot_sequence_number, plot_incoming_delay_delta,
false,
"Plot the difference in sequence number between consecutive packets.");
DEFINE_bool(
plot_delay_change,
false, false,
"Plot the difference in 1-way path delay between consecutive packets."); "Plot the difference in 1-way path delay between consecutive packets.");
DEFINE_bool(plot_accumulated_delay_change, DEFINE_bool(plot_incoming_delay,
true,
"Plot the 1-way path delay for incoming packets, normalized so "
"that the first packet has delay 0.");
DEFINE_bool(plot_incoming_loss_rate,
true,
"Compute the loss rate for incoming packets using a method that's "
"similar to the one used for RTCP SR and RR fraction lost. Note "
"that the loss rate can be negative if packets are duplicated or "
"reordered.");
DEFINE_bool(plot_incoming_bitrate,
true,
"Plot the total bitrate used by all incoming streams.");
DEFINE_bool(plot_outgoing_bitrate,
true,
"Plot the total bitrate used by all outgoing streams.");
DEFINE_bool(plot_incoming_stream_bitrate,
true,
"Plot the bitrate used by each incoming stream.");
DEFINE_bool(plot_outgoing_stream_bitrate,
true,
"Plot the bitrate used by each outgoing stream.");
DEFINE_bool(plot_simulated_sendside_bwe,
false, false,
"Plot the accumulated 1-way path delay change, or the path delay " "Run the send-side bandwidth estimator with the outgoing rtp and "
"change compared to the first packet."); "incoming rtcp and plot the resulting estimate.");
DEFINE_bool(plot_total_bitrate,
false,
"Plot the total bitrate used by all streams.");
DEFINE_bool(plot_stream_bitrate,
false,
"Plot the bitrate used by each stream.");
DEFINE_bool(plot_bwe,
false,
"Run the bandwidth estimator with the logged rtp and rtcp and plot "
"the output.");
DEFINE_bool(plot_network_delay_feedback, DEFINE_bool(plot_network_delay_feedback,
false, true,
"Compute network delay based on sent packets and the received " "Compute network delay based on sent packets and the received "
"transport feedback."); "transport feedback.");
DEFINE_bool(plot_fraction_loss, DEFINE_bool(plot_fraction_loss_feedback,
false, true,
"Plot packet loss in percent for outgoing packets (as perceived by " "Plot packet loss in percent for outgoing packets (as perceived by "
"the send-side bandwidth estimator)."); "the send-side bandwidth estimator).");
DEFINE_bool(plot_timestamps, DEFINE_bool(plot_timestamps,
false, false,
"Plot the rtp timestamps of all rtp and rtcp packets over time."); "Plot the rtp timestamps of all rtp and rtcp packets over time.");
DEFINE_bool(audio_encoder_bitrate_bps, DEFINE_bool(plot_audio_encoder_bitrate_bps,
false, false,
"Plot the audio encoder target bitrate."); "Plot the audio encoder target bitrate.");
DEFINE_bool(audio_encoder_frame_length_ms, DEFINE_bool(plot_audio_encoder_frame_length_ms,
false, false,
"Plot the audio encoder frame length."); "Plot the audio encoder frame length.");
DEFINE_bool( DEFINE_bool(
audio_encoder_uplink_packet_loss_fraction, plot_audio_encoder_packet_loss,
false, false,
"Plot the uplink packet loss fraction which is send to the audio encoder."); "Plot the uplink packet loss fraction which is sent to the audio encoder.");
DEFINE_bool(audio_encoder_fec, false, "Plot the audio encoder FEC."); DEFINE_bool(plot_audio_encoder_fec, false, "Plot the audio encoder FEC.");
DEFINE_bool(audio_encoder_dtx, false, "Plot the audio encoder DTX."); DEFINE_bool(plot_audio_encoder_dtx, false, "Plot the audio encoder DTX.");
DEFINE_bool(audio_encoder_num_channels, DEFINE_bool(plot_audio_encoder_num_channels,
false, false,
"Plot the audio encoder number of channels."); "Plot the audio encoder number of channels.");
DEFINE_bool(plot_audio_jitter_buffer, DEFINE_bool(plot_audio_jitter_buffer,
@ -90,10 +113,13 @@ DEFINE_string(
"trials are separated by \"/\""); "trials are separated by \"/\"");
DEFINE_bool(help, false, "prints this message"); DEFINE_bool(help, false, "prints this message");
DEFINE_bool( DEFINE_bool(show_detector_state,
show_detector_state, false,
false, "Show the state of the delay based BWE detector on the total "
"Mark the delay based bwe detector state on the total bitrate graph"); "bitrate graph");
void SetAllPlotFlags(bool setting);
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
std::string program_name = argv[0]; std::string program_name = argv[0];
@ -102,7 +128,24 @@ int main(int argc, char* argv[]) {
"Example usage:\n" + "Example usage:\n" +
program_name + " <logfile> | python\n" + "Run " + program_name + program_name + " <logfile> | python\n" + "Run " + program_name +
" --help for a list of command line options\n"; " --help for a list of command line options\n";
// Parse command line flags without removing them. We're only interested in
// the |plot_profile| flag.
rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false);
if (strcmp(FLAG_plot_profile, "all") == 0) {
SetAllPlotFlags(true);
} else if (strcmp(FLAG_plot_profile, "none") == 0) {
SetAllPlotFlags(false);
} else if (strcmp(FLAG_plot_profile, "default") == 0) {
// Do nothing.
} else {
rtc::Flag* plot_profile_flag = rtc::FlagList::Lookup("plot_profile");
RTC_CHECK(plot_profile_flag);
plot_profile_flag->Print(false);
}
// Parse the remaining flags. They are applied relative to the chosen profile.
rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true); rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
if (argc != 2 || FLAG_help) { if (argc != 2 || FLAG_help) {
// Print usage information. // Print usage information.
std::cout << usage; std::cout << usage;
@ -129,118 +172,89 @@ int main(int argc, char* argv[]) {
std::unique_ptr<webrtc::plotting::PlotCollection> collection( std::unique_ptr<webrtc::plotting::PlotCollection> collection(
new webrtc::plotting::PythonPlotCollection()); new webrtc::plotting::PythonPlotCollection());
if (FLAG_plot_all || FLAG_plot_packets) { if (FLAG_plot_incoming_packet_sizes) {
if (FLAG_incoming) { analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket,
analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket, collection->AppendNewPlot());
collection->AppendNewPlot());
analyzer.CreateAccumulatedPacketsGraph(
webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
}
if (FLAG_outgoing) {
analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
analyzer.CreateAccumulatedPacketsGraph(
webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
}
} }
if (FLAG_plot_outgoing_packet_sizes) {
if (FLAG_plot_all || FLAG_plot_audio_playout) { analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
}
if (FLAG_plot_incoming_packet_count) {
analyzer.CreateAccumulatedPacketsGraph(
webrtc::PacketDirection::kIncomingPacket, collection->AppendNewPlot());
}
if (FLAG_plot_outgoing_packet_count) {
analyzer.CreateAccumulatedPacketsGraph(
webrtc::PacketDirection::kOutgoingPacket, collection->AppendNewPlot());
}
if (FLAG_plot_audio_playout) {
analyzer.CreatePlayoutGraph(collection->AppendNewPlot()); analyzer.CreatePlayoutGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_audio_level) {
if (FLAG_plot_all || FLAG_plot_audio_level) {
analyzer.CreateAudioLevelGraph(collection->AppendNewPlot()); analyzer.CreateAudioLevelGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_incoming_sequence_number_delta) {
if (FLAG_plot_all || FLAG_plot_sequence_number) { analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
if (FLAG_incoming) {
analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
}
} }
if (FLAG_plot_incoming_delay_delta) {
if (FLAG_plot_all || FLAG_plot_delay_change) { analyzer.CreateIncomingDelayDeltaGraph(collection->AppendNewPlot());
if (FLAG_incoming) {
analyzer.CreateDelayChangeGraph(collection->AppendNewPlot());
}
} }
if (FLAG_plot_incoming_delay) {
if (FLAG_plot_all || FLAG_plot_accumulated_delay_change) { analyzer.CreateIncomingDelayGraph(collection->AppendNewPlot());
if (FLAG_incoming) {
analyzer.CreateAccumulatedDelayChangeGraph(collection->AppendNewPlot());
}
} }
if (FLAG_plot_incoming_loss_rate) {
if (FLAG_plot_all || FLAG_plot_fraction_loss) {
analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot()); analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_incoming_bitrate) {
if (FLAG_plot_all || FLAG_plot_total_bitrate) { analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
if (FLAG_incoming) { collection->AppendNewPlot(),
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket, FLAG_show_detector_state);
collection->AppendNewPlot(),
FLAG_show_detector_state);
}
if (FLAG_outgoing) {
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot(),
FLAG_show_detector_state);
}
} }
if (FLAG_plot_outgoing_bitrate) {
if (FLAG_plot_all || FLAG_plot_stream_bitrate) { analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
if (FLAG_incoming) { collection->AppendNewPlot(),
analyzer.CreateStreamBitrateGraph( FLAG_show_detector_state);
webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
}
if (FLAG_outgoing) {
analyzer.CreateStreamBitrateGraph(
webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
}
} }
if (FLAG_plot_incoming_stream_bitrate) {
if (FLAG_plot_all || FLAG_plot_bwe) { analyzer.CreateStreamBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
}
if (FLAG_plot_outgoing_stream_bitrate) {
analyzer.CreateStreamBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
}
if (FLAG_plot_simulated_sendside_bwe) {
analyzer.CreateBweSimulationGraph(collection->AppendNewPlot()); analyzer.CreateBweSimulationGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_network_delay_feedback) {
if (FLAG_plot_all || FLAG_plot_network_delay_feedback) {
analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot()); analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_fraction_loss_feedback) {
if (FLAG_plot_all || FLAG_plot_timestamps) { analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
}
if (FLAG_plot_timestamps) {
analyzer.CreateTimestampGraph(collection->AppendNewPlot()); analyzer.CreateTimestampGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_audio_encoder_bitrate_bps) {
if (FLAG_plot_all || FLAG_audio_encoder_bitrate_bps) {
analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot()); analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_audio_encoder_frame_length_ms) {
if (FLAG_plot_all || FLAG_audio_encoder_frame_length_ms) {
analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot()); analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_audio_encoder_packet_loss) {
if (FLAG_plot_all || FLAG_audio_encoder_uplink_packet_loss_fraction) { analyzer.CreateAudioEncoderPacketLossGraph(collection->AppendNewPlot());
analyzer.CreateAudioEncoderUplinkPacketLossFractionGraph(
collection->AppendNewPlot());
} }
if (FLAG_plot_audio_encoder_fec) {
if (FLAG_plot_all || FLAG_audio_encoder_fec) {
analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot()); analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_audio_encoder_dtx) {
if (FLAG_plot_all || FLAG_audio_encoder_dtx) {
analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot()); analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_audio_encoder_num_channels) {
if (FLAG_plot_all || FLAG_audio_encoder_num_channels) {
analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot()); analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot());
} }
if (FLAG_plot_audio_jitter_buffer) {
if (FLAG_plot_all || FLAG_plot_audio_jitter_buffer) {
analyzer.CreateAudioJitterBufferGraph( analyzer.CreateAudioJitterBufferGraph(
webrtc::test::ResourcePath( webrtc::test::ResourcePath(
"audio_processing/conversational_speech/EN_script2_F_sp2_B1", "audio_processing/conversational_speech/EN_script2_F_sp2_B1",
@ -252,3 +266,32 @@ int main(int argc, char* argv[]) {
return 0; return 0;
} }
void SetAllPlotFlags(bool setting) {
FLAG_plot_incoming_packet_sizes = setting;
FLAG_plot_outgoing_packet_sizes = setting;
FLAG_plot_incoming_packet_count = setting;
FLAG_plot_outgoing_packet_count = setting;
FLAG_plot_audio_playout = setting;
FLAG_plot_audio_level = setting;
FLAG_plot_incoming_sequence_number_delta = setting;
FLAG_plot_incoming_delay_delta = setting;
FLAG_plot_incoming_delay = setting;
FLAG_plot_incoming_loss_rate = setting;
FLAG_plot_incoming_bitrate = setting;
FLAG_plot_outgoing_bitrate = setting;
FLAG_plot_incoming_stream_bitrate = setting;
FLAG_plot_outgoing_stream_bitrate = setting;
FLAG_plot_simulated_sendside_bwe = setting;
FLAG_plot_network_delay_feedback = setting;
FLAG_plot_fraction_loss_feedback = setting;
FLAG_plot_timestamps = setting;
FLAG_plot_audio_encoder_bitrate_bps = setting;
FLAG_plot_audio_encoder_frame_length_ms = setting;
FLAG_plot_audio_encoder_packet_loss = setting;
FLAG_plot_audio_encoder_fec = setting;
FLAG_plot_audio_encoder_dtx = setting;
FLAG_plot_audio_encoder_num_channels = setting;
FLAG_plot_audio_jitter_buffer = setting;
}