From c4ededda8332391836b7f09db4f99651ea805cf3 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 1 Feb 2011 18:14:53 -0700 Subject: [PATCH] add progress indicators to Trace test Also, add a yield call to the tracing thread so it doesn't monopolize the CPU. --- test/Trace.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/Trace.java b/test/Trace.java index 238e8e0329..79aa3b421d 100644 --- a/test/Trace.java +++ b/test/Trace.java @@ -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"); } } }