Add ToString method to AggregatedStats and log stats at the end of a call.
BUG=webrtc:5283 Review-Url: https://codereview.webrtc.org/2494423002 Cr-Commit-Position: refs/heads/master@{#15088}
This commit is contained in:
parent
841de6a47e
commit
43cb716e55
@ -349,12 +349,16 @@ void Call::UpdateSendHistograms() {
|
||||
if (send_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) {
|
||||
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps",
|
||||
send_bitrate_stats.average);
|
||||
LOG(LS_INFO) << "WebRTC.Call.EstimatedSendBitrateInKbps, "
|
||||
<< send_bitrate_stats.ToString();
|
||||
}
|
||||
AggregatedStats pacer_bitrate_stats =
|
||||
pacer_bitrate_kbps_counter_.ProcessAndGetStats();
|
||||
if (pacer_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) {
|
||||
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps",
|
||||
pacer_bitrate_stats.average);
|
||||
LOG(LS_INFO) << "WebRTC.Call.PacerBitrateInKbps, "
|
||||
<< pacer_bitrate_stats.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,24 +369,32 @@ void Call::UpdateReceiveHistograms() {
|
||||
if (video_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
|
||||
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps",
|
||||
video_bytes_per_sec.average * 8 / 1000);
|
||||
LOG(LS_INFO) << "WebRTC.Call.VideoBitrateReceivedInKbps, "
|
||||
<< video_bytes_per_sec.ToString();
|
||||
}
|
||||
AggregatedStats audio_bytes_per_sec =
|
||||
received_audio_bytes_per_second_counter_.GetStats();
|
||||
if (audio_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
|
||||
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.AudioBitrateReceivedInKbps",
|
||||
audio_bytes_per_sec.average * 8 / 1000);
|
||||
LOG(LS_INFO) << "WebRTC.Call.AudioBitrateReceivedInKbps, "
|
||||
<< audio_bytes_per_sec.ToString();
|
||||
}
|
||||
AggregatedStats rtcp_bytes_per_sec =
|
||||
received_rtcp_bytes_per_second_counter_.GetStats();
|
||||
if (rtcp_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
|
||||
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.RtcpBitrateReceivedInBps",
|
||||
rtcp_bytes_per_sec.average * 8);
|
||||
LOG(LS_INFO) << "WebRTC.Call.RtcpBitrateReceivedInBps, "
|
||||
<< rtcp_bytes_per_sec.ToString();
|
||||
}
|
||||
AggregatedStats recv_bytes_per_sec =
|
||||
received_bytes_per_second_counter_.GetStats();
|
||||
if (recv_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
|
||||
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.BitrateReceivedInKbps",
|
||||
recv_bytes_per_sec.average * 8 / 1000);
|
||||
LOG(LS_INFO) << "WebRTC.Call.BitrateReceivedInKbps, "
|
||||
<< recv_bytes_per_sec.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -77,6 +77,8 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
if (freq_offset_stats.num_samples > 0) {
|
||||
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtpToNtpFreqOffsetInKhz",
|
||||
freq_offset_stats.average);
|
||||
LOG(LS_INFO) << "WebRTC.Video.RtpToNtpFreqOffsetInKhz, "
|
||||
<< freq_offset_stats.ToString();
|
||||
}
|
||||
|
||||
int qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
|
||||
|
||||
@ -45,6 +45,7 @@ void SendDelayStats::UpdateHistograms() {
|
||||
AggregatedStats stats = it.second->GetStats();
|
||||
if (stats.num_samples >= kMinRequiredPeriodicSamples) {
|
||||
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SendDelayInMs", stats.average);
|
||||
LOG(LS_INFO) << "WebRTC.Video.SendDelayInMs, " << stats.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,15 @@ const int64_t kDefaultProcessIntervalMs = 2000;
|
||||
const uint32_t kStreamId0 = 0;
|
||||
} // namespace
|
||||
|
||||
std::string AggregatedStats::ToString() const {
|
||||
std::stringstream ss;
|
||||
ss << "periodic_samples:" << num_samples << ", {";
|
||||
ss << "min:" << min << ", ";
|
||||
ss << "avg:" << average << ", ";
|
||||
ss << "max:" << max << "}";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
// Class holding periodically computed metrics.
|
||||
class AggregatedCounter {
|
||||
public:
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#define WEBRTC_VIDEO_STATS_COUNTER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
@ -31,6 +32,8 @@ class StatsCounterObserver {
|
||||
};
|
||||
|
||||
struct AggregatedStats {
|
||||
std::string ToString() const;
|
||||
|
||||
int64_t num_samples = 0;
|
||||
int min = -1;
|
||||
int max = -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user