summaryrefslogtreecommitdiff
path: root/vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go')
-rw-r--r--vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go b/vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go
index df6eacf05..f8a2834ac 100644
--- a/vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go
+++ b/vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go
@@ -20,6 +20,8 @@
package runtime
+import "math"
+
// CPUQuotaStatus presents the status of how CPU quota is used
type CPUQuotaStatus int
@@ -31,3 +33,8 @@ const (
// CPUQuotaMinUsed is returned when CPU quota is smaller than the min value
CPUQuotaMinUsed
)
+
+// DefaultRoundFunc is the default function to convert CPU quota from float to int. It rounds the value down (floor).
+func DefaultRoundFunc(v float64) int {
+ return int(math.Floor(v))
+}