@@ -54,13 +54,17 @@ func main() {
5454
5555 var rateLimiter = rate .NewLimiter (requestRate , requestBurst )
5656 samplesPerClient := * numberRequests / * clients
57+ samplesPerClientRemainder := * numberRequests % * clients
5758 client_update_tick := 1
5859
5960 connectionStr := fmt .Sprintf ("%s:%d" , * host , * port )
6061 // a WaitGroup for the goroutines to tell us they've stopped
6162 wg := sync.WaitGroup {}
6263 if ! * loop {
6364 log .Printf ("Total clients: %d. Commands per client: %d Total commands: %d\n " , * clients , samplesPerClient , * numberRequests )
65+ if samplesPerClientRemainder != 0 {
66+ log .Printf ("Last client will issue: %d commands.\n " , samplesPerClientRemainder + samplesPerClient )
67+ }
6468 } else {
6569 log .Printf ("Running in loop until you hit Ctrl+C\n " )
6670 }
@@ -98,12 +102,15 @@ func main() {
98102
99103 dataPointProcessingWg .Add (1 )
100104 go processGraphDatapointsChannel (graphDatapointsChann , c1 , * numberRequests , & dataPointProcessingWg , & instantHistogramsResetMutex )
101-
105+ clientTotalCmds := samplesPerClient
102106 startTime := time .Now ()
103107 for client_id := 0 ; uint64 (client_id ) < * clients ; client_id ++ {
104108 wg .Add (1 )
105109 rgs [client_id ], conns [client_id ] = getStandaloneConn (* graphKey , "tcp" , connectionStr , * password )
106- go ingestionRoutine (& rgs [client_id ], true , queries , cdf , samplesPerClient , * loop , * debug , & wg , useRateLimiter , rateLimiter , graphDatapointsChann )
110+ if uint64 (client_id ) == (* clients - uint64 (1 )) {
111+ clientTotalCmds = samplesPerClientRemainder + samplesPerClient
112+ }
113+ go ingestionRoutine (& rgs [client_id ], true , queries , cdf , clientTotalCmds , * loop , * debug , & wg , useRateLimiter , rateLimiter , graphDatapointsChann )
107114 }
108115
109116 // enter the update loop
0 commit comments