@Test public void testCheckPointNull() throws Throwable { Profiler profiler = new Profiler(); profiler.checkPoint(null); assertEquals(1, profiler.events.size(), "profiler.events.size()"); }
@SuppressWarnings("unchecked") public synchronized void checkPoint (String detail) { long now = System.nanoTime(); Entry e = new Entry(); e.setDurationInNanos(now - partial); e.setTotalDurationInNanos(now - start); if (events.containsKey(detail)) { for (int i=1; ;i++) { String d = detail + "-" + i; if (!events.containsKey (d)) { detail = d; break; } } } e.setEventName(detail); events.put (detail, e); partial = now; }
Profiler implements Loggeable { @SuppressWarnings("unchecked") public synchronized void checkPoint (String detail) { long now = System.nanoTime(); Entry e = new Entry(); e.setDurationInNanos(now - partial); e.setTotalDurationInNanos(now - start); if (events.containsKey(detail)) { for (int i=1; ;i++) { String d = detail + "-" + i; if (!events.containsKey (d)) { detail = d; break; } } } e.setEventName(detail); events.put (detail, e); partial = now; } }
Profiler implements Loggeable { @SuppressWarnings("unchecked") public synchronized void checkPoint (String detail) { long now = System.nanoTime(); Entry e = new Entry(); e.setDurationInNanos(now - partial); e.setTotalDurationInNanos(now - start); if (events.containsKey(detail)) { for (int i=1; ;i++) { String d = detail + "-" + i; if (!events.containsKey (d)) { detail = d; break; } } } e.setEventName(detail); events.put (detail, e); partial = now; } Profiler(); }
Profiler implements Loggeable { @SuppressWarnings("unchecked") public synchronized void checkPoint (String detail) { long now = System.nanoTime(); Entry e = new Entry(); e.setDurationInNanos(now - partial); e.setTotalDurationInNanos(now - start); if (events.containsKey(detail)) { for (int i=1; ;i++) { String d = detail + "-" + i; if (!events.containsKey (d)) { detail = d; break; } } } e.setEventName(detail); events.put (detail, e); partial = now; } Profiler(); void reset(); @SuppressWarnings("unchecked") synchronized void checkPoint(String detail); long getElapsed(); long getElapsedInMillis(); long getPartial(); long getPartialInMillis(); void dump(PrintStream p, String indent); LinkedHashMap<String, Entry> getEvents(); Entry getEntry(String eventName); void reenable(); }
Profiler implements Loggeable { @SuppressWarnings("unchecked") public synchronized void checkPoint (String detail) { long now = System.nanoTime(); Entry e = new Entry(); e.setDurationInNanos(now - partial); e.setTotalDurationInNanos(now - start); if (events.containsKey(detail)) { for (int i=1; ;i++) { String d = detail + "-" + i; if (!events.containsKey (d)) { detail = d; break; } } } e.setEventName(detail); events.put (detail, e); partial = now; } Profiler(); void reset(); @SuppressWarnings("unchecked") synchronized void checkPoint(String detail); long getElapsed(); long getElapsedInMillis(); long getPartial(); long getPartialInMillis(); void dump(PrintStream p, String indent); LinkedHashMap<String, Entry> getEvents(); Entry getEntry(String eventName); void reenable(); static final int TO_MILLIS; }