mirror of https://github.com/grpc/grpc-go.git
Change cpu core set and var declaration
This commit is contained in:
parent
3a13913bba
commit
bb1be7190b
|
@ -91,15 +91,16 @@ func startBenchmarkClient(config *testpb.ClientConfig) (*benchmarkClient, error)
|
|||
|
||||
grpclog.Printf(" - core limit: %v", config.CoreLimit)
|
||||
// Use one cpu core by default
|
||||
numOfCores := 1
|
||||
if config.CoreLimit > 0 {
|
||||
numOfCores = int(config.CoreLimit)
|
||||
// TODO: change default number of cores used if 1 is not fastest.
|
||||
if config.CoreLimit > 1 {
|
||||
runtime.GOMAXPROCS(int(config.CoreLimit))
|
||||
}
|
||||
runtime.GOMAXPROCS(numOfCores)
|
||||
|
||||
grpclog.Printf(" - payload config: %v", config.PayloadConfig)
|
||||
var payloadReqSize, payloadRespSize int
|
||||
var payloadType string
|
||||
var (
|
||||
payloadReqSize, payloadRespSize int
|
||||
payloadType string
|
||||
)
|
||||
if config.PayloadConfig != nil {
|
||||
switch c := config.PayloadConfig.Payload.(type) {
|
||||
case *testpb.PayloadConfig_BytebufParams:
|
||||
|
|
|
@ -93,7 +93,7 @@ func startBenchmarkServer(config *testpb.ServerConfig, serverPort int) (*benchma
|
|||
grpclog.Printf(" - core limit: %v", config.CoreLimit)
|
||||
// Use one cpu core by default.
|
||||
numOfCores := 1
|
||||
if config.CoreLimit > 0 {
|
||||
if config.CoreLimit > 1 {
|
||||
numOfCores = int(config.CoreLimit)
|
||||
}
|
||||
runtime.GOMAXPROCS(numOfCores)
|
||||
|
@ -108,8 +108,10 @@ func startBenchmarkServer(config *testpb.ServerConfig, serverPort int) (*benchma
|
|||
}
|
||||
|
||||
grpclog.Printf(" - payload config: %v", config.PayloadConfig)
|
||||
var addr string
|
||||
var close func()
|
||||
var (
|
||||
addr string
|
||||
close func()
|
||||
)
|
||||
if config.PayloadConfig != nil {
|
||||
switch payload := config.PayloadConfig.Payload.(type) {
|
||||
case *testpb.PayloadConfig_BytebufParams:
|
||||
|
|
Loading…
Reference in New Issue