mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-21 16:16:27 -04:00
Simplify test progress reporting, force printing on last entry
This commit is contained in:
parent
53019a88f2
commit
7f1204e09e
@ -114,17 +114,19 @@ public class NetworkStressTest {
|
||||
|
||||
/** Print a progress bar based on the given character. */
|
||||
private void printProgress(char c, int n) {
|
||||
if (n < 1)
|
||||
return; // nothing to represent
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - lastProgressUpdateMillis < 500)
|
||||
return; // throttle message printing below half a second
|
||||
if ((n != 1) && ((now - lastProgressUpdateMillis) < 500))
|
||||
return; // throttle message printing below half a second (but last one is always printed)
|
||||
lastProgressUpdateMillis = now;
|
||||
if (n > 0) {
|
||||
String hdr = String.format("\r%s> ", this.getClass().getSimpleName());
|
||||
String msg = (hdr.length() - 1/*carriage return*/ + n + 1/*final space*/ > terminalColumns)
|
||||
? String.format("%c*%d", c, n)
|
||||
: nChars(c, n);
|
||||
System.out.print(hdr + msg + ' ');
|
||||
}
|
||||
|
||||
String hdr = String.format("\r%s> ", this.getClass().getSimpleName());
|
||||
String msg = (hdr.length() - 1/*carriage return*/ + n + 1/*final space*/ > terminalColumns)
|
||||
? String.format("%c*%d", c, n)
|
||||
: nChars(c, n);
|
||||
System.out.print(hdr + msg + ' ');
|
||||
if (n == 1)
|
||||
System.out.print('\n');
|
||||
System.out.flush();
|
||||
|
Loading…
x
Reference in New Issue
Block a user