// Measurement returns a measurement element.
547997
func (f *LogFile) Measurement(name []byte) MeasurementElem {
	f.mu.RLock()
	defer f.mu.RUnlock()

	mm, ok := f.mms[string(name)]
	if !ok {
		return nil
	}

	return mm
}
406454
func (blk *MeasurementBlock) Elem(name []byte) (e MeasurementBlockElem, ok bool) {
	n := int64(binary.BigEndian.Uint64(blk.hashData[:MeasurementNSize]))
	hash := rhh.HashKey(name)
	pos := hash % n

	// Track current distance
	var d int64
	for {
		// Find offset of measurement.
		offset := binary.BigEndian.Uint64(blk.hashData[MeasurementNSize+(pos*MeasurementOffsetSize):])
		if offset == 0 {
			return MeasurementBlockElem{}, false
		}

		// Evaluate name if offset is not empty.
		if offset > 0 {
			// Parse into element.
			var e MeasurementBlockElem
			e.UnmarshalBinary(blk.data[offset:])

			// Return if name match.
			if bytes.Equal(e.name, name) {
				return e, true
			}

			// Check if we've exceeded the probe distance.
			if d > rhh.Dist(rhh.HashKey(e.name), pos, n) {
				return MeasurementBlockElem{}, false
			}
		}

		// Move position forward.
		pos = (pos + 1) % n
		d++

		if d > n {
			return MeasurementBlockElem{}, false
		}
	}
}
83485
func Measure(id string, f func()) time.Duration {
	m := BeginMeasuring(id)
	f()
	return m.EndMeasuring()
}
331876
func (f *Factory) Gauge(options metrics.Options) metrics.Gauge {
	gauge := &gauge{
		gauges: make([]metrics.Gauge, len(f.factories)),
	}
	for i, factory := range f.factories {
		gauge.gauges[i] = factory.Gauge(options)
	}
	return gauge
}
721829
func (d *Document) Assess() *Assessment {
	a := Assessment{
		FleschKincaid: d.FleschKincaid(), ReadingEase: d.FleschReadingEase(),
		GunningFog: d.GunningFog(), SMOG: d.SMOG(), DaleChall: d.DaleChall(),
		AutomatedReadability: d.AutomatedReadability(), ColemanLiau: d.ColemanLiau()}

	gradeScores := []float64{
		a.FleschKincaid, a.AutomatedReadability, a.GunningFog, a.SMOG,
		a.ColemanLiau}

	mean, merr := stats.Mean(gradeScores)
	stdDev, serr := stats.StandardDeviation(gradeScores)
	if merr != nil || serr != nil {
		a.MeanGradeLevel = 0.0
		a.StdDevGradeLevel = 0.0
	} else {
		a.MeanGradeLevel = mean
		a.StdDevGradeLevel = stdDev
	}

	return &a
}
320902
func (s *ClusterStateService) Metric(metrics ...string) *ClusterStateService {
	s.metrics = append(s.metrics, metrics...)
	return s
}
1293472
func (m *metricUnit) Time(t TimeUnit, dimension int8) MetricUnit {
	if dimension < -8 || dimension > 7 {
		panic("dimension has to be between -8 and 7 inclusive")
	}

	m.repr |= uint32(t)
	m.repr |= (uint32(dimension) & 0xF) << 24
	return m
}
487791
func Measure(text string, body interface{}, samples int) bool {
	globalSuite.PushMeasureNode(text, body, types.FlagTypeNone, codelocation.New(1), samples)
	return true
}
466615
func (blk *MeasurementBlock) bytes() int {
	var b int
	// Do not count contents of blk.data or blk.hashData because they reference into an external []byte
	b += int(unsafe.Sizeof(*blk))
	return b
}
537259
func (s *sender) Gauge(stat string, value float64, tags ...string) {
	s.RLock()
	m, ok := s.gauges[stat]
	s.RUnlock()
	keys, values := splitTags(tags)
	if !ok {
		s.Lock()
		if m, ok = s.gauges[stat]; !ok {
			m = prometheus.NewGaugeVec(
				prometheus.GaugeOpts{Name: stat, Help: stat},
				keys)
			prometheus.MustRegister(m)
			s.gauges[stat] = m
		}
		s.Unlock()
	}
	m.WithLabelValues(values...).Set(value)
}
1051244
func (m *CountMeter) Mark(i int64) {
	m.mtx.Lock()
	defer m.mtx.Unlock()
	m.counters[0] += i
	m.overall += i
}
856721
func (m memoizedMeasurable) Size() int {
	if m.size <= 0 {
		m.size = m.m.Size()
	}
	return m.size
}
1193063
func (p *Partition) MeasurementIterator() (tsdb.MeasurementIterator, error) {
	fs, err := p.RetainFileSet()
	if err != nil {
		return nil, err
	}
	itr := fs.MeasurementIterator()
	if itr == nil {
		fs.Release()
		return nil, nil
	}
	return newFileSetMeasurementIterator(fs, NewTSDBMeasurementIteratorAdapter(itr)), nil
}
967191
func (a Measurements) String() string {
	var str []string
	for _, m := range a {
		str = append(str, m.String())
	}
	return strings.Join(str, ", ")
}
951951
func (c *Client) GetMeasurements(ctx context.Context, db string, limit, offset int) ([]chronograf.Measurement, error) {
	return c.showMeasurements(ctx, db, limit, offset)
}
458654
func AppendMeasure(b []byte, m stats.Measure) []byte {
	return AppendMeasureFiltered(b, m, nil)
}
184321
func (fs *FileSet) MeasurementIterator() MeasurementIterator {
	a := make([]MeasurementIterator, 0, len(fs.files))
	for _, f := range fs.files {
		itr := f.MeasurementIterator()
		if itr != nil {
			a = append(a, itr)
		}
	}
	return MergeMeasurementIterators(a...)
}