20 package com.griddynamics.jagger.engine.e1.collector;
22 import com.google.common.collect.Lists;
24 import java.util.List;
35 return new StdDevMetricAggregator();
38 private static class StdDevMetricAggregator
implements MetricAggregator<Number> {
40 List<Number> points = null;
43 private double getMean() {
46 for (Number d : points) {
47 sum += d.doubleValue();
49 return sum / points.size();
54 public void append(Number calculated) {
56 points = Lists.newLinkedList();
58 points.add(calculated);
62 public Number getAggregated() {
66 double mean = getMean();
69 for (Number d : points) {
70 sum += (d.doubleValue() - mean) * (d.doubleValue() - mean);
73 return Math.sqrt(sum / points.size());
82 public String getName() {
87 public String toString() {
88 return "StdDevMetricAggregator{" +