MCPcopy
hub / github.com/lindb/lindb / RateCall

Function RateCall

aggregation/function/rate.go:27–38  ·  view source on GitHub ↗

RateCall represents rate function call.

(interval int64, params ...*collections.FloatArray)

Source from the content-addressed store, hash-verified

25
26// RateCall represents rate function call.
27func RateCall(interval int64, params ...*collections.FloatArray) *collections.FloatArray {
28 if len(params) == 0 {
29 return nil
30 }
31 result := collections.NewFloatArray(params[0].Capacity())
32 itr := params[0].NewIterator()
33 for itr.HasNext() {
34 idx, val := itr.Next()
35 result.SetValue(idx, val/float64(interval/timeutil.OneSecond))
36 }
37 return result
38}

Callers 2

funcCallMethod · 0.92
TestRateCallFunction · 0.85

Calls 6

HasNextMethod · 0.95
NextMethod · 0.95
SetValueMethod · 0.95
NewFloatArrayFunction · 0.92
CapacityMethod · 0.80
NewIteratorMethod · 0.65

Tested by 1

TestRateCallFunction · 0.68