Rename RTC_HISTOGRAM_* macros to RTC_HISTOGRAM_*_SPARSE_* to indicate that these are for infrequent updates.

This implementation will be replaced by a faster one and sparse will be removed.

BUG=webrtc:5283

Review URL: https://codereview.webrtc.org/1530913002

Cr-Commit-Position: refs/heads/master@{#11099}
This commit is contained in:
asapersson
2015-12-21 01:46:20 -08:00
committed by Commit bot
parent 9fca7e18c3
commit 53805324c0
12 changed files with 149 additions and 130 deletions

View File

@ -253,11 +253,11 @@ void Call::UpdateSendHistograms() {
estimated_send_bitrate_sum_kbits_ / num_bitrate_updates_; estimated_send_bitrate_sum_kbits_ / num_bitrate_updates_;
int pacer_bitrate_kbps = pacer_bitrate_sum_kbits_ / num_bitrate_updates_; int pacer_bitrate_kbps = pacer_bitrate_sum_kbits_ / num_bitrate_updates_;
if (send_bitrate_kbps > 0) { if (send_bitrate_kbps > 0) {
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps", RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.EstimatedSendBitrateInKbps",
send_bitrate_kbps); send_bitrate_kbps);
} }
if (pacer_bitrate_kbps > 0) { if (pacer_bitrate_kbps > 0) {
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps", RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.PacerBitrateInKbps",
pacer_bitrate_kbps); pacer_bitrate_kbps);
} }
} }
@ -273,18 +273,18 @@ void Call::UpdateReceiveHistograms() {
int video_bitrate_kbps = received_video_bytes_ * 8 / elapsed_sec / 1000; int video_bitrate_kbps = received_video_bytes_ * 8 / elapsed_sec / 1000;
int rtcp_bitrate_bps = received_rtcp_bytes_ * 8 / elapsed_sec; int rtcp_bitrate_bps = received_rtcp_bytes_ * 8 / elapsed_sec;
if (video_bitrate_kbps > 0) { if (video_bitrate_kbps > 0) {
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps", RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.VideoBitrateReceivedInKbps",
video_bitrate_kbps); video_bitrate_kbps);
} }
if (audio_bitrate_kbps > 0) { if (audio_bitrate_kbps > 0) {
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.AudioBitrateReceivedInKbps", RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.AudioBitrateReceivedInKbps",
audio_bitrate_kbps); audio_bitrate_kbps);
} }
if (rtcp_bitrate_bps > 0) { if (rtcp_bitrate_bps > 0) {
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.RtcpBitrateReceivedInBps", RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.RtcpBitrateReceivedInBps",
rtcp_bitrate_bps); rtcp_bitrate_bps);
} }
RTC_HISTOGRAM_COUNTS_100000( RTC_HISTOGRAM_COUNTS_SPARSE_100000(
"WebRTC.Call.BitrateReceivedInKbps", "WebRTC.Call.BitrateReceivedInKbps",
audio_bitrate_kbps + video_bitrate_kbps + rtcp_bitrate_bps / 1000); audio_bitrate_kbps + video_bitrate_kbps + rtcp_bitrate_bps / 1000);
} }

View File

@ -97,7 +97,7 @@ void AudioCodingModuleImpl::ChangeLogger::MaybeLog(int value) {
if (value != last_value_ || first_time_) { if (value != last_value_ || first_time_) {
first_time_ = false; first_time_ = false;
last_value_ = value; last_value_ = value;
RTC_HISTOGRAM_COUNTS_100(histogram_name_, value); RTC_HISTOGRAM_COUNTS_SPARSE_100(histogram_name_, value);
} }
} }

View File

