Chromium Code Reviews| Index: webrtc/tools/event_log_visualizer/generate_timeseries.cc |
| diff --git a/webrtc/tools/event_log_visualizer/generate_timeseries.cc b/webrtc/tools/event_log_visualizer/generate_timeseries.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d8d1e2f9687fbcfaa029dfd2ad8e204864d7e87c |
| --- /dev/null |
| +++ b/webrtc/tools/event_log_visualizer/generate_timeseries.cc |
| @@ -0,0 +1,154 @@ |
| +/* |
| + * 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. |
| + */ |
| + |
| +#include <iostream> |
| + |
| +#include "gflags/gflags.h" |
| +#include "webrtc/call/rtc_event_log_parser.h" |
| +#include "webrtc/tools/event_log_visualizer/analyzer.h" |
| +#include "webrtc/tools/event_log_visualizer/plot_base.h" |
| +#include "webrtc/tools/event_log_visualizer/plot_python.h" |
| + |
| +DEFINE_bool(enable_point_info, |
| + false, |
| + "Add extra information to each point. More memory intensive and " |
| + "potentially confusing, but can be powerful."); |
| +DEFINE_bool(incoming, true, "Plot statistics for incoming packets."); |
| +DEFINE_bool(outgoing, true, "Plot statistics for outgoing packets."); |
| +DEFINE_bool(plot_all, true, "Plot all different data types."); |
| +DEFINE_bool(plot_packets, |
| + false, |
| + "Plot bar graph showing the size of each packet."); |
| +DEFINE_bool(plot_audio_playout, |
| + false, |
| + "Plot bar graph showing the time between each audio playout."); |
| +DEFINE_bool( |
| + plot_sequence_number, |
| + false, |
| + "Plot the difference in sequence number between consecutive packets."); |
|
aleloi
2016/06/08 11:44:20
number -> numbers, although I am not certain.
terelius
2016/06/14 13:18:49
"Difference in" typically refers to a single thing
|
| +DEFINE_bool( |
| + plot_delay_change, |
| + false, |
| + "Plot the difference in 1-way path delay between consecutive packets."); |
| +DEFINE_bool(plot_accumulated_delay_change, |
| + false, |
| + "Plot the accumulated 1-way path delay change, or the path delay " |
| + "change compared to the first packet."); |
| +DEFINE_bool(plot_total_bitrate, |
| + false, |
| + "Plot the total bitrate used by all streams."); |
| +DEFINE_bool(plot_stream_bitrate, |
| + false, |
| + "Plot the bitrate used by each stream."); |
| + |
| +int main(int argc, char* argv[]) { |
| + std::string program_name = argv[0]; |
| + std::string usage = |
| + "A tool for visualizing WebRTC event logs.\n" |
| + "Example usage:\n" + |
| + program_name + " <logfile> | python\n" + "Run " + program_name + |
| + " --help for a list of command line options\n"; |
| + google::SetUsageMessage(usage); |
| + google::ParseCommandLineFlags(&argc, &argv, true); |
| + |
| + if (argc != 2) { |
| + // Print usage information. |
| + std::cout << google::ProgramUsage(); |
| + return 0; |
| + } |
| + |
| + std::string filename = argv[1]; |
| + |
| + webrtc::ParsedRtcEventLog parsed_log; |
| + |
| + if (!parsed_log.ParseFile(filename)) { |
| + std::cerr << "Could not parse the entire log file." << std::endl; |
| + std::cerr << "Proceeding to analyze the first " |
| + << parsed_log.GetNumberOfEvents() << " events in the file." |
| + << std::endl; |
| + } |
| + |
| + webrtc::plotting::EventLogAnalyzer analyzer(parsed_log, |
| + FLAGS_enable_point_info); |
| + std::unique_ptr<webrtc::plotting::PlotCollection> collection( |
| + new webrtc::plotting::PythonPlotCollection()); |
| + |
| + if (FLAGS_plot_all || FLAGS_plot_packets) { |
| + if (FLAGS_incoming) { |
| + collection->append_plot(); |
| + analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket, |
| + collection->plots.back().get()); |
| + } |
| + if (FLAGS_outgoing) { |
| + collection->append_plot(); |
| + analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket, |
| + collection->plots.back().get()); |
| + } |
| + } |
| + |
| + if (FLAGS_plot_all || FLAGS_plot_audio_playout) { |
| + collection->append_plot(); |
| + analyzer.CreatePlayoutGraph(collection->plots.back().get()); |
| + } |
| + |
| + if (FLAGS_plot_all || FLAGS_plot_sequence_number) { |
| + if (FLAGS_incoming) { |
| + collection->append_plot(); |
| + analyzer.CreateSequenceNumberGraph(collection->plots.back().get()); |
| + } |
| + } |
| + |
| + if (FLAGS_plot_all || FLAGS_plot_delay_change) { |
| + if (FLAGS_incoming) { |
| + collection->append_plot(); |
| + analyzer.CreateDelayChangeGraph(collection->plots.back().get()); |
| + } |
| + } |
| + |
| + if (FLAGS_plot_all || FLAGS_plot_accumulated_delay_change) { |
| + if (FLAGS_incoming) { |
| + collection->append_plot(); |
| + analyzer.CreateAccumulatedDelayChangeGraph( |
| + collection->plots.back().get()); |
| + } |
| + } |
| + |
| + if (FLAGS_plot_all || FLAGS_plot_total_bitrate) { |
| + if (FLAGS_incoming) { |
| + collection->append_plot(); |
| + analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket, |
| + collection->plots.back().get()); |
| + } |
| + if (FLAGS_outgoing) { |
| + collection->append_plot(); |
| + analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket, |
| + collection->plots.back().get()); |
| + } |
| + } |
| + |
| + if (FLAGS_plot_all || FLAGS_plot_stream_bitrate) { |
| + if (FLAGS_incoming) { |
| + collection->append_plot(); |
| + analyzer.CreateStreamBitrateGraph( |
| + webrtc::PacketDirection::kIncomingPacket, |
| + collection->plots.back().get()); |
| + } |
| + if (FLAGS_outgoing) { |
| + collection->append_plot(); |
| + analyzer.CreateStreamBitrateGraph( |
| + webrtc::PacketDirection::kOutgoingPacket, |
| + collection->plots.back().get()); |
|
aleloi
2016/06/08 11:44:20
Do you think it's possible to reduce the repetitio
terelius
2016/06/14 13:18:49
Followed your second suggestion and returned the n
|
| + } |
| + } |
| + |
| + collection->draw(); |
| + |
| + return 0; |
| +} |