You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
254 B
15 lines
254 B
package common
|
|
|
|
import "runtime"
|
|
|
|
//计算cpu合适数量
|
|
|
|
func CalculateTheNumberOfCPUCores() (int, bool) {
|
|
cpuNumber := runtime.NumCPU() - 3
|
|
cpuIsTrue := true
|
|
if cpuNumber <= 0 {
|
|
cpuNumber = 1
|
|
cpuIsTrue = false
|
|
}
|
|
return cpuNumber, cpuIsTrue
|
|
}
|
|
|