@ -50,7 +50,7 @@ void StatisticsCalculator::PeriodicUmaLogger::AdvanceClock(int step_ms) {
} }
void StatisticsCalculator::PeriodicUmaLogger::LogToUma(int value) const { void StatisticsCalculator::PeriodicUmaLogger::LogToUma(int value) const {
RTC_HISTOGRAM_COUNTS(uma_name_, value, 1, max_value_, 50); RTC_HISTOGRAM_COUNTS_SPARSE(uma_name_, value, 1, max_value_, 50);
} }
StatisticsCalculator::PeriodicUmaCount::PeriodicUmaCount( StatisticsCalculator::PeriodicUmaCount::PeriodicUmaCount(
@ -187,7 +187,7 @@ void StatisticsCalculator::SecondaryDecodedSamples(int num_samples) {
} }
void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) { void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) {
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.DelayedPacketOutageEventMs", RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.Audio.DelayedPacketOutageEventMs",
outage_duration_ms, 1 /* min */, 2000 /* max */, outage_duration_ms, 1 /* min */, 2000 /* max */,
100 /* bucket count */); 100 /* bucket count */);
delayed_packet_outage_counter_.RegisterSample(); delayed_packet_outage_counter_.RegisterSample();

View File

@ -1346,8 +1346,9 @@ void AudioProcessingImpl::MaybeUpdateHistograms() {
capture_nonlocked_.stream_delay_ms - capture_.last_stream_delay_ms; capture_nonlocked_.stream_delay_ms - capture_.last_stream_delay_ms;
if (diff_stream_delay_ms > kMinDiffDelayMs && if (diff_stream_delay_ms > kMinDiffDelayMs &&
capture_.last_stream_delay_ms != 0) { capture_.last_stream_delay_ms != 0) {
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.PlatformReportedStreamDelayJump", RTC_HISTOGRAM_COUNTS_SPARSE(
diff_stream_delay_ms, kMinDiffDelayMs, 1000, 100); "WebRTC.Audio.PlatformReportedStreamDelayJump", diff_stream_delay_ms,
kMinDiffDelayMs, 1000, 100);
if (capture_.stream_delay_jumps == -1) { if (capture_.stream_delay_jumps == -1) {
capture_.stream_delay_jumps = 0; // Activate counter if needed. capture_.stream_delay_jumps = 0; // Activate counter if needed.
} }
@ -1364,9 +1365,9 @@ void AudioProcessingImpl::MaybeUpdateHistograms() {
aec_system_delay_ms - capture_.last_aec_system_delay_ms; aec_system_delay_ms - capture_.last_aec_system_delay_ms;
if (diff_aec_system_delay_ms > kMinDiffDelayMs && if (diff_aec_system_delay_ms > kMinDiffDelayMs &&
capture_.last_aec_system_delay_ms != 0) { capture_.last_aec_system_delay_ms != 0) {
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.AecSystemDelayJump", RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.Audio.AecSystemDelayJump",
diff_aec_system_delay_ms, kMinDiffDelayMs, 1000, diff_aec_system_delay_ms, kMinDiffDelayMs,
100); 1000, 100);
if (capture_.aec_system_delay_jumps == -1) { if (capture_.aec_system_delay_jumps == -1) {
capture_.aec_system_delay_jumps = 0; // Activate counter if needed. capture_.aec_system_delay_jumps = 0; // Activate counter if needed.
} }
@ -1382,7 +1383,7 @@ void AudioProcessingImpl::UpdateHistogramsOnCallEnd() {
rtc::CritScope cs_capture(&crit_capture_); rtc::CritScope cs_capture(&crit_capture_);
if (capture_.stream_delay_jumps > -1) { if (capture_.stream_delay_jumps > -1) {
RTC_HISTOGRAM_ENUMERATION( RTC_HISTOGRAM_ENUMERATION_SPARSE(
"WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps", "WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps",
capture_.stream_delay_jumps, 51); capture_.stream_delay_jumps, 51);
} }
@ -1390,7 +1391,7 @@ void AudioProcessingImpl::UpdateHistogramsOnCallEnd() {
capture_.last_stream_delay_ms = 0; capture_.last_stream_delay_ms = 0;
if (capture_.aec_system_delay_jumps > -1) { if (capture_.aec_system_delay_jumps > -1) {
RTC_HISTOGRAM_ENUMERATION("WebRTC.Audio.NumOfAecSystemDelayJumps", RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Audio.NumOfAecSystemDelayJumps",
capture_.aec_system_delay_jumps, 51); capture_.aec_system_delay_jumps, 51);
} }
capture_.aec_system_delay_jumps = -1; capture_.aec_system_delay_jumps = -1;

View File

@ -146,7 +146,7 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) {
if (!rampup_uma_stats_updated_[i] && if (!rampup_uma_stats_updated_[i] &&
bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) {
RTC_HISTOGRAM_COUNTS_100000(kUmaRampupMetrics[i].metric_name, RTC_HISTOGRAM_COUNTS_SPARSE_100000(kUmaRampupMetrics[i].metric_name,
now_ms - first_report_time_ms_); now_ms - first_report_time_ms_);
rampup_uma_stats_updated_[i] = true; rampup_uma_stats_updated_[i] = true;
} }
@ -156,22 +156,19 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
} else if (uma_update_state_ == kNoUpdate) { } else if (uma_update_state_ == kNoUpdate) {
uma_update_state_ = kFirstDone; uma_update_state_ = kFirstDone;
bitrate_at_2_seconds_kbps_ = bitrate_kbps; bitrate_at_2_seconds_kbps_ = bitrate_kbps;
RTC_HISTOGRAM_COUNTS( RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitiallyLostPackets",
"WebRTC.BWE.InitiallyLostPackets", initially_lost_packets_, 0, 100, 50); initially_lost_packets_, 0, 100, 50);
RTC_HISTOGRAM_COUNTS( RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialRtt", static_cast<int>(rtt),
"WebRTC.BWE.InitialRtt", static_cast<int>(rtt), 0, 2000, 50); 0, 2000, 50);
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate", RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialBandwidthEstimate",
bitrate_at_2_seconds_kbps_, bitrate_at_2_seconds_kbps_, 0, 2000, 50);
0,
2000,
50);
} else if (uma_update_state_ == kFirstDone && } else if (uma_update_state_ == kFirstDone &&
now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) {
uma_update_state_ = kDone; uma_update_state_ = kDone;
int bitrate_diff_kbps = int bitrate_diff_kbps =
std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0);
RTC_HISTOGRAM_COUNTS( RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialVsConvergedDiff",
"WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps, 0, 2000, 50); bitrate_diff_kbps, 0, 2000, 50);
} }
} }

