mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-11-26 14:36:28 -05:00
Some comments on test progress indicators
This commit is contained in:
parent
123928a7a2
commit
c27aabda2e
1 changed files with 4 additions and 2 deletions
|
|
@ -105,13 +105,15 @@ public class NetworkStressTest {
|
||||||
/** Print a progress indicator based on the given character. */
|
/** Print a progress indicator based on the given character. */
|
||||||
private void printProgress(char c, int n) {
|
private void printProgress(char c, int n) {
|
||||||
if (n < 1)
|
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();
|
long now = System.currentTimeMillis();
|
||||||
if ((now - lastProgressUpdateMillis) < 500)
|
if ((now - lastProgressUpdateMillis) < 500)
|
||||||
return; // throttle message printing below half a second
|
return;
|
||||||
lastProgressUpdateMillis = now;
|
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.print(String.format("\r%s> %c*%-6d ", this.getClass().getSimpleName(), c, n));
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue