// IncrCounter increments a counter metric
11343
func (s *CirconusSink) IncrCounter(key []string, val float32) {
	flatKey := s.flattenKey(key)
	s.metrics.IncrementByValue(flatKey, uint64(val))
}
924674
func IncCounterBy(id uint32, amount uint64) {
	atomic.AddUint64(&counters[id], amount)
}
1076091
func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec {
	desc := NewDesc(
		BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
		opts.Help,
		labelNames,
		opts.ConstLabels,
	)
	return &CounterVec{
		metricVec: newMetricVec(desc, func(lvs ...string) Metric {
			if len(lvs) != len(desc.variableLabels) {
				panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs))
			}
			result := &counter{desc: desc, labelPairs: makeLabelPairs(desc, lvs)}
			result.init(result) // Init self-collection.
			return result
		}),
	}
}
297744
func (s *Job) SetCounters(v *Counters) *Job {
	s.Counters = v
	return s
}
859515
func (s *Suite) SetCounters(v *Counters) *Suite {
	s.Counters = v
	return s
}
1138990
func initCounters() (err error) {

	processPid = os.Getpid()
	// require an addressible nil pointer
	var source uint16
	if err := pdhOpenQuery(&source, 0, &pcHandle); err != nil {
		return err
	}

	// setup the performance counters, search for all server instances
	name := fmt.Sprintf("%s*", getProcessImageName())
	pidQuery := fmt.Sprintf("\\Process(%s)\\ID Process", name)
	cpuQuery := fmt.Sprintf("\\Process(%s)\\%% Processor Time", name)
	rssQuery := fmt.Sprintf("\\Process(%s)\\Working Set - Private", name)
	vssQuery := fmt.Sprintf("\\Process(%s)\\Virtual Bytes", name)

	if err = pdhAddCounter(pcHandle, pidQuery, 0, &pidCounter); err != nil {
		return err
	}
	if err = pdhAddCounter(pcHandle, cpuQuery, 0, &cpuCounter); err != nil {
		return err
	}
	if err = pdhAddCounter(pcHandle, rssQuery, 0, &rssCounter); err != nil {
		return err
	}
	if err = pdhAddCounter(pcHandle, vssQuery, 0, &vssCounter); err != nil {
		return err
	}

	// prime the counters by collecting once, and sleep to get somewhat
	// useful information the first request.  Counters for the CPU require
	// at least two collect calls.
	if err = pdhCollectQueryData(pcHandle); err != nil {
		return err
	}
	time.Sleep(50)

	return nil
}
867677
func NewCounter(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) Counter {
	if metadata == nil {
		metadata = &types.MetricMetadata{}
	}
	m := &counter{intMetric{metric{
		MetricInfo: types.MetricInfo{
			Name:        name,
			Description: description,
			Fields:      fields,
			ValueType:   types.CumulativeIntType,
		},
		MetricMetadata: *metadata,
	}}}
	registry.Add(m)
	return m
}
285070
func NewImportMetricCounter() *ImportMetricCounter {
	return &ImportMetricCounter{
		importSuccessCounts: make(metrics.ImportSuccessCounts),
		importErrorCounts:   make(metrics.ImportErrorCounts),
	}
}
302959
func NewOutCounter(s core.Side, overflowLen int) (c Counter) {
	c.overflowLen = overflowLen
	if s == core.ServerSide {
		// Server counters in ALTS record have the little-endian high bit
		// set.
		c.value[counterLen-1] = 0x80
	}
	return
}
1270616
func (c *ShardedClient) Increment(
	key string,
	delta uint64,
	initValue uint64,
	expiration uint32) CountResponse {

	return c.count(
		key,
		func(shardClient Client) CountResponse {
			return shardClient.Increment(key, delta, initValue, expiration)
		})
}
98578
func (c *Client) Increment(name string, count int, rate float64) error {
	return c.send(name, rate, "%d|c", count)
}
1287506
func GetOrRegisterCounter(name string, r Registry) Counter {
	if nil == r {
		r = DefaultRegistry
	}
	return r.GetOrRegister(name, NewCounter).(Counter)
}
188192
func (c *PCPCounterVector) Inc(inc int64, instance string) error {
	c.mutex.Lock()
	defer c.mutex.Unlock()

	if inc < 0 {
		return errors.New("increment cannot be negative")
	}

	if inc == 0 {
		return nil
	}

	v, err := c.valInstance(instance)
	if err != nil {
		return err
	}

	return c.setInstance(v.(int64)+inc, instance)
}
192973
func (c CPUInfo) RTCounter() uint64 {
	if !c.RDTSCP() {
		return 0
	}
	a, _, _, d := rdtscpAsm()
	return uint64(a) | (uint64(d) << 32)
}
1292689
func NewCounterAspect() *CounterAspect {
	ca := &CounterAspect{}
	ca.inc = make(chan tuple)
	ca.internalRequestsSum = 0
	ca.internalRequests = make(map[string]int, 0)
	ca.internalRequestCodes = make(map[int]int, 0)
	return ca
}
1143331
func (mb *MetricBatcher) BatchCounter(name string) BatchCounterChainer {
	return batchCounterChainer{
		batcher: mb,
		name:    name,
		tags:    make(map[string]string),
	}
}
524771
func NewFloatCounter(name string, description string, metadata *types.MetricMetadata, fields ...field.Field) FloatCounter {
	if metadata == nil {
		metadata = &types.MetricMetadata{}
	}
	m := &floatCounter{floatMetric{metric{
		MetricInfo: types.MetricInfo{
			Name:        name,
			Description: description,
			Fields:      fields,
			ValueType:   types.CumulativeFloatType,
		},
		MetricMetadata: *metadata,
	}}}
	registry.Add(m)
	return m
}