View File

@ -281,17 +281,18 @@ void VCMJitterBuffer::UpdateHistograms() {
return; return;
} }
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.DiscardedPacketsInPercent", RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.DiscardedPacketsInPercent",
num_discarded_packets_ * 100 / num_packets_); num_discarded_packets_ * 100 / num_packets_);
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.DuplicatedPacketsInPercent", RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.DuplicatedPacketsInPercent",
num_duplicated_packets_ * 100 / num_packets_); num_duplicated_packets_ * 100 / num_packets_);
int total_frames = int total_frames =
receive_statistics_.key_frames + receive_statistics_.delta_frames; receive_statistics_.key_frames + receive_statistics_.delta_frames;
if (total_frames > 0) { if (total_frames > 0) {
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.CompleteFramesReceivedPerSecond", RTC_HISTOGRAM_COUNTS_SPARSE_100(
"WebRTC.Video.CompleteFramesReceivedPerSecond",
static_cast<int>((total_frames / elapsed_sec) + 0.5f)); static_cast<int>((total_frames / elapsed_sec) + 0.5f));
RTC_HISTOGRAM_COUNTS_1000( RTC_HISTOGRAM_COUNTS_SPARSE_1000(
"WebRTC.Video.KeyFramesReceivedInPermille", "WebRTC.Video.KeyFramesReceivedInPermille",
static_cast<int>( static_cast<int>(
(receive_statistics_.key_frames * 1000.0f / total_frames) + 0.5f)); (receive_statistics_.key_frames * 1000.0f / total_frames) + 0.5f));

