59
59
import java .util .concurrent .ConcurrentHashMap ;
60
60
import java .util .concurrent .Executors ;
61
61
import java .util .concurrent .ScheduledExecutorService ;
62
+ import java .util .concurrent .atomic .AtomicLong ;
62
63
import java .util .logging .Level ;
63
64
import java .util .logging .Logger ;
64
65
@@ -91,6 +92,7 @@ public void run() {
91
92
client .runStressTest ();
92
93
client .startMetricsLogging ();
93
94
client .blockUntilStressTestComplete ();
95
+ log .log (Level .INFO , "Total calls made: {0}" , client .getTotalCallCount ());
94
96
} catch (Exception e ) {
95
97
log .log (Level .WARNING , "The stress test client encountered an error!" , e );
96
98
} finally {
@@ -117,6 +119,7 @@ public void run() {
117
119
private Server metricsServer ;
118
120
private final Map <String , Metrics .GaugeResponse > gauges =
119
121
new ConcurrentHashMap <>();
122
+ private final AtomicLong totalCallCount = new AtomicLong (0 );
120
123
121
124
private volatile boolean shutdown ;
122
125
@@ -410,6 +413,10 @@ private ManagedChannel createChannel(InetSocketAddress address) {
410
413
return builder .build ();
411
414
}
412
415
416
+ private long getTotalCallCount () {
417
+ return totalCallCount .get ();
418
+ }
419
+
413
420
private static String serverAddressesToString (List <InetSocketAddress > addresses ) {
414
421
List <String > tmp = new ArrayList <>();
415
422
for (InetSocketAddress address : addresses ) {
@@ -485,6 +492,7 @@ public void run() {
485
492
}
486
493
487
494
testCasesSinceLastMetricsCollection ++;
495
+ totalCallCount .incrementAndGet ();
488
496
489
497
double durationSecs = computeDurationSecs (lastMetricsCollectionTime );
490
498
if (durationSecs >= METRICS_COLLECTION_INTERVAL_SECS ) {
0 commit comments