Add new step graph type to event log visualization tool. Currently used for bitrate estimate and accumulated packet count, but could in general be used for any metric that is piecewise constant.
BUG=None Review-Url: https://codereview.webrtc.org/2653343004 Cr-Commit-Position: refs/heads/master@{#16399}
This commit is contained in:
parent
a565f92e87
commit
77f0580f83
@ -555,12 +555,11 @@ void EventLogAnalyzer::CreateAccumulatedPacketsTimeSeries(
|
||||
|
||||
TimeSeries time_series;
|
||||
time_series.label = label_prefix + " " + GetStreamName(stream_id);
|
||||
time_series.style = LINE_GRAPH;
|
||||
time_series.style = LINE_STEP_GRAPH;
|
||||
|
||||
for (size_t i = 0; i < packet_stream.size(); i++) {
|
||||
float x = static_cast<float>(packet_stream[i].timestamp - begin_time_) /
|
||||
1000000;
|
||||
time_series.points.emplace_back(x, i);
|
||||
time_series.points.emplace_back(x, i + 1);
|
||||
}
|
||||
|
||||
@ -893,9 +892,8 @@ void EventLogAnalyzer::CreateTotalBitrateGraph(
|
||||
plot->series_list_.back().points.emplace_back(x, y);
|
||||
}
|
||||
plot->series_list_.back().label = "Loss-based estimate";
|
||||
plot->series_list_.back().style = LINE_GRAPH;
|
||||
plot->series_list_.back().style = LINE_STEP_GRAPH;
|
||||
}
|
||||
plot->series_list_.back().style = LINE_GRAPH;
|
||||
plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
|
||||
plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin);
|
||||
if (desired_direction == webrtc::PacketDirection::kIncomingPacket) {
|
||||
|
||||
@ -9,6 +9,7 @@ message ChartStyle {
|
||||
UNDEFINED = 0;
|
||||
LINE_CHART = 1;
|
||||
BAR_CHART = 2;
|
||||
LINE_STEP_CHART = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,4 +34,4 @@ message Chart {
|
||||
|
||||
message ChartCollection {
|
||||
repeated Chart charts = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
namespace webrtc {
|
||||
namespace plotting {
|
||||
|
||||
enum PlotStyle { LINE_GRAPH, LINE_DOT_GRAPH, BAR_GRAPH };
|
||||
enum PlotStyle { LINE_GRAPH, LINE_DOT_GRAPH, BAR_GRAPH, LINE_STEP_GRAPH };
|
||||
|
||||
struct TimeSeriesPoint {
|
||||
TimeSeriesPoint(float x, float y) : x(x), y(y) {}
|
||||
|
||||
@ -38,6 +38,8 @@ void ProtobufPlot::ExportProtobuf(webrtc::analytics::Chart* chart) {
|
||||
} else if (series_list_[i].style == LINE_DOT_GRAPH) {
|
||||
data_set->set_style(webrtc::analytics::ChartStyle::LINE_CHART);
|
||||
data_set->set_highlight_points(true);
|
||||
} else if (series_list_[i].style == LINE_STEP_GRAPH) {
|
||||
data_set->set_style(webrtc::analytics::ChartStyle::LINE_STEP_CHART);
|
||||
} else {
|
||||
data_set->set_style(webrtc::analytics::ChartStyle::UNDEFINED);
|
||||
}
|
||||
|
||||
@ -65,6 +65,16 @@ void PythonPlot::Draw() {
|
||||
"plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', "
|
||||
"marker='.')\n",
|
||||
i, i, i, series_list_[i].label.c_str());
|
||||
} else if (series_list_[i].style == LINE_STEP_GRAPH) {
|
||||
// Draw lines from (x[0],y[0]) to (x[1],y[0]) to (x[1],y[1]) and so on
|
||||
// to illustrate the "steps". This can be expressed by duplicating all
|
||||
// elements except the first in x and the last in y.
|
||||
printf("x%zu = [v for dup in x%zu for v in [dup, dup]]\n", i, i);
|
||||
printf("y%zu = [v for dup in y%zu for v in [dup, dup]]\n", i, i);
|
||||
printf(
|
||||
"plt.plot(x%zu[1:], y%zu[:-1], color=rgb_colors[%zu], "
|
||||
"label=\'%s\')\n",
|
||||
i, i, i, series_list_[i].label.c_str());
|
||||
} else {
|
||||
printf("raise Exception(\"Unknown graph type\")\n");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user