MCPcopy
hub / github.com/grpc/grpc-go / main

Function main

interop/stress/client/main.go:325–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

323}
324
325func main() {
326 flag.Parse()
327 resolver.SetDefaultScheme("dns")
328 addresses := strings.Split(*serverAddresses, ",")
329 tests := parseTestCases(*testCases)
330 logParameterInfo(addresses, tests)
331 testSelector := newWeightedRandomTestSelector(tests)
332 metricsServer := newMetricsServer()
333
334 var wg sync.WaitGroup
335 wg.Add(len(addresses) * *numChannelsPerServer * *numStubsPerChannel)
336 stop := make(chan bool)
337
338 for serverIndex, address := range addresses {
339 for connIndex := 0; connIndex < *numChannelsPerServer; connIndex++ {
340 conn, err := newConn(address, *useTLS, *testCA, *tlsServerName)
341 if err != nil {
342 logger.Fatalf("Fail to dial: %v", err)
343 }
344 defer conn.Close()
345 for clientIndex := 0; clientIndex < *numStubsPerChannel; clientIndex++ {
346 name := fmt.Sprintf("/stress_test/server_%d/channel_%d/stub_%d/qps", serverIndex+1, connIndex+1, clientIndex+1)
347 go func() {
348 defer wg.Done()
349 g := metricsServer.createGauge(name)
350 performRPCs(g, conn, testSelector, stop)
351 }()
352 }
353
354 }
355 }
356 go startServer(metricsServer, *metricsPort)
357 if *testDurationSecs > 0 {
358 time.Sleep(time.Duration(*testDurationSecs) * time.Second)
359 close(stop)
360 }
361 wg.Wait()
362 fmt.Fprintf(os.Stdout, "Total calls made: %v\n", totalNumCalls)
363 logger.Infof(" ===== ALL DONE ===== ")
364}

Callers

nothing calls this directly

Calls 15

SetDefaultSchemeFunction · 0.92
parseTestCasesFunction · 0.85
logParameterInfoFunction · 0.85
newMetricsServerFunction · 0.85
newConnFunction · 0.85
createGaugeMethod · 0.80
WaitMethod · 0.80
performRPCsFunction · 0.70
startServerFunction · 0.70
ParseMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected