long retrieveRecursive() { this.elapsed = 0L; this.elapsed_total = 0L; if (this.hasTimer()) { final long r = JCGLProfiling.this.timers.timerQueryResultGet(this.timer.get()); this.elapsed = r; this.elapsed_total = this.elapsed; } final ReferenceCollection<Context> os = this.children.values(); final ObjectIterator<Context> o_iter = os.iterator(); while (o_iter.hasNext()) { final Context c = o_iter.next(); this.elapsed_total += c.retrieveRecursive(); } return this.elapsed_total; } }
@Test public final void testOrdering() throws Exception { final JCGLTimersType g_t = this.getTimers("main"); final JCGLTimerQueryType q0 = g_t.timerQueryAllocate(); g_t.timerQueryBegin(q0); // Do some work to waste time g_t.timerQueryAllocate(); g_t.timerQueryAllocate(); g_t.timerQueryAllocate(); g_t.timerQueryAllocate(); g_t.timerQueryAllocate(); g_t.timerQueryFinish(q0); while (g_t.timerQueryResultAvailability(q0) == JCGLQueryResultAvailability.QUERY_RESULT_NOT_YET_AVAILABLE) { System.out.println("Waiting for q0: " + q0); Thread.sleep(1000L); } final long q0_r = g_t.timerQueryResultGet(q0); System.out.println("q0_r: " + q0_r); Assert.assertTrue(q0_r > 0); }
@Test public final void testOrdering() throws Exception { final JCGLTimersType g_t = this.getTimers("main"); final JCGLTimerQueryType q0 = g_t.timerQueryAllocate(); g_t.timerQueryBegin(q0); // Do some work to waste time g_t.timerQueryAllocate(); g_t.timerQueryAllocate(); g_t.timerQueryAllocate(); g_t.timerQueryAllocate(); g_t.timerQueryAllocate(); g_t.timerQueryFinish(q0); while (g_t.timerQueryResultAvailability(q0) == JCGLQueryResultAvailability.QUERY_RESULT_NOT_YET_AVAILABLE) { System.out.println("Waiting for q0: " + q0); Thread.sleep(1000L); } final long q0_r = g_t.timerQueryResultGet(q0); System.out.println("q0_r: " + q0_r); Assert.assertTrue(q0_r > 0); }