func (mp *stdMeasuringPoint) String() string {
	return fmt.Sprintf("Measuring Point %q (%dx / min %s / max %s / avg %s)", mp.id, mp.count, mp.minDuration, mp.maxDuration, mp.avgDuration)
}
String implements the Stringer interface.
package monitoring
import (
	"fmt"
	"sort"
	"time"
	"github.com/tideland/golib/errors"
	"github.com/tideland/golib/logger"
	"github.com/tideland/golib/loop"
)
const (
	cmdReset = iota
	cmdMeasuringPointRead
	cmdMeasuringPointsReadAll
	cmdStaySetVariableRead
	cmdStaySetVariablesReadAll
	cmdDynamicStatusRetrieverRead
	cmdDynamicStatusRetrieversReadAll
)
type command struct {
	opCode   int
	args     interface{}
	respChan chan interface{}
}
func (c *command) respond(v interface{}) {
	c.respChan <- v
}
func (c *command) ok() {
	c.respond(true)
}
func (c *command) close() {
	close(c.respChan)
}
type stdMeasuring struct {
	backend   *stdBackend
	id        string
	startTime time.Time
	duration  time.Duration
}
func (m *stdMeasuring) EndMeasuring() time.Duration {
	if m.backend == nil {
		return 0
	}
	m.duration = time.Since(m.startTime)
	m.backend.measuringC <- m
	return m.duration
}
type stdMeasuringPoint struct {
	id          string
	count       int64
	minDuration time.Duration
	maxDuration time.Duration
	avgDuration time.Duration
}
func newStdMeasuringPoint(m *stdMeasuring) *stdMeasuringPoint {
	return &stdMeasuringPoint{
		id:          m.id,
		count:       1,
		minDuration: m.duration,
		maxDuration: m.duration,
		avgDuration: m.duration,
	}
}
func (mp *stdMeasuringPoint) ID() string { return mp.id }
func (mp *stdMeasuringPoint) Count() int64 { return mp.count }
func (mp *stdMeasuringPoint) MinDuration() time.Duration { return mp.minDuration }
func (mp *stdMeasuringPoint) MaxDuration() time.Duration { return mp.maxDuration }
func (mp *stdMeasuringPoint) AvgDuration() time.Duration { return mp.avgDuration }
func (mp *stdMeasuringPoint) update(m *stdMeasuring) {
	average := mp.avgDuration.Nanoseconds()
	mp.count++
	if mp.minDuration > m.duration {
		mp.minDuration = m.duration
	}
	if mp.maxDuration < m.duration {
		mp.maxDuration = m.duration
	}
	mp.avgDuration = time.Duration((average + m.duration.Nanoseconds()) / 2)
}