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(enable_point_info, | |
20 false, | |
21 "Add extra information to each point. More memory intensive and " | |
22 "potentially confusing, but can be powerful."); | |
23 DEFINE_bool(incoming, true, "Plot statistics for incoming packets."); | |
24 DEFINE_bool(outgoing, true, "Plot statistics for outgoing packets."); | |
25 DEFINE_bool(plot_all, true, "Plot all different data types."); | |
26 DEFINE_bool(plot_packets, | |
27 false, | |
28 "Plot bar graph showing the size of each packet."); | |
29 DEFINE_bool(plot_audio_playout, | |
30 false, | |
31 "Plot bar graph showing the time between each audio playout."); | |
32 DEFINE_bool( | |
33 plot_sequence_number, | |
34 false, | |
35 "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
| |
36 DEFINE_bool( | |
37 plot_delay_change, | |
38 false, | |
39 "Plot the difference in 1-way path delay between consecutive packets."); | |
40 DEFINE_bool(plot_accumulated_delay_change, | |
41 false, | |
42 "Plot the accumulated 1-way path delay change, or the path delay " | |
43 "change compared to the first packet."); | |
44 DEFINE_bool(plot_total_bitrate, | |
45 false, | |
46 "Plot the total bitrate used by all streams."); | |
47 DEFINE_bool(plot_stream_bitrate, | |
48 false, | |
49 "Plot the bitrate used by each stream."); | |
50 | |
51 int main(int argc, char* argv[]) { | |
52 std::string program_name = argv[0]; | |
53 std::string usage = | |
54 "A tool for visualizing WebRTC event logs.\n" | |
55 "Example usage:\n" + | |
56 program_name + " <logfile> | python\n" + "Run " + program_name + | |
57 " --help for a list of command line options\n"; | |
58 google::SetUsageMessage(usage); | |
59 google::ParseCommandLineFlags(&argc, &argv, true); | |
60 | |
61 if (argc != 2) { | |
62 // Print usage information. | |
63 std::cout << google::ProgramUsage(); | |
64 return 0; | |
65 } | |
66 | |
67 std::string filename = argv[1]; | |
68 | |
69 webrtc::ParsedRtcEventLog parsed_log; | |
70 | |
71 if (!parsed_log.ParseFile(filename)) { | |
72 std::cerr << "Could not parse the entire log file." << std::endl; | |
73 std::cerr << "Proceeding to analyze the first " | |
74 << parsed_log.GetNumberOfEvents() << " events in the file." | |
75 << std::endl; | |
76 } | |
77 | |
78 webrtc::plotting::EventLogAnalyzer analyzer(parsed_log, | |
79 FLAGS_enable_point_info); | |
80 std::unique_ptr<webrtc::plotting::PlotCollection> collection( | |
81 new webrtc::plotting::PythonPlotCollection()); | |
82 | |
83 if (FLAGS_plot_all || FLAGS_plot_packets) { | |
84 if (FLAGS_incoming) { | |
85 collection->append_plot(); | |
86 analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket, | |
87 collection->plots.back().get()); | |
88 } | |
89 if (FLAGS_outgoing) { | |
90 collection->append_plot(); | |
91 analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket, | |
92 collection->plots.back().get()); | |
93 } | |
94 } | |
95 | |
96 if (FLAGS_plot_all || FLAGS_plot_audio_playout) { | |
97 collection->append_plot(); | |
98 analyzer.CreatePlayoutGraph(collection->plots.back().get()); | |
99 } | |
100 | |
101 if (FLAGS_plot_all || FLAGS_plot_sequence_number) { | |
102 if (FLAGS_incoming) { | |
103 collection->append_plot(); | |
104 analyzer.CreateSequenceNumberGraph(collection->plots.back().get()); | |
105 } | |
106 } | |
107 | |
108 if (FLAGS_plot_all || FLAGS_plot_delay_change) { | |
109 if (FLAGS_incoming) { | |
110 collection->append_plot(); | |
111 analyzer.CreateDelayChangeGraph(collection->plots.back().get()); | |
112 } | |
113 } | |
114 | |
115 if (FLAGS_plot_all || FLAGS_plot_accumulated_delay_change) { | |
116 if (FLAGS_incoming) { | |
117 collection->append_plot(); | |
118 analyzer.CreateAccumulatedDelayChangeGraph( | |
119 collection->plots.back().get()); | |
120 } | |
121 } | |
122 | |
123 if (FLAGS_plot_all || FLAGS_plot_total_bitrate) { | |
124 if (FLAGS_incoming) { | |
125 collection->append_plot(); | |
126 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket, | |
127 collection->plots.back().get()); | |
128 } | |
129 if (FLAGS_outgoing) { | |
130 collection->append_plot(); | |
131 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket, | |
132 collection->plots.back().get()); | |
133 } | |
134 } | |
135 | |
136 if (FLAGS_plot_all || FLAGS_plot_stream_bitrate) { | |
137 if (FLAGS_incoming) { | |
138 collection->append_plot(); | |
139 analyzer.CreateStreamBitrateGraph( | |
140 webrtc::PacketDirection::kIncomingPacket, | |
141 collection->plots.back().get()); | |
142 } | |
143 if (FLAGS_outgoing) { | |
144 collection->append_plot(); | |
145 analyzer.CreateStreamBitrateGraph( | |
146 webrtc::PacketDirection::kOutgoingPacket, | |
147 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
| |
148 } | |
149 } | |
150 | |
151 collection->draw(); | |
152 | |
153 return 0; | |
154 } | |
OLD | NEW |