Code example for MapMaker

0
 * Profiler tool for timing calls to a given code fragment. 
 */ 
public final class Profiler { 
 
  private static final Logger s_logger = LoggerFactory.getLogger(Profiler.class);
  private static final Collection<Profiler> s_profilers = Sets.newSetFromMap(new MapMaker().weakKeys().<Profiler, Boolean>makeMap());
  private static volatile boolean s_enabled;
  private static volatile int s_reset;
 
  private final String _name;
  private final AtomicInteger _lock = new AtomicInteger();
  private final AtomicLong _time = new AtomicLong();
  private final AtomicInteger _operations = new AtomicInteger();
  private volatile boolean _snapshotPending;
  private double _snapshotTime;
  private int _snapshotOperations;
  private int _reset;
 
  private Profiler(final String name) {
    _name = name;
Contextual code suggestions in your IDE  Get Codota for Java