Allow printing graphs as protobuf in event_log_visualizer.

event_log_visualizer --protobuf_output <file>
will print a binary protobuf description of the graphs.

Also piggy-backing a couple of trivial spelling fixes in the same CL.

Bug: None
Change-Id: Ib000aa2706de51659ee72f13b773c4394edafe3e
Reviewed-on: https://webrtc-review.googlesource.com/99320
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24675}
This commit is contained in:
Bjorn Terelius
2018-09-10 20:11:49 +02:00
committed by Commit Bot
parent ab49982601
commit ef73f59de6
2 changed files with 18 additions and 5 deletions

View File

@ -14,6 +14,7 @@
#include "rtc_base/flags.h" #include "rtc_base/flags.h"
#include "rtc_tools/event_log_visualizer/analyzer.h" #include "rtc_tools/event_log_visualizer/analyzer.h"
#include "rtc_tools/event_log_visualizer/plot_base.h" #include "rtc_tools/event_log_visualizer/plot_base.h"
#include "rtc_tools/event_log_visualizer/plot_protobuf.h"
#include "rtc_tools/event_log_visualizer/plot_python.h" #include "rtc_tools/event_log_visualizer/plot_python.h"
#include "system_wrappers/include/field_trial_default.h" #include "system_wrappers/include/field_trial_default.h"
#include "test/field_trial.h" #include "test/field_trial.h"
@ -161,6 +162,10 @@ DEFINE_bool(normalize_time,
true, true,
"Normalize the log timestamps so that the call starts at time 0."); "Normalize the log timestamps so that the call starts at time 0.");
DEFINE_bool(protobuf_output,
false,
"Output charts as protobuf instead of python code.");
void SetAllPlotFlags(bool setting); void SetAllPlotFlags(bool setting);
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@ -237,8 +242,12 @@ int main(int argc, char* argv[]) {
} }
webrtc::EventLogAnalyzer analyzer(parsed_log, FLAG_normalize_time); webrtc::EventLogAnalyzer analyzer(parsed_log, FLAG_normalize_time);
std::unique_ptr<webrtc::PlotCollection> collection( std::unique_ptr<webrtc::PlotCollection> collection;
new webrtc::PythonPlotCollection()); if (FLAG_protobuf_output) {
collection.reset(new webrtc::ProtobufPlotCollection());
} else {
collection.reset(new webrtc::PythonPlotCollection());
}
if (FLAG_plot_incoming_packet_sizes) { if (FLAG_plot_incoming_packet_sizes) {
analyzer.CreatePacketGraph(webrtc::kIncomingPacket, analyzer.CreatePacketGraph(webrtc::kIncomingPacket,
@ -343,11 +352,11 @@ int main(int argc, char* argv[]) {
}; };
analyzer.CreateSenderAndReceiverReportPlot( analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kIncomingPacket, GetHighestSeqNumber, webrtc::kIncomingPacket, GetHighestSeqNumber,
"Highest sequence number (incoming RTCP)", "Seqence number", "Highest sequence number (incoming RTCP)", "Sequence number",
collection->AppendNewPlot()); collection->AppendNewPlot());
analyzer.CreateSenderAndReceiverReportPlot( analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kOutgoingPacket, GetHighestSeqNumber, webrtc::kOutgoingPacket, GetHighestSeqNumber,
"Highest sequence number (outgoing RTCP)", "Seqence number", "Highest sequence number (outgoing RTCP)", "Sequence number",
collection->AppendNewPlot()); collection->AppendNewPlot());
auto DelaySinceLastSr = auto DelaySinceLastSr =

View File

@ -61,7 +61,11 @@ ProtobufPlotCollection::ProtobufPlotCollection() {}
ProtobufPlotCollection::~ProtobufPlotCollection() {} ProtobufPlotCollection::~ProtobufPlotCollection() {}
void ProtobufPlotCollection::Draw() {} void ProtobufPlotCollection::Draw() {
webrtc::analytics::ChartCollection collection;
ExportProtobuf(&collection);
std::cout << collection.SerializeAsString();
}
void ProtobufPlotCollection::ExportProtobuf( void ProtobufPlotCollection::ExportProtobuf(
webrtc::analytics::ChartCollection* collection) { webrtc::analytics::ChartCollection* collection) {