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:
asapersson
2016-11-15 08:20:48 -08:00
committed by Commit bot
parent 841de6a47e
commit 43cb716e55
5 changed files with 27 additions and 0 deletions

View File

@ -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);

View File

@ -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();
}
}
}

View File

@ -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:

View File

@ -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;