public Snapshot snapshotAndReset() {
    final Bins oldBins = this.bins;
    this.bins = new Bins(this.bins, this.bins.counts.length - 3, 0.01, 0.99);
    final long[] percentiles = oldBins.getQuantiles(DEFAULT_QUANTILES);
    final long count = oldBins.count.sum();

    return new Snapshot() {
      @Override
      public long[] getQuantiles(double[] quantiles) {
        return oldBins.getQuantiles(quantiles);
      }

      @Override
      public long[] getQuantiles() {
        return percentiles;
      }

      @Override
      public long getCount() {
        return count;
      }

      @Override
      public long getCountAtOrBelow(long val) {
        return oldBins.getNumAtOrBelow(val);
      }

      @Override
      public long get25thPercentile() {
        return percentiles[0];
      }

      @Override
      public long get75thPercentile() {
        return percentiles[2];
      }

      @Override
      public long get90thPercentile() {
        return percentiles[3];
      }

      @Override
      public long get95thPercentile() {
        return percentiles[4];
      }

      @Override
      public long get98thPercentile() {
        return percentiles[5];
      }

      @Override
      public long get99thPercentile() {
        return percentiles[6];
      }

      @Override
      public long get999thPercentile() {
        return percentiles[7];
      }

      @Override
      public long getMedian() {
        return percentiles[1];
      }

      @Override
      public long getMax() {
        return oldBins.max.get();
      }

      @Override
      public long getMean() {
        return oldBins.getMean();
      }

      @Override
      public long getMin() {
        return oldBins.getMin();
      }
    };
  }
Resets the histogram for new counting.
hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/FastLongHistogram.java