View File

@ -62,12 +62,14 @@ void VCMTiming::UpdateHistograms() const {
if (elapsed_sec < metrics::kMinRunTimeInSeconds) { if (elapsed_sec < metrics::kMinRunTimeInSeconds) {
return; return;
} }
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.DecodedFramesPerSecond", RTC_HISTOGRAM_COUNTS_SPARSE_100(
"WebRTC.Video.DecodedFramesPerSecond",
static_cast<int>((num_decoded_frames_ / elapsed_sec) + 0.5f)); static_cast<int>((num_decoded_frames_ / elapsed_sec) + 0.5f));
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.DelayedFramesToRenderer", RTC_HISTOGRAM_PERCENTAGE_SPARSE(
"WebRTC.Video.DelayedFramesToRenderer",
num_delayed_decoded_frames_ * 100 / num_decoded_frames_); num_delayed_decoded_frames_ * 100 / num_decoded_frames_);
if (num_delayed_decoded_frames_ > 0) { if (num_delayed_decoded_frames_ > 0) {
RTC_HISTOGRAM_COUNTS_1000( RTC_HISTOGRAM_COUNTS_SPARSE_1000(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs", "WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs",
sum_missed_render_deadline_ms_ / num_delayed_decoded_frames_); sum_missed_render_deadline_ms_ / num_delayed_decoded_frames_);
} }

View File

