Switch to use new implementation in metrics.h.

Sparse macro replaced for all video histograms that have a constant name.

BUG=webrtc:5283

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

Cr-Commit-Position: refs/heads/master@{#11368}
This commit is contained in:
asapersson
2016-01-25 05:58:23 -08:00
committed by Commit bot
parent 5ad935cb56
commit 28ba92731d
8 changed files with 80 additions and 90 deletions

View File

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

View File

@ -165,19 +165,19 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
} else if (uma_update_state_ == kNoUpdate) {
uma_update_state_ = kFirstDone;
bitrate_at_2_seconds_kbps_ = bitrate_kbps;
RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitiallyLostPackets",
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitiallyLostPackets",
initially_lost_packets_, 0, 100, 50);
RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialRtt", static_cast<int>(rtt),
0, 2000, 50);
RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialBandwidthEstimate",
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialRtt", static_cast<int>(rtt), 0,
2000, 50);
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate",
bitrate_at_2_seconds_kbps_, 0, 2000, 50);
} else if (uma_update_state_ == kFirstDone &&
now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) {
uma_update_state_ = kDone;
int bitrate_diff_kbps =
std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0);
RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialVsConvergedDiff",
bitrate_diff_kbps, 0, 2000, 50);
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps,
0, 2000, 50);
}
}

View File

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

View File

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

View File

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

View File

@ -56,8 +56,9 @@ HistogramCodecType PayloadNameToHistogramCodecType(
}
void UpdateCodecTypeHistogram(const std::string& payload_name) {
RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Video.Encoder.CodecType",
PayloadNameToHistogramCodecType(payload_name), kVideoMax);
RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.Encoder.CodecType",
PayloadNameToHistogramCodecType(payload_name),
kVideoMax);
}
} // namespace

View File

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

View File

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