Remove gflags dependency for event_log_visualizer and activity_metric

This is the first step towards getting rid of gflags as a dependency.
It has been causing us extra work for a long time since it's not present
in Chromium as one example.

BUG=webrtc:7644
NOTRY=True

Review-Url: https://codereview.webrtc.org/2874403003
Cr-Commit-Position: refs/heads/master@{#18157}
This commit is contained in:
kjellander
2017-05-16 00:01:23 -07:00
committed by Commit bot
parent 09f0561675
commit 4fa5be451f
3 changed files with 72 additions and 59 deletions

View File

@ -10,7 +10,7 @@
#include <iostream>
#include "gflags/gflags.h"
#include "webrtc/base/flags.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
#include "webrtc/test/field_trial.h"
#include "webrtc/tools/event_log_visualizer/analyzer.h"
@ -84,6 +84,7 @@ DEFINE_string(
"E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/"
" will assign the group Enabled to field trial WebRTC-FooFeature. Multiple "
"trials are separated by \"/\"");
DEFINE_bool(help, false, "prints this message");
int main(int argc, char* argv[]) {
std::string program_name = argv[0];
@ -92,16 +93,19 @@ int main(int argc, char* argv[]) {
"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();
rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
if (FLAG_help) {
rtc::FlagList::Print(nullptr, false);
return 0;
}
webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
if (argc != 2) {
// Print usage information.
std::cout << usage;
return 0;
}
webrtc::test::InitFieldTrialsFromString(FLAG_force_fieldtrials);
std::string filename = argv[1];
@ -118,15 +122,15 @@ int main(int argc, char* argv[]) {
std::unique_ptr<webrtc::plotting::PlotCollection> collection(
new webrtc::plotting::PythonPlotCollection());
if (FLAGS_plot_all || FLAGS_plot_packets) {
if (FLAGS_incoming) {
if (FLAG_plot_all || FLAG_plot_packets) {
if (FLAG_incoming) {
analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
analyzer.CreateAccumulatedPacketsGraph(
webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
}
if (FLAGS_outgoing) {
if (FLAG_outgoing) {
analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
analyzer.CreateAccumulatedPacketsGraph(
@ -135,95 +139,95 @@ int main(int argc, char* argv[]) {
}
}
if (FLAGS_plot_all || FLAGS_plot_audio_playout) {
if (FLAG_plot_all || FLAG_plot_audio_playout) {
analyzer.CreatePlayoutGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_plot_audio_level) {
if (FLAG_plot_all || FLAG_plot_audio_level) {
analyzer.CreateAudioLevelGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_plot_sequence_number) {
if (FLAGS_incoming) {
if (FLAG_plot_all || FLAG_plot_sequence_number) {
if (FLAG_incoming) {
analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
}
}
if (FLAGS_plot_all || FLAGS_plot_delay_change) {
if (FLAGS_incoming) {
if (FLAG_plot_all || FLAG_plot_delay_change) {
if (FLAG_incoming) {
analyzer.CreateDelayChangeGraph(collection->AppendNewPlot());
}
}
if (FLAGS_plot_all || FLAGS_plot_accumulated_delay_change) {
if (FLAGS_incoming) {
if (FLAG_plot_all || FLAG_plot_accumulated_delay_change) {
if (FLAG_incoming) {
analyzer.CreateAccumulatedDelayChangeGraph(collection->AppendNewPlot());
}
}
if (FLAGS_plot_all || FLAGS_plot_fraction_loss) {
if (FLAG_plot_all || FLAG_plot_fraction_loss) {
analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_plot_total_bitrate) {
if (FLAGS_incoming) {
if (FLAG_plot_all || FLAG_plot_total_bitrate) {
if (FLAG_incoming) {
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
}
if (FLAGS_outgoing) {
if (FLAG_outgoing) {
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
}
}
if (FLAGS_plot_all || FLAGS_plot_stream_bitrate) {
if (FLAGS_incoming) {
if (FLAG_plot_all || FLAG_plot_stream_bitrate) {
if (FLAG_incoming) {
analyzer.CreateStreamBitrateGraph(
webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
}
if (FLAGS_outgoing) {
if (FLAG_outgoing) {
analyzer.CreateStreamBitrateGraph(
webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
}
}
if (FLAGS_plot_all || FLAGS_plot_bwe) {
if (FLAG_plot_all || FLAG_plot_bwe) {
analyzer.CreateBweSimulationGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_plot_network_delay_feedback) {
if (FLAG_plot_all || FLAG_plot_network_delay_feedback) {
analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_plot_timestamps) {
if (FLAG_plot_all || FLAG_plot_timestamps) {
analyzer.CreateTimestampGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_audio_encoder_bitrate_bps) {
if (FLAG_plot_all || FLAG_audio_encoder_bitrate_bps) {
analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_audio_encoder_frame_length_ms) {
if (FLAG_plot_all || FLAG_audio_encoder_frame_length_ms) {
analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_audio_encoder_uplink_packet_loss_fraction) {
if (FLAG_plot_all || FLAG_audio_encoder_uplink_packet_loss_fraction) {
analyzer.CreateAudioEncoderUplinkPacketLossFractionGraph(
collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_audio_encoder_fec) {
if (FLAG_plot_all || FLAG_audio_encoder_fec) {
analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_audio_encoder_dtx) {
if (FLAG_plot_all || FLAG_audio_encoder_dtx) {
analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot());
}
if (FLAGS_plot_all || FLAGS_audio_encoder_num_channels) {
if (FLAG_plot_all || FLAG_audio_encoder_num_channels) {
analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot());
}