!7 sclass Profiler extends DynBigNumber { transient new PerSecondCounter counter; transient int interval = 100; void enhanceFrame(JInternalFrame frame) { internalFrameTitlePopupMenu( "Start", r startTimer, "Stop", r stopAllTimers); } void start { setDescription("Java CPU"); startTimer(); } void startTimer { onlyTimer(doEvery(interval, r sample)); } void sample { Map threads = runnableThreadsWithStackTraces(); print(renderUserThreadsWithStackTraces(threads)); counter.inc(print(l(threads))); setValue(formatDouble(counter.get()*interval/1000*100, 2) + " %"); } }