lib/cgroup: add SetGOGC() function

This function is going to be used by VictoriaLogs
This commit is contained in:
Aliaksandr Valialkin 2023-06-19 22:38:58 -07:00
parent c1bed35b39
commit 3409317a67
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -34,6 +34,18 @@ func initGOGC() {
}
}
// SetGOGC sets GOGC to the given percent
func SetGOGC(percent int) {
if percent <= 0 {
return
}
if percent > 100 {
percent = 100
}
gogc = percent
debug.SetGCPercent(gogc)
}
var gogc int
// GetMemoryLimit returns cgroup memory limit