add progress indicators to Trace test

Also, add a yield call to the tracing thread so it doesn't monopolize
the CPU.
This commit is contained in:
Joel Dice 2011-02-01 18:14:53 -07:00
parent aa9c887fb4
commit c4ededda83

View File

@ -63,6 +63,11 @@ public class Trace implements Runnable {
try {
for (int i = 0; i < 10000; ++i) {
test(this);
if (i % 100 == 0) {
System.out.print("r");
System.out.flush();
}
}
} finally {
alive = false;
@ -81,9 +86,15 @@ public class Trace implements Runnable {
while (trace.alive) {
thread.getStackTrace();
++ count;
if (count % 100 == 0) {
Thread.yield();
System.out.print("t");
System.out.flush();
}
}
System.out.println("got " + count + " traces");
System.out.println("\ngot " + count + " traces");
}
}
}