@ -69,44 +69,43 @@
// Also consider changing string to const char* when switching to atomics. // Also consider changing string to const char* when switching to atomics.
// Histogram for counters. // Histogram for counters.
#define RTC_HISTOGRAM_COUNTS_100(name, sample) RTC_HISTOGRAM_COUNTS( \ #define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) \
name, sample, 1, 100, 50) RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100, 50)
#define RTC_HISTOGRAM_COUNTS_200(name, sample) RTC_HISTOGRAM_COUNTS( \ #define RTC_HISTOGRAM_COUNTS_SPARSE_200(name, sample) \
name, sample, 1, 200, 50) RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 200, 50)
#define RTC_HISTOGRAM_COUNTS_1000(name, sample) RTC_HISTOGRAM_COUNTS( \ #define RTC_HISTOGRAM_COUNTS_SPARSE_1000(name, sample) \
name, sample, 1, 1000, 50) RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 1000, 50)
#define RTC_HISTOGRAM_COUNTS_10000(name, sample) RTC_HISTOGRAM_COUNTS( \ #define RTC_HISTOGRAM_COUNTS_SPARSE_10000(name, sample) \
name, sample, 1, 10000, 50) RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 10000, 50)
#define RTC_HISTOGRAM_COUNTS_100000(name, sample) RTC_HISTOGRAM_COUNTS( \ #define RTC_HISTOGRAM_COUNTS_SPARSE_100000(name, sample) \
name, sample, 1, 100000, 50) RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100000, 50)
#define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ #define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) \
RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \
webrtc::metrics::HistogramFactoryGetCounts( \ webrtc::metrics::HistogramFactoryGetCounts( \
name, min, max, bucket_count)) name, min, max, bucket_count))
// Histogram for percentage. // Histogram for percentage.
#define RTC_HISTOGRAM_PERCENTAGE(name, sample) \ #define RTC_HISTOGRAM_PERCENTAGE_SPARSE(name, sample) \
RTC_HISTOGRAM_ENUMERATION(name, sample, 101) RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, 101)
// Histogram for enumerators. // Histogram for enumerators.
// |boundary| should be above the max enumerator sample. // |boundary| should be above the max enumerator sample.
#define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \ #define RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, boundary) \
RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \
webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary))
#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \ #define RTC_HISTOGRAM_COMMON_BLOCK_SLOW(constant_name, sample, \
factory_get_invocation) \ factory_get_invocation) \
do { \ do { \
webrtc::metrics::Histogram* histogram_pointer = factory_get_invocation; \ webrtc::metrics::Histogram* histogram_pointer = factory_get_invocation; \
webrtc::metrics::HistogramAdd(histogram_pointer, constant_name, sample); \ webrtc::metrics::HistogramAdd(histogram_pointer, constant_name, sample); \
} while (0) } while (0)
namespace webrtc { namespace webrtc {
namespace metrics { namespace metrics {

View File

@ -37,37 +37,39 @@ ReceiveStatisticsProxy::~ReceiveStatisticsProxy() {
void ReceiveStatisticsProxy::UpdateHistograms() { void ReceiveStatisticsProxy::UpdateHistograms() {
int fraction_lost = report_block_stats_.FractionLostInPercent(); int fraction_lost = report_block_stats_.FractionLostInPercent();
if (fraction_lost != -1) { if (fraction_lost != -1) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent", RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.ReceivedPacketsLostInPercent",
fraction_lost); fraction_lost);
} }
const int kMinRequiredSamples = 200; const int kMinRequiredSamples = 200;
int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount()); int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount());
if (samples > kMinRequiredSamples) { if (samples > kMinRequiredSamples) {
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond", RTC_HISTOGRAM_COUNTS_SPARSE_100("WebRTC.Video.RenderFramesPerSecond",
round(render_fps_tracker_.ComputeTotalRate())); round(render_fps_tracker_.ComputeTotalRate()));
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.RenderSqrtPixelsPerSecond", RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Video.RenderSqrtPixelsPerSecond",
round(render_pixel_tracker_.ComputeTotalRate())); round(render_pixel_tracker_.ComputeTotalRate()));
} }
int width = render_width_counter_.Avg(kMinRequiredSamples); int width = render_width_counter_.Avg(kMinRequiredSamples);
int height = render_height_counter_.Avg(kMinRequiredSamples); int height = render_height_counter_.Avg(kMinRequiredSamples);
if (width != -1) { if (width != -1) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", width); RTC_HISTOGRAM_COUNTS_SPARSE_10000("WebRTC.Video.ReceivedWidthInPixels",
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", height); width);
RTC_HISTOGRAM_COUNTS_SPARSE_10000("WebRTC.Video.ReceivedHeightInPixels",
height);
} }
int qp = qp_counters_.vp8.Avg(kMinRequiredSamples); int qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
if (qp != -1) if (qp != -1)
RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp); RTC_HISTOGRAM_COUNTS_SPARSE_200("WebRTC.Video.Decoded.Vp8.Qp", qp);
// TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and
// not per frame. Change decode time to include every frame. // not per frame. Change decode time to include every frame.
const int kMinRequiredDecodeSamples = 5; const int kMinRequiredDecodeSamples = 5;
int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples); int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples);
if (decode_ms != -1) if (decode_ms != -1)
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms); RTC_HISTOGRAM_COUNTS_SPARSE_1000("WebRTC.Video.DecodeTimeInMs", decode_ms);
int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples); int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples);
if (delay_ms != -1) if (delay_ms != -1)
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms); RTC_HISTOGRAM_COUNTS_SPARSE_10000("WebRTC.Video.OnewayDelayInMs", delay_ms);
} }
VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const {

View File

@ -57,7 +57,7 @@ HistogramCodecType PayloadNameToHistogramCodecType(
} }
void UpdateCodecTypeHistogram(const std::string& payload_name) { void UpdateCodecTypeHistogram(const std::string& payload_name) {
RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.Encoder.CodecType", RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Video.Encoder.CodecType",
PayloadNameToHistogramCodecType(payload_name), kVideoMax); PayloadNameToHistogramCodecType(payload_name), kVideoMax);
} }
} // namespace } // namespace
@ -98,55 +98,62 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() {
int in_height = input_height_counter_.Avg(kMinRequiredSamples); int in_height = input_height_counter_.Avg(kMinRequiredSamples);
int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate());
if (in_width != -1) { if (in_width != -1) {
RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputWidthInPixels", in_width); RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "InputWidthInPixels",
RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputHeightInPixels", in_height); in_width);
RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "InputFramesPerSecond", in_fps); RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "InputHeightInPixels",
in_height);
RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix_ + "InputFramesPerSecond",
in_fps);
} }
int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); int sent_width = sent_width_counter_.Avg(kMinRequiredSamples);
int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); int sent_height = sent_height_counter_.Avg(kMinRequiredSamples);
int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate());
if (sent_width != -1) { if (sent_width != -1) {
RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentWidthInPixels", sent_width); RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "SentWidthInPixels",
RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentHeightInPixels", sent_height); sent_width);
RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "SentFramesPerSecond", sent_fps); RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "SentHeightInPixels",
sent_height);
RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix_ + "SentFramesPerSecond",
sent_fps);
} }
int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples);
if (encode_ms != -1) if (encode_ms != -1)
RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms); RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms);
int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples);
if (key_frames_permille != -1) { if (key_frames_permille != -1) {
RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "KeyFramesSentInPermille", RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "KeyFramesSentInPermille",
key_frames_permille); key_frames_permille);
} }
int quality_limited = int quality_limited =
quality_limited_frame_counter_.Percent(kMinRequiredSamples); quality_limited_frame_counter_.Percent(kMinRequiredSamples);
if (quality_limited != -1) { if (quality_limited != -1) {
RTC_HISTOGRAM_PERCENTAGE(uma_prefix_ + "QualityLimitedResolutionInPercent", RTC_HISTOGRAM_PERCENTAGE_SPARSE(
quality_limited); uma_prefix_ + "QualityLimitedResolutionInPercent", quality_limited);
} }
int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples);
if (downscales != -1) { if (downscales != -1) {
RTC_HISTOGRAM_ENUMERATION( RTC_HISTOGRAM_ENUMERATION_SPARSE(
uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20); uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20);
} }
int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples);
if (bw_limited != -1) { if (bw_limited != -1) {
RTC_HISTOGRAM_PERCENTAGE( RTC_HISTOGRAM_PERCENTAGE_SPARSE(
uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited); uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited);
} }
int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples);
if (num_disabled != -1) { if (num_disabled != -1) {
RTC_HISTOGRAM_ENUMERATION( RTC_HISTOGRAM_ENUMERATION_SPARSE(
uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10); uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10);
} }
int delay_ms = delay_counter_.Avg(kMinRequiredSamples); int delay_ms = delay_counter_.Avg(kMinRequiredSamples);
if (delay_ms != -1) if (delay_ms != -1)
RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayInMs", delay_ms); RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayInMs",
delay_ms);
int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples);
if (max_delay_ms != -1) { if (max_delay_ms != -1) {
RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayMaxInMs", RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayMaxInMs",
max_delay_ms); max_delay_ms);
} }
} }

