Documentation ¶
Index ¶
- Constants
- func Avg(values []float64) float64
- func CalculateInterpolatedCurveValue(steps map[int]float64, interpolationType string, input float64) float64
- func CheckFilePermissionsForExecution(filePath string) (bool, error)
- func Coerce(value float64, min float64, max float64) float64
- func ContainsString(s []string, e string) bool
- func CreateRollingWindow(size int) *rolling.PointPolicy
- func ExtractKeysWithDistinctValues(input map[int]int) []int
- func FillWindow(window *rolling.PointPolicy, size int, value float64)
- func FindClosest(target int, arr []int) int
- func FindFilesMatching(path string, expr *regexp.Regexp) []string
- func GetWindowAvg(window *rolling.PointPolicy) float64
- func GetWindowMax(window *rolling.PointPolicy) float64
- func HexString(hex string) string
- func InterpolateLinearly(data *map[int]float64, start int, stop int) map[int]float64
- func Max(s []float64) float64
- func Min(s []float64) float64
- func Ratio(target float64, rangeMin float64, rangeMax float64) float64
- func ReadIntFromFile(path string) (value int, err error)
- func SafeCmdExecution(executable string, args []string, timeout time.Duration) (string, error)
- func SortedKeys[T constraints.Ordered, K any](input map[T]K) []T
- func UpdateSimpleMovingAvg(oldAvg float64, n int, newValue float64) float64
- func Values[A constraints.Ordered, B any](input map[A]B) []B
- func WriteIntToFile(value int, path string) error
- func WriteIntToFileAtomic(value int, path string) error
- type PidLoop
Constants ¶
const (
InterpolationTypeLinear = "linear"
)
Variables ¶
This section is empty.
Functions ¶
func CalculateInterpolatedCurveValue ¶
func CalculateInterpolatedCurveValue(steps map[int]float64, interpolationType string, input float64) float64
CalculateInterpolatedCurveValue creates an interpolated function from the given map of x-values -> y-values as specified by the interpolationType and returns the y-value for the given input
func CheckFilePermissionsForExecution ¶
CheckFilePermissionsForExecution checks whether the given filePath owner, group and permissions are safe to use this file for execution by fan2go.
func ContainsString ¶
func CreateRollingWindow ¶
func CreateRollingWindow(size int) *rolling.PointPolicy
func FillWindow ¶
func FillWindow(window *rolling.PointPolicy, size int, value float64)
FillWindow completely fills the given window with the given value
func FindClosest ¶
FindClosest finds the closest value to target in options.
func FindFilesMatching ¶
FindFilesMatching finds all files in a given directory, matching the given regex
func GetWindowAvg ¶
func GetWindowAvg(window *rolling.PointPolicy) float64
GetWindowAvg returns the average of all values in the window
func GetWindowMax ¶
func GetWindowMax(window *rolling.PointPolicy) float64
GetWindowMax returns the max value in the window
func HexString ¶
HexString parses the given string as hex and string formats it, removing any leading zeros in the process
func InterpolateLinearly ¶
InterpolateLinearly takes the given mapping and adds interpolated values in [start;stop].
func Ratio ¶
Ratio calculates the ratio that target has in comparison to rangeMin and rangeMax Make sure that: rangeMin <= target <= rangeMax rangeMax - rangeMin != 0
func ReadIntFromFile ¶
func SafeCmdExecution ¶
func SortedKeys ¶
func SortedKeys[T constraints.Ordered, K any](input map[T]K) []T
func UpdateSimpleMovingAvg ¶
UpdateSimpleMovingAvg calculates the new moving average, based on an existing average and buffer size
func Values ¶
func Values[A constraints.Ordered, B any](input map[A]B) []B
func WriteIntToFile ¶
WriteIntToFile write a single integer to a file.go path