OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <iostream> | 11 #include <iostream> |
12 | 12 |
13 #include "gflags/gflags.h" | 13 #include "webrtc/base/flags.h" |
14 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" | 14 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" |
15 #include "webrtc/test/field_trial.h" | 15 #include "webrtc/test/field_trial.h" |
16 #include "webrtc/tools/event_log_visualizer/analyzer.h" | 16 #include "webrtc/tools/event_log_visualizer/analyzer.h" |
17 #include "webrtc/tools/event_log_visualizer/plot_base.h" | 17 #include "webrtc/tools/event_log_visualizer/plot_base.h" |
18 #include "webrtc/tools/event_log_visualizer/plot_python.h" | 18 #include "webrtc/tools/event_log_visualizer/plot_python.h" |
19 | 19 |
20 DEFINE_bool(incoming, true, "Plot statistics for incoming packets."); | 20 DEFINE_bool(incoming, true, "Plot statistics for incoming packets."); |
21 DEFINE_bool(outgoing, true, "Plot statistics for outgoing packets."); | 21 DEFINE_bool(outgoing, true, "Plot statistics for outgoing packets."); |
22 DEFINE_bool(plot_all, true, "Plot all different data types."); | 22 DEFINE_bool(plot_all, true, "Plot all different data types."); |
23 DEFINE_bool(plot_packets, | 23 DEFINE_bool(plot_packets, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 DEFINE_bool(audio_encoder_num_channels, | 77 DEFINE_bool(audio_encoder_num_channels, |
78 false, | 78 false, |
79 "Plot the audio encoder number of channels."); | 79 "Plot the audio encoder number of channels."); |
80 DEFINE_string( | 80 DEFINE_string( |
81 force_fieldtrials, | 81 force_fieldtrials, |
82 "", | 82 "", |
83 "Field trials control experimental feature code which can be forced. " | 83 "Field trials control experimental feature code which can be forced. " |
84 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/" | 84 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/" |
85 " will assign the group Enabled to field trial WebRTC-FooFeature. Multiple " | 85 " will assign the group Enabled to field trial WebRTC-FooFeature. Multiple " |
86 "trials are separated by \"/\""); | 86 "trials are separated by \"/\""); |
| 87 DEFINE_bool(help, false, "prints this message"); |
87 | 88 |
88 int main(int argc, char* argv[]) { | 89 int main(int argc, char* argv[]) { |
89 std::string program_name = argv[0]; | 90 std::string program_name = argv[0]; |
90 std::string usage = | 91 std::string usage = |
91 "A tool for visualizing WebRTC event logs.\n" | 92 "A tool for visualizing WebRTC event logs.\n" |
92 "Example usage:\n" + | 93 "Example usage:\n" + |
93 program_name + " <logfile> | python\n" + "Run " + program_name + | 94 program_name + " <logfile> | python\n" + "Run " + program_name + |
94 " --help for a list of command line options\n"; | 95 " --help for a list of command line options\n"; |
95 google::SetUsageMessage(usage); | 96 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
96 google::ParseCommandLineFlags(&argc, &argv, true); | 97 if (FLAG_help) { |
| 98 rtc::FlagList::Print(nullptr, false); |
| 99 return 0; |
| 100 } |
97 | 101 |
98 if (argc != 2) { | 102 if (argc != 2) { |
99 // Print usage information. | 103 // Print usage information. |
100 std::cout << google::ProgramUsage(); | 104 std::cout << usage; |
101 return 0; | 105 return 0; |
102 } | 106 } |
103 | 107 |
104 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); | 108 webrtc::test::InitFieldTrialsFromString(FLAG_force_fieldtrials); |
105 | 109 |
106 std::string filename = argv[1]; | 110 std::string filename = argv[1]; |
107 | 111 |
108 webrtc::ParsedRtcEventLog parsed_log; | 112 webrtc::ParsedRtcEventLog parsed_log; |
109 | 113 |
110 if (!parsed_log.ParseFile(filename)) { | 114 if (!parsed_log.ParseFile(filename)) { |
111 std::cerr << "Could not parse the entire log file." << std::endl; | 115 std::cerr << "Could not parse the entire log file." << std::endl; |
112 std::cerr << "Proceeding to analyze the first " | 116 std::cerr << "Proceeding to analyze the first " |
113 << parsed_log.GetNumberOfEvents() << " events in the file." | 117 << parsed_log.GetNumberOfEvents() << " events in the file." |
114 << std::endl; | 118 << std::endl; |
115 } | 119 } |
116 | 120 |
117 webrtc::plotting::EventLogAnalyzer analyzer(parsed_log); | 121 webrtc::plotting::EventLogAnalyzer analyzer(parsed_log); |
118 std::unique_ptr<webrtc::plotting::PlotCollection> collection( | 122 std::unique_ptr<webrtc::plotting::PlotCollection> collection( |
119 new webrtc::plotting::PythonPlotCollection()); | 123 new webrtc::plotting::PythonPlotCollection()); |
120 | 124 |
121 if (FLAGS_plot_all || FLAGS_plot_packets) { | 125 if (FLAG_plot_all || FLAG_plot_packets) { |
122 if (FLAGS_incoming) { | 126 if (FLAG_incoming) { |
123 analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket, | 127 analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket, |
124 collection->AppendNewPlot()); | 128 collection->AppendNewPlot()); |
125 analyzer.CreateAccumulatedPacketsGraph( | 129 analyzer.CreateAccumulatedPacketsGraph( |
126 webrtc::PacketDirection::kIncomingPacket, | 130 webrtc::PacketDirection::kIncomingPacket, |
127 collection->AppendNewPlot()); | 131 collection->AppendNewPlot()); |
128 } | 132 } |
129 if (FLAGS_outgoing) { | 133 if (FLAG_outgoing) { |
130 analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket, | 134 analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket, |
131 collection->AppendNewPlot()); | 135 collection->AppendNewPlot()); |
132 analyzer.CreateAccumulatedPacketsGraph( | 136 analyzer.CreateAccumulatedPacketsGraph( |
133 webrtc::PacketDirection::kOutgoingPacket, | 137 webrtc::PacketDirection::kOutgoingPacket, |
134 collection->AppendNewPlot()); | 138 collection->AppendNewPlot()); |
135 } | 139 } |
136 } | 140 } |
137 | 141 |
138 if (FLAGS_plot_all || FLAGS_plot_audio_playout) { | 142 if (FLAG_plot_all || FLAG_plot_audio_playout) { |
139 analyzer.CreatePlayoutGraph(collection->AppendNewPlot()); | 143 analyzer.CreatePlayoutGraph(collection->AppendNewPlot()); |
140 } | 144 } |
141 | 145 |
142 if (FLAGS_plot_all || FLAGS_plot_audio_level) { | 146 if (FLAG_plot_all || FLAG_plot_audio_level) { |
143 analyzer.CreateAudioLevelGraph(collection->AppendNewPlot()); | 147 analyzer.CreateAudioLevelGraph(collection->AppendNewPlot()); |
144 } | 148 } |
145 | 149 |
146 if (FLAGS_plot_all || FLAGS_plot_sequence_number) { | 150 if (FLAG_plot_all || FLAG_plot_sequence_number) { |
147 if (FLAGS_incoming) { | 151 if (FLAG_incoming) { |
148 analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot()); | 152 analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot()); |
149 } | 153 } |
150 } | 154 } |
151 | 155 |
152 if (FLAGS_plot_all || FLAGS_plot_delay_change) { | 156 if (FLAG_plot_all || FLAG_plot_delay_change) { |
153 if (FLAGS_incoming) { | 157 if (FLAG_incoming) { |
154 analyzer.CreateDelayChangeGraph(collection->AppendNewPlot()); | 158 analyzer.CreateDelayChangeGraph(collection->AppendNewPlot()); |
155 } | 159 } |
156 } | 160 } |
157 | 161 |
158 if (FLAGS_plot_all || FLAGS_plot_accumulated_delay_change) { | 162 if (FLAG_plot_all || FLAG_plot_accumulated_delay_change) { |
159 if (FLAGS_incoming) { | 163 if (FLAG_incoming) { |
160 analyzer.CreateAccumulatedDelayChangeGraph(collection->AppendNewPlot()); | 164 analyzer.CreateAccumulatedDelayChangeGraph(collection->AppendNewPlot()); |
161 } | 165 } |
162 } | 166 } |
163 | 167 |
164 if (FLAGS_plot_all || FLAGS_plot_fraction_loss) { | 168 if (FLAG_plot_all || FLAG_plot_fraction_loss) { |
165 analyzer.CreateFractionLossGraph(collection->AppendNewPlot()); | 169 analyzer.CreateFractionLossGraph(collection->AppendNewPlot()); |
166 analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot()); | 170 analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot()); |
167 } | 171 } |
168 | 172 |
169 if (FLAGS_plot_all || FLAGS_plot_total_bitrate) { | 173 if (FLAG_plot_all || FLAG_plot_total_bitrate) { |
170 if (FLAGS_incoming) { | 174 if (FLAG_incoming) { |
171 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket, | 175 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket, |
172 collection->AppendNewPlot()); | 176 collection->AppendNewPlot()); |
173 } | 177 } |
174 if (FLAGS_outgoing) { | 178 if (FLAG_outgoing) { |
175 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket, | 179 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket, |
176 collection->AppendNewPlot()); | 180 collection->AppendNewPlot()); |
177 } | 181 } |
178 } | 182 } |
179 | 183 |
180 if (FLAGS_plot_all || FLAGS_plot_stream_bitrate) { | 184 if (FLAG_plot_all || FLAG_plot_stream_bitrate) { |
181 if (FLAGS_incoming) { | 185 if (FLAG_incoming) { |
182 analyzer.CreateStreamBitrateGraph( | 186 analyzer.CreateStreamBitrateGraph( |
183 webrtc::PacketDirection::kIncomingPacket, | 187 webrtc::PacketDirection::kIncomingPacket, |
184 collection->AppendNewPlot()); | 188 collection->AppendNewPlot()); |
185 } | 189 } |
186 if (FLAGS_outgoing) { | 190 if (FLAG_outgoing) { |
187 analyzer.CreateStreamBitrateGraph( | 191 analyzer.CreateStreamBitrateGraph( |
188 webrtc::PacketDirection::kOutgoingPacket, | 192 webrtc::PacketDirection::kOutgoingPacket, |
189 collection->AppendNewPlot()); | 193 collection->AppendNewPlot()); |
190 } | 194 } |
191 } | 195 } |
192 | 196 |
193 if (FLAGS_plot_all || FLAGS_plot_bwe) { | 197 if (FLAG_plot_all || FLAG_plot_bwe) { |
194 analyzer.CreateBweSimulationGraph(collection->AppendNewPlot()); | 198 analyzer.CreateBweSimulationGraph(collection->AppendNewPlot()); |
195 } | 199 } |
196 | 200 |
197 if (FLAGS_plot_all || FLAGS_plot_network_delay_feedback) { | 201 if (FLAG_plot_all || FLAG_plot_network_delay_feedback) { |
198 analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot()); | 202 analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot()); |
199 } | 203 } |
200 | 204 |
201 if (FLAGS_plot_all || FLAGS_plot_timestamps) { | 205 if (FLAG_plot_all || FLAG_plot_timestamps) { |
202 analyzer.CreateTimestampGraph(collection->AppendNewPlot()); | 206 analyzer.CreateTimestampGraph(collection->AppendNewPlot()); |
203 } | 207 } |
204 | 208 |
205 if (FLAGS_plot_all || FLAGS_audio_encoder_bitrate_bps) { | 209 if (FLAG_plot_all || FLAG_audio_encoder_bitrate_bps) { |
206 analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot()); | 210 analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot()); |
207 } | 211 } |
208 | 212 |
209 if (FLAGS_plot_all || FLAGS_audio_encoder_frame_length_ms) { | 213 if (FLAG_plot_all || FLAG_audio_encoder_frame_length_ms) { |
210 analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot()); | 214 analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot()); |
211 } | 215 } |
212 | 216 |
213 if (FLAGS_plot_all || FLAGS_audio_encoder_uplink_packet_loss_fraction) { | 217 if (FLAG_plot_all || FLAG_audio_encoder_uplink_packet_loss_fraction) { |
214 analyzer.CreateAudioEncoderUplinkPacketLossFractionGraph( | 218 analyzer.CreateAudioEncoderUplinkPacketLossFractionGraph( |
215 collection->AppendNewPlot()); | 219 collection->AppendNewPlot()); |
216 } | 220 } |
217 | 221 |
218 if (FLAGS_plot_all || FLAGS_audio_encoder_fec) { | 222 if (FLAG_plot_all || FLAG_audio_encoder_fec) { |
219 analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot()); | 223 analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot()); |
220 } | 224 } |
221 | 225 |
222 if (FLAGS_plot_all || FLAGS_audio_encoder_dtx) { | 226 if (FLAG_plot_all || FLAG_audio_encoder_dtx) { |
223 analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot()); | 227 analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot()); |
224 } | 228 } |
225 | 229 |
226 if (FLAGS_plot_all || FLAGS_audio_encoder_num_channels) { | 230 if (FLAG_plot_all || FLAG_audio_encoder_num_channels) { |
227 analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot()); | 231 analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot()); |
228 } | 232 } |
229 | 233 |
230 collection->Draw(); | 234 collection->Draw(); |
231 | 235 |
232 return 0; | 236 return 0; |
233 } | 237 } |
OLD | NEW |