Add a default implementation in metrics_default.cc of histograms methods in system_wrappers/interface/metrics.h.

Updated tests to use the default implementation and removed the test implementation (webrtc/test/histograms.h).

BUG=

Review-Url: https://codereview.webrtc.org/1915523002
Cr-Commit-Position: refs/heads/master@{#12829}
This commit is contained in:
asapersson
2016-05-20 06:29:46 -07:00
committed by Commit bot
parent 7268f28520
commit 01d70a3978
20 changed files with 827 additions and 517 deletions

View File

@ -24,8 +24,8 @@
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/field_trial.h"
#include "webrtc/system_wrappers/include/metrics.h"
#include "webrtc/system_wrappers/include/metrics_default.h"
#include "webrtc/test/field_trial.h"
#include "webrtc/test/histogram.h"
namespace webrtc {
@ -498,7 +498,7 @@ TEST_P(TestBasicJitterBuffer, SinglePacketFrame) {
}
TEST_P(TestBasicJitterBuffer, VerifyHistogramStats) {
test::ClearHistograms();
metrics::Reset();
// Always start with a complete key frame when not allowing errors.
jitter_buffer_->SetDecodeErrorMode(kNoErrors);
packet_->frameType = kVideoFrameKey;
@ -518,25 +518,21 @@ TEST_P(TestBasicJitterBuffer, VerifyHistogramStats) {
// Verify that histograms are updated when the jitter buffer is stopped.
clock_->AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
jitter_buffer_->Stop();
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.DiscardedPacketsInPercent", 0));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.DuplicatedPacketsInPercent", 0));
EXPECT_EQ(
0, test::LastHistogramSample("WebRTC.Video.DiscardedPacketsInPercent"));
1, metrics::NumSamples("WebRTC.Video.CompleteFramesReceivedPerSecond"));
EXPECT_EQ(
0, test::LastHistogramSample("WebRTC.Video.DuplicatedPacketsInPercent"));
EXPECT_NE(-1, test::LastHistogramSample(
"WebRTC.Video.CompleteFramesReceivedPerSecond"));
EXPECT_EQ(1000, test::LastHistogramSample(
"WebRTC.Video.KeyFramesReceivedInPermille"));
1, metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 1000));
// Verify that histograms are not updated if stop is called again.
jitter_buffer_->Stop();
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DiscardedPacketsInPercent"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DuplicatedPacketsInPercent"));
EXPECT_EQ(
1, test::NumHistogramSamples("WebRTC.Video.DiscardedPacketsInPercent"));
EXPECT_EQ(
1, test::NumHistogramSamples("WebRTC.Video.DuplicatedPacketsInPercent"));
EXPECT_EQ(1, test::NumHistogramSamples(
"WebRTC.Video.CompleteFramesReceivedPerSecond"));
EXPECT_EQ(
1, test::NumHistogramSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
1, metrics::NumSamples("WebRTC.Video.CompleteFramesReceivedPerSecond"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
}
TEST_P(TestBasicJitterBuffer, DualPacketFrame) {