func (regularDist *RegularDistribution) AddEntry(value float64, weight float64) {
	regularDist.AddEntryWithUnit(value, weight, "")
}
weight is 1/samplingRate
package regular
import (
	"github.com/aws/amazon-cloudwatch-agent/metric/distribution"
	"log"
	"math"
)
type RegularDistribution struct {
	maximum     float64
	minimum     float64
	sampleCount float64
	sum         float64
	buckets     map[float64]float64  
	unit        string
}
func NewRegularDistribution() distribution.Distribution {
	return &RegularDistribution{
		maximum:     0,  
		minimum:     math.MaxFloat64,
		sampleCount: 0,
		sum:         0,
		buckets:     map[float64]float64{},
		unit:        "",
	}
}
func (regularDist *RegularDistribution) Maximum() float64 {
	return regularDist.maximum
}
func (regularDist *RegularDistribution) Minimum() float64 {
	return regularDist.minimum
}
func (regularDist *RegularDistribution) SampleCount() float64 {
	return regularDist.sampleCount
}
func (regularDist *RegularDistribution) Sum() float64 {
	return regularDist.sum
}
func (regularDist *RegularDistribution) ValuesAndCounts() (values []float64, counts []float64) {
	values = []float64{}
	counts = []float64{}
	for value, counter := range regularDist.buckets {
		values = append(values, value)
		counts = append(counts, counter)
	}
	return
}
func (regularDist *RegularDistribution) Unit() string {
	return regularDist.unit
}
func (regularDist *RegularDistribution) Size() int {
	return len(regularDist.buckets)
}
func (regularDist *RegularDistribution) AddEntryWithUnit(value float64, weight float64, unit string) {
	if weight > 0 {
		if value < 0 {
			log.Printf("W! Value cannot be negative: %v", value)
			return
		}
		regularDist.sampleCount += weight
		regularDist.sum += value * weight
		if value < regularDist.minimum {
			regularDist.minimum = value
		}
		if value > regularDist.maximum {
			regularDist.maximum = value
		}
		regularDist.buckets[value] += weight
		if regularDist.unit == "" {
			regularDist.unit = unit
		} else if regularDist.unit != unit && unit != "" {
			log.Printf("D! Multiple units are dected: %s, %s", regularDist.unit, unit)
		}
	} else {
		log.Printf("D! Weight should be larger than 0: %v", weight)
	}
}