RateCall represents rate function call.
(interval int64, params ...*collections.FloatArray)
| 25 | |
| 26 | // RateCall represents rate function call. |
| 27 | func 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 | } |