yuruguo commented on a change in pull request #12020:
URL: https://github.com/apache/pulsar/pull/12020#discussion_r707946041



##########
File path: 
pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java
##########
@@ -242,10 +240,19 @@ public void runPerformanceTest(long messages, long limit, 
int numOfTopic, int si
         executor.submit(() -> {
             try {
                 RateLimiter rateLimiter = RateLimiter.create(limit);
+                long startTime = System.nanoTime();
+                long testEndTime = startTime + (long) (testTime * 1e9);
                 // Send messages on all topics/producers
                 long totalSent = 0;
                 while (true) {
                     for (String topic : producersMap.keySet()) {
+                        if (testTime > 0) {
+                            if (System.nanoTime() > testEndTime) {
+                                log.info("------------- DONE (reached the 
maximum duration: [{} seconds] of production) --------------", testTime);

Review comment:
       We could print throughput and delay data by adding a shutdown hook in 
other pr([Printing aggregated data when client 
exit](https://github.com/apache/pulsar/pull/11985/files#diff-cf545bbba2c55f89cbaf23d8ef206e8ac765b82e2fe0652c3253a23c310f9d36R335-R339)),
 which should meet your requirements.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to