Chromium Code Reviews| Index: webrtc/tools/event_log_visualizer/plot_base.h |
| diff --git a/webrtc/tools/event_log_visualizer/plot_base.h b/webrtc/tools/event_log_visualizer/plot_base.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ad963b4d36d5cab8959b15fcc81646ac09de0190 |
| --- /dev/null |
| +++ b/webrtc/tools/event_log_visualizer/plot_base.h |
| @@ -0,0 +1,70 @@ |
| +/* |
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| +#ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
| +#define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
| + |
| +#include <memory> |
| +#include <string> |
| +#include <utility> |
| +#include <vector> |
| + |
| +namespace webrtc { |
| +namespace plotting { |
| + |
| +enum PlotStyle { LINE_GRAPH, BAR_GRAPH }; |
| + |
| +struct TimeSeriesPoint { |
| + TimeSeriesPoint(float x_, float y_) : x(x_), y(y_) {} |
|
stefan-webrtc
2016/05/31 18:53:40
I don't think the _ are needed?
terelius
2016/06/14 13:18:49
Done.
|
| + TimeSeriesPoint(float x_, float y_, std::string message_) |
| + : x(x_), y(y_), message(message_) {} |
| + float x; |
| + float y; |
| + std::string message; |
| +}; |
| + |
| +struct TimeSeries { |
| + std::string label; |
| + PlotStyle style; |
| + std::vector<TimeSeriesPoint> points; |
| + void swap(TimeSeries& other) { |
| + label.swap(other.label); |
| + std::swap(style, other.style); |
| + points.swap(other.points); |
|
aleloi
2016/06/08 11:44:20
Use std::swap in all cases for consistency. It is
terelius
2016/06/14 13:18:49
Done.
|
| + } |
| +}; |
| + |
| +class Plot { |
| + public: |
| + virtual ~Plot() {} |
| + virtual void draw() = 0; |
| + |
| + public: |
|
stefan-webrtc
2016/05/31 18:53:40
Private?
terelius
2016/06/14 13:18:49
The members are set by all the CreateGraph() funct
|
| + float xaxis_min; |
| + float xaxis_max; |
| + std::string xaxis_label; |
| + float yaxis_min; |
| + float yaxis_max; |
| + std::string yaxis_label; |
| + std::vector<TimeSeries> series; |
| + std::string title; |
| +}; |
| + |
| +class PlotCollection { |
| + public: |
| + virtual ~PlotCollection() {} |
| + virtual void draw() = 0; |
| + virtual void append_plot() = 0; |
| + std::vector<std::unique_ptr<Plot> > plots; |
|
stefan-webrtc
2016/05/31 18:53:40
Would probably make sense to make this private, ri
aleloi
2016/06/08 11:44:20
It is accessed in the main function and in analysi
terelius
2016/06/14 13:18:49
The abstract representation of a graph should not
terelius
2016/06/14 13:18:49
It would have to be protected since we want to acc
|
| +}; |
| + |
| +} // namespace plotting |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |