39 if (variable_.
samples.empty()) {
44 std::chrono::duration_cast<std::chrono::duration<uint32, std::milli>>(
61 : variable_(descriptor, 0,
62 std::numeric_limits<double>::max(),
63 std::numeric_limits<double>::min(),
70 variable_.minimum = std::min(variable_.minimum, value);
71 variable_.maximum = std::max(variable_.maximum, value);
74 const double delta = value - variable_.mean;
75 variable_.mean += delta /
static_cast<double>(variable_.samples);
76 m2_ += delta * (value - variable_.mean);
84 math::Sqrt(m2_ / static_cast<double>(variable_.samples - 1U)) : 0.0;
100 const size_t num_samples = sampled_variable.
samples.size();
101 for (
size_t i = 0; i < num_samples; ++i)
void AddSample(double value)
Adds one sample of the SampledVariable's value.
void AddSample(double value)
Adds one sample of the Variable's value.
This struct represents a single timestamped value of a variable.
T Sqrt(const T &val)
Returns the square root of a value.
const AccumulatedVariable Get()
Returns the resulting Variable.
void Reset()
Resets the timer.
static const AccumulatedVariable AccumulateSampledVariable(const SampledVariable &sampled_variable)
Converts a SampledVariable to an AccumulatedVariable by accumulating all of the samples.
Clock::duration Get() const
Returns the elapsed time since construction or the last Reset().
This struct represents a variable: a number that may vary over samples, such as a count or timing...
VariableAccumulator(const Descriptor &descriptor)
Benchmark::VariableAccumulator functions.
This struct stores information about a measurement computed by benchmarking.
double standard_deviation
This class aids in accumulation of a benchmarked AccumulatedVariable.
std::vector< Sample > samples
This struct represents accumulated values for a variable.