// CumulativeP creates a SignalFx cumulative counter for integer values from a pointer that is loaded atomically.
552700
func CumulativeP(metricName string, dimensions map[string]string, val *int64) *datapoint.Datapoint {
	return datapoint.New(metricName, dimensions, datapoint.NewIntValue(atomic.LoadInt64(val)), datapoint.Counter, time.Time{})
}
400576
func (mapOp *MapOperation) IncrementCounter(key string, increment int64) *MapOperation {
	if mapOp.removeCounters != nil {
		delete(mapOp.removeCounters, key)
	}
	if mapOp.incrementCounters == nil {
		mapOp.incrementCounters = make(map[string]int64)
	}
	mapOp.incrementCounters[key] += increment
	return mapOp
}
196026
func qp(p uint, g Pol) Pol {
	num := (1 << p)
	i := 1

	// start with x
	res := Pol(2)

	for i < num {
		// repeatedly square res
		res = res.MulMod(res, g)
		i *= 2
	}

	// add x
	return res.Add(2).Mod(g)
}
528805
func (c *Counter) Datapoints() []*datapoint.Datapoint {
	var dims map[string]string
	if c.DroppedReason != "" {
		dims = map[string]string{"reason": c.DroppedReason}
	}
	return []*datapoint.Datapoint{
		sfxclient.Cumulative("total_process_errors", nil, atomic.LoadInt64(&c.TotalProcessErrors)),
		sfxclient.Cumulative("total_datapoints", nil, atomic.LoadInt64(&c.TotalDatapoints)),
		sfxclient.Cumulative("total_events", nil, atomic.LoadInt64(&c.TotalEvents)),
		sfxclient.Cumulative("total_spans", nil, atomic.LoadInt64(&c.TotalSpans)),
		sfxclient.Cumulative("total_process_calls", nil, atomic.LoadInt64(&c.TotalProcessCalls)),
		sfxclient.Cumulative("dropped_points", dims, atomic.LoadInt64(&c.ProcessErrorPoints)),
		sfxclient.Cumulative("dropped_events", dims, atomic.LoadInt64(&c.ProcessErrorEvents)),
		sfxclient.Cumulative("dropped_spans", dims, atomic.LoadInt64(&c.ProcessErrorSpans)),
		sfxclient.Cumulative("process_time_ns", nil, atomic.LoadInt64(&c.TotalProcessTimeNs)),
		sfxclient.Gauge("calls_in_flight", nil, atomic.LoadInt64(&c.CallsInFlight)),
	}
}
1062721
func (b *CumulativeBucket) Datapoints() []*datapoint.Datapoint {
	if b.MetricName == "" {
		return []*datapoint.Datapoint{}
	}
	return []*datapoint.Datapoint{
		CumulativeP(b.MetricName+".count", b.Dimensions, &b.count),
		CumulativeP(b.MetricName+".sum", b.Dimensions, &b.sum),
		CumulativeF(b.MetricName+".sumsquare", b.Dimensions, b.sumOfSquares.Get()),
	}
}
77317
func (q *Quantity) Cmp(y Quantity) int {
	num1 := q.Value()
	num2 := y.Value()
	if num1 < MaxMilliValue && num2 < MaxMilliValue {
		num1 = q.MilliValue()
		num2 = y.MilliValue()
	}
	if num1 < num2 {
		return -1
	} else if num1 > num2 {
		return 1
	}
	return 0
}
813229
func (n *Graph) AddIIP(processName, portName string, data interface{}) error {
	if _, exists := n.procs[processName]; exists {
		n.iips = append(n.iips, iip{data: data, proc: processName, port: portName})
		return nil
	}
	return fmt.Errorf("AddIIP error: could not find '%s.%s'", processName, portName)
}
135389
func (v Version) Cmp(another Version) int {
	if v.Ver > another.Ver {
		return 1
	} else if v.Ver < another.Ver {
		return -1
	}
	return 0
}
358950
func SerialCtxDeps(ctx context.Context, fns ...interface{}) {
	types := checkFns(fns)
	for i := range fns {
		runDeps(ctx, types[i:i+1], fns[i:i+1])
	}
}
613500
func Float32P(val string) (*float32, error) {
	f, err := Float32(val)
	if err != nil {
		return nil, err
	}
	return proto.Float32(f), nil
}
1116154
func decrementDeviceNumChildrenOp(linkLayerDeviceDocID string) txn.Op {
	hasAtLeastOneMoreChild := bson.D{{"num-children", bson.D{{"$gte", 1}}}}
	return txn.Op{
		C:      linkLayerDevicesRefsC,
		Id:     linkLayerDeviceDocID,
		Assert: hasAtLeastOneMoreChild,
		Update: bson.D{{"$inc", bson.D{{"num-children", -1}}}},
	}
}
179622
func (s Semaphore) P(n int) {
	e := empty{}
	for i := 0; i < n; i++ {
		s <- e
	}
}
646226
func (h *Histogram) Cumulative() *Histogram {
	binCount := len(h.Bins)
	out := Histogram{make([]int, binCount)}

	if binCount > 0 {
		out.Bins[0] = h.Bins[0]
	}

	for i := 1; i < binCount; i++ {
		out.Bins[i] = out.Bins[i-1] + h.Bins[i]
	}

	return &out
}
789130
func Uint32P(val string) (*uint32, error) {
	i, err := Uint32(val)
	if err != nil {
		return nil, err
	}
	return proto.Uint32(i), err
}
756737
func (e Edge) Cmp(other Edge) int {
	if v0cmp := e.V0.Cmp(other.V0.Vector); v0cmp != 0 {
		return v0cmp
	}
	return e.V1.Cmp(other.V1.Vector)
}
855991
func ListIncrementOp(binName string, index int, value interface{}) *Operation {
	val := NewValue(value)
	switch val.(type) {
	case LongValue, IntegerValue, FloatValue:
	default:
		panic("Increment operation only accepts Integer or Float values")
	}
	return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_INCREMENT, IntegerValue(index), NewValue(value)}, encoder: listGenericOpEncoder}
}
23151
func (d *Context) PcallProp(objIndex int, nargs int) int {
	return int(C.duk_pcall_prop(d.duk_context, C.duk_idx_t(objIndex), C.duk_idx_t(nargs)))
}