Updated metric Distribution and Timer utils.
[ 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
This commit is contained in:
@@ -4,12 +4,12 @@
|
||||
//
|
||||
// This file contains the definition of a Distribution class which computes
|
||||
// the distribution values of a series of samples.
|
||||
|
||||
#ifndef WVCDM_METRICS_DISTRIBUTION_H_
|
||||
#define WVCDM_METRICS_DISTRIBUTION_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
// The Distribution class holds statistics about a series of values that the
|
||||
@@ -25,7 +25,7 @@ namespace metrics {
|
||||
// dist.Count(); // Returns 2.
|
||||
class Distribution {
|
||||
public:
|
||||
Distribution();
|
||||
Distribution() {}
|
||||
|
||||
// Uses the provided sample value to update the computed statistics.
|
||||
void Record(float value);
|
||||
@@ -41,11 +41,11 @@ class Distribution {
|
||||
}
|
||||
|
||||
private:
|
||||
uint64_t count_;
|
||||
float min_;
|
||||
float max_;
|
||||
float mean_;
|
||||
double sum_squared_deviation_;
|
||||
uint64_t count_ = 0;
|
||||
float min_ = std::numeric_limits<float>::max();
|
||||
float max_ = std::numeric_limits<float>::lowest();
|
||||
float mean_ = 0.0f;
|
||||
double sum_squared_deviation_ = 0.0;
|
||||
};
|
||||
} // namespace metrics
|
||||
} // namespace wvcdm
|
||||
|
||||
Reference in New Issue
Block a user