OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include <iostream> |
| 12 |
| 13 #include "gflags/gflags.h" |
| 14 #include "webrtc/call/rtc_event_log_parser.h" |
| 15 #include "webrtc/tools/event_log_visualizer/analyzer.h" |
| 16 #include "webrtc/tools/event_log_visualizer/plot_base.h" |
| 17 #include "webrtc/tools/event_log_visualizer/plot_python.h" |
| 18 |
| 19 DEFINE_bool(incoming, true, "Plot statistics for incoming packets."); |
| 20 DEFINE_bool(outgoing, true, "Plot statistics for outgoing packets."); |
| 21 DEFINE_bool(plot_all, true, "Plot all different data types."); |
| 22 DEFINE_bool(plot_packets, |
| 23 false, |
| 24 "Plot bar graph showing the size of each packet."); |
| 25 DEFINE_bool(plot_audio_playout, |
| 26 false, |
| 27 "Plot bar graph showing the time between each audio playout."); |
| 28 DEFINE_bool( |
| 29 plot_sequence_number, |
| 30 false, |
| 31 "Plot the difference in sequence number between consecutive packets."); |
| 32 DEFINE_bool( |
| 33 plot_delay_change, |
| 34 false, |
| 35 "Plot the difference in 1-way path delay between consecutive packets."); |
| 36 DEFINE_bool(plot_accumulated_delay_change, |
| 37 false, |
| 38 "Plot the accumulated 1-way path delay change, or the path delay " |
| 39 "change compared to the first packet."); |
| 40 DEFINE_bool(plot_total_bitrate, |
| 41 false, |
| 42 "Plot the total bitrate used by all streams."); |
| 43 DEFINE_bool(plot_stream_bitrate, |
| 44 false, |
| 45 "Plot the bitrate used by each stream."); |
| 46 |
| 47 int main(int argc, char* argv[]) { |
| 48 std::string program_name = argv[0]; |
| 49 std::string usage = |
| 50 "A tool for visualizing WebRTC event logs.\n" |
| 51 "Example usage:\n" + |
| 52 program_name + " <logfile> | python\n" + "Run " + program_name + |
| 53 " --help for a list of command line options\n"; |
| 54 google::SetUsageMessage(usage); |
| 55 google::ParseCommandLineFlags(&argc, &argv, true); |
| 56 |
| 57 if (argc != 2) { |
| 58 // Print usage information. |
| 59 std::cout << google::ProgramUsage(); |
| 60 return 0; |
| 61 } |
| 62 |
| 63 std::string filename = argv[1]; |
| 64 |
| 65 webrtc::ParsedRtcEventLog parsed_log; |
| 66 |
| 67 if (!parsed_log.ParseFile(filename)) { |
| 68 std::cerr << "Could not parse the entire log file." << std::endl; |
| 69 std::cerr << "Proceeding to analyze the first " |
| 70 << parsed_log.GetNumberOfEvents() << " events in the file." |
| 71 << std::endl; |
| 72 } |
| 73 |
| 74 webrtc::plotting::EventLogAnalyzer analyzer(parsed_log); |
| 75 std::unique_ptr<webrtc::plotting::PlotCollection> collection( |
| 76 new webrtc::plotting::PythonPlotCollection()); |
| 77 |
| 78 if (FLAGS_plot_all || FLAGS_plot_packets) { |
| 79 if (FLAGS_incoming) { |
| 80 analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket, |
| 81 collection->append_new_plot()); |
| 82 } |
| 83 if (FLAGS_outgoing) { |
| 84 analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket, |
| 85 collection->append_new_plot()); |
| 86 } |
| 87 } |
| 88 |
| 89 if (FLAGS_plot_all || FLAGS_plot_audio_playout) { |
| 90 analyzer.CreatePlayoutGraph(collection->append_new_plot()); |
| 91 } |
| 92 |
| 93 if (FLAGS_plot_all || FLAGS_plot_sequence_number) { |
| 94 if (FLAGS_incoming) { |
| 95 analyzer.CreateSequenceNumberGraph(collection->append_new_plot()); |
| 96 } |
| 97 } |
| 98 |
| 99 if (FLAGS_plot_all || FLAGS_plot_delay_change) { |
| 100 if (FLAGS_incoming) { |
| 101 analyzer.CreateDelayChangeGraph(collection->append_new_plot()); |
| 102 } |
| 103 } |
| 104 |
| 105 if (FLAGS_plot_all || FLAGS_plot_accumulated_delay_change) { |
| 106 if (FLAGS_incoming) { |
| 107 analyzer.CreateAccumulatedDelayChangeGraph(collection->append_new_plot()); |
| 108 } |
| 109 } |
| 110 |
| 111 if (FLAGS_plot_all || FLAGS_plot_total_bitrate) { |
| 112 if (FLAGS_incoming) { |
| 113 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket, |
| 114 collection->append_new_plot()); |
| 115 } |
| 116 if (FLAGS_outgoing) { |
| 117 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket, |
| 118 collection->append_new_plot()); |
| 119 } |
| 120 } |
| 121 |
| 122 if (FLAGS_plot_all || FLAGS_plot_stream_bitrate) { |
| 123 if (FLAGS_incoming) { |
| 124 analyzer.CreateStreamBitrateGraph( |
| 125 webrtc::PacketDirection::kIncomingPacket, |
| 126 collection->append_new_plot()); |
| 127 } |
| 128 if (FLAGS_outgoing) { |
| 129 analyzer.CreateStreamBitrateGraph( |
| 130 webrtc::PacketDirection::kOutgoingPacket, |
| 131 collection->append_new_plot()); |
| 132 } |
| 133 } |
| 134 |
| 135 collection->draw(); |
| 136 |
| 137 return 0; |
| 138 } |
OLD | NEW |