View File

@ -202,7 +202,7 @@ void ViEChannel::UpdateHistograms() {
if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 && if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 &&
elapsed_sec > metrics::kMinRunTimeInSeconds) { elapsed_sec > metrics::kMinRunTimeInSeconds) {
int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_; int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_;
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms); "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms);
} }
} }
@ -212,20 +212,23 @@ void ViEChannel::UpdateHistograms() {
GetSendRtcpPacketTypeCounter(&rtcp_counter); GetSendRtcpPacketTypeCounter(&rtcp_counter);
int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
if (elapsed_sec > metrics::kMinRunTimeInSeconds) { if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsReceivedPerMinute", RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.NackPacketsReceivedPerMinute",
rtcp_counter.nack_packets * 60 / elapsed_sec); rtcp_counter.nack_packets * 60 / elapsed_sec);
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute", RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.FirPacketsReceivedPerMinute",
rtcp_counter.fir_packets * 60 / elapsed_sec); rtcp_counter.fir_packets * 60 / elapsed_sec);
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute", RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.PliPacketsReceivedPerMinute",
rtcp_counter.pli_packets * 60 / elapsed_sec); rtcp_counter.pli_packets * 60 / elapsed_sec);
if (rtcp_counter.nack_requests > 0) { if (rtcp_counter.nack_requests > 0) {
RTC_HISTOGRAM_PERCENTAGE( RTC_HISTOGRAM_PERCENTAGE_SPARSE(
"WebRTC.Video.UniqueNackRequestsReceivedInPercent", "WebRTC.Video.UniqueNackRequestsReceivedInPercent",
rtcp_counter.UniqueNackRequestsInPercent()); rtcp_counter.UniqueNackRequestsInPercent());
} }
int fraction_lost = report_block_stats_sender_->FractionLostInPercent(); int fraction_lost = report_block_stats_sender_->FractionLostInPercent();
if (fraction_lost != -1) { if (fraction_lost != -1) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent", RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.SentPacketsLostInPercent",
fraction_lost); fraction_lost);
} }
} }
@ -239,23 +242,23 @@ void ViEChannel::UpdateHistograms() {
Clock::GetRealTimeClock()->TimeInMilliseconds()) / Clock::GetRealTimeClock()->TimeInMilliseconds()) /
1000; 1000;
if (elapsed_sec > metrics::kMinRunTimeInSeconds) { if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
RTC_HISTOGRAM_COUNTS_100000( RTC_HISTOGRAM_COUNTS_SPARSE_100000(
"WebRTC.Video.BitrateSentInKbps", "WebRTC.Video.BitrateSentInKbps",
static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
1000)); 1000));
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.MediaBitrateSentInKbps", "WebRTC.Video.MediaBitrateSentInKbps",
static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.PaddingBitrateSentInKbps", "WebRTC.Video.PaddingBitrateSentInKbps",
static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
1000)); 1000));
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.RetransmittedBitrateSentInKbps", "WebRTC.Video.RetransmittedBitrateSentInKbps",
static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
elapsed_sec / 1000)); elapsed_sec / 1000));
if (rtp_rtcp_modules_[0]->RtxSendStatus() != kRtxOff) { if (rtp_rtcp_modules_[0]->RtxSendStatus() != kRtxOff) {
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.RtxBitrateSentInKbps", "WebRTC.Video.RtxBitrateSentInKbps",
static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
1000)); 1000));
@ -266,9 +269,10 @@ void ViEChannel::UpdateHistograms() {
rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red, rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red,
&pltype_fec); &pltype_fec);
if (fec_enabled) { if (fec_enabled) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps", RTC_HISTOGRAM_COUNTS_SPARSE_10000(
static_cast<int>(rtp_rtx.fec.TotalBytes() * "WebRTC.Video.FecBitrateSentInKbps",
8 / elapsed_sec / 1000)); static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec /
1000));
} }
} }
} else if (vie_receiver_.GetRemoteSsrc() > 0) { } else if (vie_receiver_.GetRemoteSsrc() > 0) {
@ -278,14 +282,18 @@ void ViEChannel::UpdateHistograms() {
GetReceiveRtcpPacketTypeCounter(&rtcp_counter); GetReceiveRtcpPacketTypeCounter(&rtcp_counter);
int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
if (elapsed_sec > metrics::kMinRunTimeInSeconds) { if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.NackPacketsSentPerMinute",
rtcp_counter.nack_packets * 60 / elapsed_sec); rtcp_counter.nack_packets * 60 / elapsed_sec);
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.FirPacketsSentPerMinute",
rtcp_counter.fir_packets * 60 / elapsed_sec); rtcp_counter.fir_packets * 60 / elapsed_sec);
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.PliPacketsSentPerMinute",
rtcp_counter.pli_packets * 60 / elapsed_sec); rtcp_counter.pli_packets * 60 / elapsed_sec);
if (rtcp_counter.nack_requests > 0) { if (rtcp_counter.nack_requests > 0) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", RTC_HISTOGRAM_PERCENTAGE_SPARSE(
"WebRTC.Video.UniqueNackRequestsSentInPercent",
rtcp_counter.UniqueNackRequestsInPercent()); rtcp_counter.UniqueNackRequestsInPercent());
} }
} }
@ -297,32 +305,33 @@ void ViEChannel::UpdateHistograms() {
rtp_rtx.Add(rtx); rtp_rtx.Add(rtx);
elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000; elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000;
if (elapsed_sec > metrics::kMinRunTimeInSeconds) { if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.BitrateReceivedInKbps", "WebRTC.Video.BitrateReceivedInKbps",
static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
1000)); 1000));
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.MediaBitrateReceivedInKbps", "WebRTC.Video.MediaBitrateReceivedInKbps",
static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.PaddingBitrateReceivedInKbps", "WebRTC.Video.PaddingBitrateReceivedInKbps",
static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
1000)); 1000));
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.RetransmittedBitrateReceivedInKbps", "WebRTC.Video.RetransmittedBitrateReceivedInKbps",
static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
elapsed_sec / 1000)); elapsed_sec / 1000));
uint32_t ssrc = 0; uint32_t ssrc = 0;
if (vie_receiver_.GetRtxSsrc(&ssrc)) { if (vie_receiver_.GetRtxSsrc(&ssrc)) {
RTC_HISTOGRAM_COUNTS_10000( RTC_HISTOGRAM_COUNTS_SPARSE_10000(
"WebRTC.Video.RtxBitrateReceivedInKbps", "WebRTC.Video.RtxBitrateReceivedInKbps",
static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
1000)); 1000));
} }
if (vie_receiver_.IsFecEnabled()) { if (vie_receiver_.IsFecEnabled()) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateReceivedInKbps", RTC_HISTOGRAM_COUNTS_SPARSE_10000(
static_cast<int>(rtp_rtx.fec.TotalBytes() * "WebRTC.Video.FecBitrateReceivedInKbps",
8 / elapsed_sec / 1000)); static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec /
1000));
} }
} }
} }

