func (c *Counter) ValueOf(aggType aggregation.Type) float64 {
	switch aggType {
	case aggregation.Min:
		return float64(c.Min())
	case aggregation.Max:
		return float64(c.Max())
	case aggregation.Mean:
		return c.Mean()
	case aggregation.Count:
		return float64(c.Count())
	case aggregation.Sum:
		return float64(c.Sum())
	case aggregation.SumSq:
		return float64(c.SumSq())
	case aggregation.Stdev:
		return c.Stdev()
	default:
		return 0
	}
}
ValueOf returns the value for the aggregation type.
package aggregation
import (
	"math"
	"github.com/m3db/m3metrics/aggregation"
)
type Counter struct {
	Options
	sum   int64
	sumSq int64
	count int64
	max   int64
	min   int64
}
func NewCounter(opts Options) Counter {
	return Counter{
		Options: opts,
		max:     math.MinInt64,
		min:     math.MaxInt64,
	}
}
func (c *Counter) Update(value int64) {
	c.sum += value
	c.count++
	if c.max < value {
		c.max = value
	}
	if c.min > value {
		c.min = value
	}
	if c.HasExpensiveAggregations {
		c.sumSq += value * value
	}
}
func (c *Counter) Count() int64 { return c.count }
func (c *Counter) Sum() int64 { return c.sum }
func (c *Counter) SumSq() int64 { return c.sumSq }
func (c *Counter) Mean() float64 {
	if c.count == 0 {
		return 0
	}
	return float64(c.sum) / float64(c.count)
}
func (c *Counter) Stdev() float64 {
	return stdev(c.count, float64(c.sumSq), float64(c.sum))
}
func (c *Counter) Min() int64 { return c.min }
func (c *Counter) Max() int64 { return c.max }