/** * Stop measuring the time if profiling is enabled. */ default void stopMeasuringIfEnabled() { // Checkstyle doesn't seem to understand "final" in interfaces // CHECKSTYLE:OFF if (this.isEnabled()) { final JCGLTimerQueryUsableType timer = this.getTimer(); this.getTimers().timerQueryFinish(timer); } // CHECKSTYLE:ON } }
@Test public final void testFinishNotRunning() { final JCGLTimersType g_t = this.getTimers("main"); final JCGLTimerQueryType q = g_t.timerQueryAllocate(); this.expected.expect(JCGLExceptionQueryNotRunning.class); g_t.timerQueryFinish(q); }
@Test public final void testFinishNotRunning() { final JCGLTimersType g_t = this.getTimers("main"); final JCGLTimerQueryType q = g_t.timerQueryAllocate(); this.expected.expect(JCGLExceptionQueryNotRunning.class); g_t.timerQueryFinish(q); }
@Test public final void testFinishNotRunningOther() { final JCGLTimersType g_t = this.getTimers("main"); final JCGLTimerQueryType q0 = g_t.timerQueryAllocate(); final JCGLTimerQueryType q1 = g_t.timerQueryAllocate(); g_t.timerQueryBegin(q0); this.expected.expect(JCGLExceptionQueryNotRunning.class); g_t.timerQueryFinish(q1); } }
@Test public final void testFinishNotRunningOther() { final JCGLTimersType g_t = this.getTimers("main"); final JCGLTimerQueryType q0 = g_t.timerQueryAllocate(); final JCGLTimerQueryType q1 = g_t.timerQueryAllocate(); g_t.timerQueryBegin(q0); this.expected.expect(JCGLExceptionQueryNotRunning.class); g_t.timerQueryFinish(q1); } }
@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); }