View File

@ -68,14 +68,15 @@ ViEReceiver::~ViEReceiver() {
void ViEReceiver::UpdateHistograms() { void ViEReceiver::UpdateHistograms() {
FecPacketCounter counter = fec_receiver_->GetPacketCounter(); FecPacketCounter counter = fec_receiver_->GetPacketCounter();
if (counter.num_packets > 0) { if (counter.num_packets > 0) {
RTC_HISTOGRAM_PERCENTAGE( RTC_HISTOGRAM_PERCENTAGE_SPARSE(
"WebRTC.Video.ReceivedFecPacketsInPercent", "WebRTC.Video.ReceivedFecPacketsInPercent",
static_cast<int>(counter.num_fec_packets * 100 / counter.num_packets)); static_cast<int>(counter.num_fec_packets * 100 / counter.num_packets));
} }
if (counter.num_fec_packets > 0) { if (counter.num_fec_packets > 0) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.RecoveredMediaPacketsInPercentOfFec", RTC_HISTOGRAM_PERCENTAGE_SPARSE(
static_cast<int>(counter.num_recovered_packets * "WebRTC.Video.RecoveredMediaPacketsInPercentOfFec",
100 / counter.num_fec_packets)); static_cast<int>(counter.num_recovered_packets * 100 /
counter.num_fec_packets));
} }
} }