public static long getItemCountPerSecond(String name, long elements) { NanoTimerElement timer = users.get(name); timer.refresh(); if (timer == null) return -1; if (elements < 0) return -1; if (timer.getElapsedTime() == 0) return -1; long items = (BILLION * elements) / timer.getElapsedTime(); return items; }
public static String getElapsedTimeStringAsMillis(String name) { NanoTimerElement timer = users.get(name); if (timer == null) return "Invalid chronometer: " + name; ; timer.refresh(); return "Delta: " + timer.getDiff() / MILLION + "ms. Elapsed: " + timer.getElapsedTime() / MILLION + " ms."; }
public static String getElapsedTimeString(String name) { NanoTimerElement timer = users.get(name); if (timer == null) return "Invalid chronometer: " + name; ; timer.refresh(); return "Delta: " + formatter.format((double) timer.getDiff() / BILLION) + " s. Elapsed: " + formatter.format((double) timer.getElapsedTime() / BILLION) + " s."; }
public static long getElapsedTimeMillis(String name) { NanoTimerElement timer = users.get(name); if (timer == null) return -1; timer.refresh(); return timer.getElapsedTime(); }