diff --git a/webrtc/tools/BUILD.gn b/webrtc/tools/BUILD.gn index c5f581f13b..04c4543b0a 100644 --- a/webrtc/tools/BUILD.gn +++ b/webrtc/tools/BUILD.gn @@ -136,9 +136,9 @@ rtc_executable("force_mic_volume_max") { } if (rtc_enable_protobuf) { - proto_library("graph_proto") { + proto_library("chart_proto") { sources = [ - "event_log_visualizer/graph.proto", + "event_log_visualizer/chart.proto", ] proto_out_dir = "webrtc/tools/event_log_visualizer" } @@ -169,7 +169,7 @@ if (rtc_enable_protobuf) { "//build/config/sanitizers:deps", ] public_deps = [ - ":graph_proto", + ":chart_proto", "../:rtc_event_log_parser", ] } diff --git a/webrtc/tools/event_log_visualizer/chart.proto b/webrtc/tools/event_log_visualizer/chart.proto new file mode 100644 index 0000000000..685b4bd762 --- /dev/null +++ b/webrtc/tools/event_log_visualizer/chart.proto @@ -0,0 +1,36 @@ +// Describes a chart generated from WebRTC event log data. +syntax = "proto3"; +option optimize_for = LITE_RUNTIME; + +package webrtc.analytics; + +message ChartStyle { + enum Type { + UNDEFINED = 0; + LINE_CHART = 1; + BAR_CHART = 2; + } +} + +message DataSet { + repeated float x_values = 1; + repeated float y_values = 2; + string label = 3; + ChartStyle.Type style = 4; + bool highlight_points = 5; +} + +message Chart { + repeated DataSet data_sets = 1; + float xaxis_min = 2; + float xaxis_max = 3; + string xaxis_label = 4; + float yaxis_min = 5; + float yaxis_max = 6; + string yaxis_label = 7; + string title = 8; +} + +message ChartCollection { + repeated Chart charts = 1; +} \ No newline at end of file diff --git a/webrtc/tools/event_log_visualizer/graph.proto b/webrtc/tools/event_log_visualizer/graph.proto deleted file mode 100644 index 3b02848913..0000000000 --- a/webrtc/tools/event_log_visualizer/graph.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto2"; -option optimize_for = LITE_RUNTIME; -package webrtc.protobuf_plot; - -enum PlotStyle { - UNDEFINED = 0; - LINE_GRAPH = 1; - LINE_DOT_GRAPH = 2; - BAR_GRAPH = 3; -}; - -message DataSet { - repeated float xvalues = 1; - repeated float yvalues = 2; - optional string label = 3; - optional PlotStyle style = 4; -} - -message Plot { - repeated DataSet data_sets = 1; - optional float xaxis_min = 2; - optional float xaxis_max = 3; - optional string xaxis_label = 4; - optional float yaxis_min = 5; - optional float yaxis_max = 6; - optional string yaxis_label = 7; - optional string title = 8; -} - -message PlotCollection { - repeated Plot plots = 1; -} \ No newline at end of file diff --git a/webrtc/tools/event_log_visualizer/plot_protobuf.cc b/webrtc/tools/event_log_visualizer/plot_protobuf.cc index 7f032c11b8..e6e1adc703 100644 --- a/webrtc/tools/event_log_visualizer/plot_protobuf.cc +++ b/webrtc/tools/event_log_visualizer/plot_protobuf.cc @@ -21,36 +21,37 @@ ProtobufPlot::~ProtobufPlot() {} void ProtobufPlot::Draw() {} -void ProtobufPlot::ExportProtobuf(protobuf_plot::Plot* plot) { +void ProtobufPlot::ExportProtobuf(webrtc::analytics::Chart* chart) { for (size_t i = 0; i < series_list_.size(); i++) { - protobuf_plot::DataSet* data_set = plot->add_data_sets(); + webrtc::analytics::DataSet* data_set = chart->add_data_sets(); for (const auto& point : series_list_[i].points) { - data_set->add_xvalues(point.x); + data_set->add_x_values(point.x); } for (const auto& point : series_list_[i].points) { - data_set->add_yvalues(point.y); + data_set->add_y_values(point.y); } if (series_list_[i].style == BAR_GRAPH) { - data_set->set_style(protobuf_plot::BAR_GRAPH); + data_set->set_style(webrtc::analytics::ChartStyle::BAR_CHART); } else if (series_list_[i].style == LINE_GRAPH) { - data_set->set_style(protobuf_plot::LINE_GRAPH); + data_set->set_style(webrtc::analytics::ChartStyle::LINE_CHART); } else if (series_list_[i].style == LINE_DOT_GRAPH) { - data_set->set_style(protobuf_plot::LINE_DOT_GRAPH); + data_set->set_style(webrtc::analytics::ChartStyle::LINE_CHART); + data_set->set_highlight_points(true); } else { - data_set->set_style(protobuf_plot::UNDEFINED); + data_set->set_style(webrtc::analytics::ChartStyle::UNDEFINED); } data_set->set_label(series_list_[i].label); } - plot->set_xaxis_min(xaxis_min_); - plot->set_xaxis_max(xaxis_max_); - plot->set_yaxis_min(yaxis_min_); - plot->set_yaxis_max(yaxis_max_); - plot->set_xaxis_label(xaxis_label_); - plot->set_yaxis_label(yaxis_label_); - plot->set_title(title_); + chart->set_xaxis_min(xaxis_min_); + chart->set_xaxis_max(xaxis_max_); + chart->set_yaxis_min(yaxis_min_); + chart->set_yaxis_max(yaxis_max_); + chart->set_xaxis_label(xaxis_label_); + chart->set_yaxis_label(yaxis_label_); + chart->set_title(title_); } ProtobufPlotCollection::ProtobufPlotCollection() {} @@ -60,12 +61,13 @@ ProtobufPlotCollection::~ProtobufPlotCollection() {} void ProtobufPlotCollection::Draw() {} void ProtobufPlotCollection::ExportProtobuf( - protobuf_plot::PlotCollection* collection) { + webrtc::analytics::ChartCollection* collection) { for (const auto& plot : plots_) { // TODO(terelius): Ensure that there is no way to insert plots other than // ProtobufPlots in a ProtobufPlotCollection. Needed to safely static_cast // here. - protobuf_plot::Plot* protobuf_representation = collection->add_plots(); + webrtc::analytics::Chart* protobuf_representation + = collection->add_charts(); static_cast(plot.get()) ->ExportProtobuf(protobuf_representation); } diff --git a/webrtc/tools/event_log_visualizer/plot_protobuf.h b/webrtc/tools/event_log_visualizer/plot_protobuf.h index 1ea525b20a..2008a228e3 100644 --- a/webrtc/tools/event_log_visualizer/plot_protobuf.h +++ b/webrtc/tools/event_log_visualizer/plot_protobuf.h @@ -10,7 +10,7 @@ #ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_ #define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_ -#include "webrtc/tools/event_log_visualizer/graph.pb.h" +#include "webrtc/tools/event_log_visualizer/chart.pb.h" #include "webrtc/tools/event_log_visualizer/plot_base.h" namespace webrtc { @@ -21,7 +21,7 @@ class ProtobufPlot final : public Plot { ProtobufPlot(); ~ProtobufPlot() override; void Draw() override; - void ExportProtobuf(protobuf_plot::Plot* plot); + void ExportProtobuf(webrtc::analytics::Chart* chart); }; class ProtobufPlotCollection final : public PlotCollection { @@ -30,7 +30,7 @@ class ProtobufPlotCollection final : public PlotCollection { ~ProtobufPlotCollection() override; void Draw() override; Plot* AppendNewPlot() override; - void ExportProtobuf(protobuf_plot::PlotCollection* collection); + void ExportProtobuf(webrtc::analytics::ChartCollection* collection); }; } // namespace plotting diff --git a/webrtc/tools/tools.gyp b/webrtc/tools/tools.gyp index 61a7d7703a..1477a83f36 100644 --- a/webrtc/tools/tools.gyp +++ b/webrtc/tools/tools.gyp @@ -102,10 +102,10 @@ ['enable_protobuf==1', { 'targets': [ { - 'target_name': 'graph_proto', + 'target_name': 'chart_proto', 'type': 'static_library', 'sources': [ - 'event_log_visualizer/graph.proto', + 'event_log_visualizer/chart.proto', ], 'variables': { 'proto_in_dir': 'event_log_visualizer', @@ -123,7 +123,7 @@ '<(webrtc_root)/modules/modules.gyp:congestion_controller', '<(webrtc_root)/modules/modules.gyp:rtp_rtcp', '<(webrtc_root)/system_wrappers/system_wrappers.gyp:metrics_default', - ':graph_proto', + ':chart_proto', ], 'sources': [ 'event_log_visualizer/analyzer.cc', @@ -137,7 +137,7 @@ ], 'export_dependent_settings': [ '<(webrtc_root)/webrtc.gyp:rtc_event_log_parser', - ':graph_proto', + ':chart_proto', ], }, ],