Refactor/reimplement RTC event log triage alerts.

- Moves AnalyzerConfig and helper functions IsAudioSsrc, IsVideoSsrc, IsRtxSsrc, GetStreamNam and GetLayerName to analyzer_common.h
- Moves log_segments() code to rtc_event_log_parser.h
- Moves TriageAlert/Notification code to a new file with a couple of minor fixes to make it less spammy.

Bug: webrtc:11566
Change-Id: Ib33941d8185f7382fc72ed65768e46015e0320de
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174824
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31318}
This commit is contained in:
Bjorn Terelius
2020-05-19 10:57:24 +02:00
committed by Commit Bot
parent 41559a2b46
commit 48b8279813
12 changed files with 612 additions and 570 deletions

View File

@ -30,6 +30,7 @@
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_tools/rtc_event_log_visualizer/alerts.h"
#include "rtc_tools/rtc_event_log_visualizer/analyzer.h"
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
#include "rtc_tools/rtc_event_log_visualizer/plot_protobuf.h"
@ -194,9 +195,9 @@ int main(int argc, char* argv[]) {
"A tool for visualizing WebRTC event logs.\n"
"Example usage:\n"
"./event_log_visualizer <logfile> | python\n");
absl::FlagsUsageConfig config;
config.contains_help_flags = &ContainsHelppackageFlags;
absl::SetFlagsUsageConfig(config);
absl::FlagsUsageConfig flag_config;
flag_config.contains_help_flags = &ContainsHelppackageFlags;
absl::SetFlagsUsageConfig(flag_config);
std::vector<char*> args = absl::ParseCommandLine(argc, argv);
// Print RTC_LOG warnings and errors even in release builds.
@ -261,8 +262,20 @@ int main(int argc, char* argv[]) {
}
}
webrtc::EventLogAnalyzer analyzer(parsed_log,
absl::GetFlag(FLAGS_normalize_time));
webrtc::AnalyzerConfig config;
config.window_duration_ = 250000;
config.step_ = 10000;
config.normalize_time_ = absl::GetFlag(FLAGS_normalize_time);
config.begin_time_ = parsed_log.first_timestamp();
config.end_time_ = parsed_log.last_timestamp();
if (config.end_time_ < config.begin_time_) {
RTC_LOG(LS_WARNING) << "Log end time " << config.end_time_
<< " not after begin time " << config.begin_time_
<< ". Nothing to analyze. Is the log broken?";
return -1;
}
webrtc::EventLogAnalyzer analyzer(parsed_log, config);
std::unique_ptr<webrtc::PlotCollection> collection;
if (absl::GetFlag(FLAGS_protobuf_output)) {
collection.reset(new webrtc::ProtobufPlotCollection());
@ -614,8 +627,9 @@ int main(int argc, char* argv[]) {
collection->Draw();
if (absl::GetFlag(FLAGS_print_triage_alerts)) {
analyzer.CreateTriageNotifications();
analyzer.PrintNotifications(stderr);
webrtc::TriageHelper triage_alerts(config);
triage_alerts.AnalyzeLog(parsed_log);
triage_alerts.Print(stderr);
}
return 0;