[ Merge of http://go/wvgerrit/137811 ] Renamed TimerMetric to Timer. Timer is used to generate durations included in metrics, but is not a metric itself. The method of getting the current time did not require creating an instance of std::steady_clock. Updated Distribution and Timer to use default initializers instead of constructor initialization list. Bug: 204946540 Test: Metric unit tests Change-Id: I7ed291b586347dd0b7ab305960883bec04637315
20 lines
648 B
C++
20 lines
648 B
C++
// Copyright 2017 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine License
|
|
// Agreement.
|
|
//
|
|
// This file contains the definitions for the Distribution class members.
|
|
#include "distribution.h"
|
|
|
|
namespace wvcdm {
|
|
namespace metrics {
|
|
void Distribution::Record(float value) {
|
|
// Using method of provisional means.
|
|
const float deviation = value - mean_;
|
|
mean_ += (deviation / ++count_);
|
|
sum_squared_deviation_ += (deviation * (value - mean_));
|
|
min_ = min_ < value ? min_ : value;
|
|
max_ = max_ > value ? max_ : value;
|
|
}
|
|
} // namespace metrics
|
|
} // namespace wvcdm
|