func bucketExponent(d time.Duration) int {
	e := -9
	for d != 0 {
		d /= 10
		e++
	}
	return e
}
The exponent is the upper bound of the duration in seconds.
package perf
import (
	"bytes"
	"expvar"
	"fmt"
	"math"
	"sync"
	"time"
	"github.com/anacrolix/missinggo"
)
var (
	em = missinggo.NewExpvarIndentMap("perfBuckets")
	mu sync.RWMutex
)
type Timer struct {
	started time.Time
}
func NewTimer() Timer {
	return Timer{time.Now()}
}