diff --git a/rtc_tools/event_log_visualizer/main.cc b/rtc_tools/event_log_visualizer/main.cc index fb497db577..4e5534e1dc 100644 --- a/rtc_tools/event_log_visualizer/main.cc +++ b/rtc_tools/event_log_visualizer/main.cc @@ -14,6 +14,7 @@ #include "rtc_base/flags.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_protobuf.h" #include "rtc_tools/event_log_visualizer/plot_python.h" #include "system_wrappers/include/field_trial_default.h" #include "test/field_trial.h" @@ -161,6 +162,10 @@ DEFINE_bool(normalize_time, true, "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); int main(int argc, char* argv[]) { @@ -237,8 +242,12 @@ int main(int argc, char* argv[]) { } webrtc::EventLogAnalyzer analyzer(parsed_log, FLAG_normalize_time); - std::unique_ptr collection( - new webrtc::PythonPlotCollection()); + std::unique_ptr collection; + if (FLAG_protobuf_output) { + collection.reset(new webrtc::ProtobufPlotCollection()); + } else { + collection.reset(new webrtc::PythonPlotCollection()); + } if (FLAG_plot_incoming_packet_sizes) { analyzer.CreatePacketGraph(webrtc::kIncomingPacket, @@ -343,11 +352,11 @@ int main(int argc, char* argv[]) { }; analyzer.CreateSenderAndReceiverReportPlot( webrtc::kIncomingPacket, GetHighestSeqNumber, - "Highest sequence number (incoming RTCP)", "Seqence number", + "Highest sequence number (incoming RTCP)", "Sequence number", collection->AppendNewPlot()); analyzer.CreateSenderAndReceiverReportPlot( webrtc::kOutgoingPacket, GetHighestSeqNumber, - "Highest sequence number (outgoing RTCP)", "Seqence number", + "Highest sequence number (outgoing RTCP)", "Sequence number", collection->AppendNewPlot()); auto DelaySinceLastSr = diff --git a/rtc_tools/event_log_visualizer/plot_protobuf.cc b/rtc_tools/event_log_visualizer/plot_protobuf.cc index 0c4c709f83..54975e17fc 100644 --- a/rtc_tools/event_log_visualizer/plot_protobuf.cc +++ b/rtc_tools/event_log_visualizer/plot_protobuf.cc @@ -61,7 +61,11 @@ ProtobufPlotCollection::ProtobufPlotCollection() {} ProtobufPlotCollection::~ProtobufPlotCollection() {} -void ProtobufPlotCollection::Draw() {} +void ProtobufPlotCollection::Draw() { + webrtc::analytics::ChartCollection collection; + ExportProtobuf(&collection); + std::cout << collection.SerializeAsString(); +} void ProtobufPlotCollection::ExportProtobuf( webrtc::analytics::ChartCollection* collection) {