/** * Update should be called once per frame to correctly update "time per frame" and "frame rate (fps)" */ public void update() { final long time = getTime(); _tpf = (time - _previousTime) * INVERSE_TIMER_RESOLUTION; _fps = 1.0 / _tpf; _previousTime = time; }
/** * Update should be called once per frame to correctly update "time per frame" and "frame rate (fps)" */ public void update() { final long time = getTime(); _tpf = (time - _previousTime) * INVERSE_TIMER_RESOLUTION; _fps = 1.0 / _tpf; _previousTime = time; }
public double getTimeInSeconds() { return getTime() * INVERSE_TIMER_RESOLUTION; }
public double getTimeInSeconds() { return getTime() * INVERSE_TIMER_RESOLUTION; }
/** * Reset this timer, so that {@link #getTime()} and {@link #getTimeInSeconds()} reflects the time spend from this * call. */ public void reset() { _startTime = System.nanoTime(); _previousTime = getTime(); } }
/** * Reset this timer, so that {@link #getTime()} and {@link #getTimeInSeconds()} reflects the time spend from this * call. */ public void reset() { _startTime = System.nanoTime(); _previousTime = getTime(); } }
public static void resume() { setIgnoreStats(false); pausedTime += (timer.getTime() - pausedStartTime); } }
public static void pause() { setIgnoreStats(true); pausedStartTime = timer.getTime(); }
public static void resume() { setIgnoreStats(false); pausedTime += (timer.getTime() - pausedStartTime); } }
public static void pause() { setIgnoreStats(true); pausedStartTime = timer.getTime(); }
public static void endStat(final StatType type) { if (ignoreStats || !timedStats.contains(type)) { return; } synchronized (current) { // This will throw error if called out of turn. StatType top = timeStatStack.pop(); final double timeMS = timer.getTime() * TO_MS; // tally timer and include in stats. final StatValue val = current.get(top); val.incrementValue(timeMS - lastTimeCheckMS); lastTimeCheckMS = timeMS; // Pop until we find our stat type while (!top.equals(type)) { logger.warning("Mismatched endStat, found " + top + ". Expected '" + type + "'"); top = timeStatStack.pop(); } } }
public static void endStat(final StatType type) { if (ignoreStats || !timedStats.contains(type)) { return; } synchronized (current) { // This will throw error if called out of turn. StatType top = timeStatStack.pop(); final double timeMS = timer.getTime() * TO_MS; // tally timer and include in stats. final StatValue val = current.get(top); val.incrementValue(timeMS - lastTimeCheckMS); lastTimeCheckMS = timeMS; // Pop until we find our stat type while (!top.equals(type)) { logger.warning("Mismatched endStat, found " + top + ". Expected '" + type + "'"); top = timeStatStack.pop(); } } }
final StatType top = !timeStatStack.isEmpty() ? timeStatStack.peek() : null; final double timeMS = timer.getTime() * TO_MS; if (top != null) {
final StatType top = !timeStatStack.isEmpty() ? timeStatStack.peek() : null; final double timeMS = timer.getTime() * TO_MS; if (top != null) {
public static synchronized void update() { final double timeMS = timer.getTime() * TO_MS; final double elapsed = timeMS - lastSampleTime;
public static synchronized void update() { final double timeMS = timer.getTime() * TO_MS; final double elapsed = timeMS - lastSampleTime;