From c27aabda2e166ddbc5c308aaed5c3870d042d8c1 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Thu, 12 May 2016 10:33:59 +0200 Subject: [PATCH] Some comments on test progress indicators --- .../java/io/bitsquare/p2p/network/NetworkStressTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java b/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java index 1ccc478c58..9cdcabdd99 100644 --- a/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java +++ b/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java @@ -105,13 +105,15 @@ public class NetworkStressTest { /** Print a progress indicator based on the given character. */ private void printProgress(char c, int n) { if (n < 1) - return; // nothing to represent + return; // completed tasks are not shown + // Do not print the indicator if the last one was shown less than half second ago. long now = System.currentTimeMillis(); if ((now - lastProgressUpdateMillis) < 500) - return; // throttle message printing below half a second + return; lastProgressUpdateMillis = now; + // Keep a fixed length so that indicators do not overwrite partially. System.out.print(String.format("\r%s> %c*%-6d ", this.getClass().getSimpleName(), c, n)); System.out.flush(); }