Refactor AnalyzerConfig to use Timestamps instead of microseconds.

Add optional offset-to-UTC parameter to output. This allows aligning
the x-axis in the generated charts to other UTC-based logs.

Bug: b/215140373
Change-Id: I65bcd295718acbb8c94e363907c1abc458067bfd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250203
Reviewed-by: Kristoffer Erlandsson <kerl@google.com>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35992}
This commit is contained in:
Björn Terelius
2022-02-14 11:42:12 +01:00
committed by WebRTC LUCI CQ
parent 97f8a5f7dd
commit 43fb16921b
36 changed files with 203 additions and 129 deletions

View File

@ -79,7 +79,7 @@ void TriageHelper::AnalyzeStreamGaps(const ParsedRtcEventLog& parsed_log,
int64_t seq_num = seq_num_unwrapper.Unwrap(packet.header.sequenceNumber);
if (std::abs(seq_num - last_seq_num) > kMaxSeqNumJump) {
Alert(seq_num_alert, config_.GetCallTimeSec(packet.log_time_us()),
Alert(seq_num_alert, config_.GetCallTimeSec(packet.log_time()),
seq_num_explanation);
}
last_seq_num = seq_num;
@ -89,7 +89,7 @@ void TriageHelper::AnalyzeStreamGaps(const ParsedRtcEventLog& parsed_log,
if (std::abs(capture_time - last_capture_time) >
kTicksPerMillisec *
(kCaptureTimeGraceMs + packet.log_time_ms() - last_log_time_ms)) {
Alert(capture_time_alert, config_.GetCallTimeSec(packet.log_time_us()),
Alert(capture_time_alert, config_.GetCallTimeSec(packet.log_time()),
capture_time_explanation);
}
last_capture_time = capture_time;
@ -140,7 +140,8 @@ void TriageHelper::AnalyzeTransmissionGaps(const ParsedRtcEventLog& parsed_log,
int64_t duration = timestamp - last_rtp_time.value_or(0);
if (last_rtp_time.has_value() && duration > kMaxRtpTransmissionGap) {
// No packet sent/received for more than 500 ms.
Alert(rtp_alert, config_.GetCallTimeSec(timestamp), rtp_explanation);
Alert(rtp_alert, config_.GetCallTimeSec(Timestamp::Micros(timestamp)),
rtp_explanation);
}
last_rtp_time.emplace(timestamp);
}
@ -155,7 +156,7 @@ void TriageHelper::AnalyzeTransmissionGaps(const ParsedRtcEventLog& parsed_log,
int64_t duration = rtcp.log_time_us() - last_rtcp_time.value_or(0);
if (last_rtcp_time.has_value() && duration > kMaxRtcpTransmissionGap) {
// No feedback sent/received for more than 2000 ms.
Alert(rtcp_alert, config_.GetCallTimeSec(rtcp.log_time_us()),
Alert(rtcp_alert, config_.GetCallTimeSec(rtcp.log_time()),
rtcp_explanation);
}
last_rtcp_time.emplace(rtcp.log_time_us());
@ -169,7 +170,7 @@ void TriageHelper::AnalyzeTransmissionGaps(const ParsedRtcEventLog& parsed_log,
int64_t duration = rtcp.log_time_us() - last_rtcp_time.value_or(0);
if (last_rtcp_time.has_value() && duration > kMaxRtcpTransmissionGap) {
// No feedback sent/received for more than 2000 ms.
Alert(rtcp_alert, config_.GetCallTimeSec(rtcp.log_time_us()),
Alert(rtcp_alert, config_.GetCallTimeSec(rtcp.log_time()),
rtcp_explanation);
}
last_rtcp_time.emplace(rtcp.log_time_us());
@ -189,7 +190,7 @@ void TriageHelper::AnalyzeLog(const ParsedRtcEventLog& parsed_log) {
const int64_t segment_end_us = parsed_log.first_log_segment().stop_time_us();
int64_t first_occurrence = parsed_log.last_timestamp();
Timestamp first_occurrence = parsed_log.last_timestamp();
constexpr double kMaxLossFraction = 0.05;
// Loss feedback
int64_t total_lost_packets = 0;
@ -204,13 +205,14 @@ void TriageHelper::AnalyzeLog(const ParsedRtcEventLog& parsed_log) {
total_lost_packets += lost_packets;
total_expected_packets += bwe_update.expected_packets;
if (bwe_update.fraction_lost >= 255 * kMaxLossFraction) {
first_occurrence = std::min(first_occurrence, bwe_update.log_time_us());
first_occurrence = std::min(first_occurrence, bwe_update.log_time());
}
}
double avg_outgoing_loss =
static_cast<double>(total_lost_packets) / total_expected_packets;
if (avg_outgoing_loss > kMaxLossFraction) {
Alert(TriageAlertType::kOutgoingHighLoss, first_occurrence,
Alert(TriageAlertType::kOutgoingHighLoss,
config_.GetCallTimeSec(first_occurrence),
"More than 5% of outgoing packets lost.");
}
}