// Path: src/main/java/com/codahale/metrics/WeightedSnapshot.java
// public static class WeightedSample {
//     public final long value;
//     public final double weight;
// 
//     public WeightedSample(final long value, final double weight) {
//         this.value = value;
//         this.weight = weight;
//     }
// }


import static java.lang.Math.exp;
import static java.lang.Math.min;
import java.util.ArrayList;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import com.codahale.metrics.WeightedSnapshot.WeightedSample;
        this.count = new AtomicLong(0);
        this.startTime = currentTimeInSeconds();
        this.nextScaleTime = new AtomicLong(clock.getTick() + RESCALE_THRESHOLD);
    }

    @Override
    public int size() {
        return (int) min(size, count.get());
    }

    @Override
    public synchronized void update(final long value) {
        update(value, currentTimeInSeconds());
    }

    private final static Random random = new Random();

    /**
     * Adds an old value with a fixed timestamp to the reservoir.
     *
     * @param value
     *            the value to be added
     * @param timestamp
     *            the epoch timestamp of {@code value} in seconds
     */
    public void update(final long value, final long timestamp) {
        rescaleIfNeeded();
        lockForRegularUsage();
        try {
            final double itemWeight = weight(timestamp - startTime);
// Path: src/main/java/com/codahale/metrics/WeightedSnapshot.java
// public static class WeightedSample {
//     public final long value;
//     public final double weight;
// 
//     public WeightedSample(final long value, final double weight) {
//         this.value = value;
//         this.weight = weight;
//     }
// }


// Path: src/main/java/com/codahale/metrics/ExponentiallyDecayingReservoir.java
import static java.lang.Math.exp;
import static java.lang.Math.min;
import java.util.ArrayList;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import com.codahale.metrics.WeightedSnapshot.WeightedSample;

        this.count = new AtomicLong(0);
        this.startTime = currentTimeInSeconds();
        this.nextScaleTime = new AtomicLong(clock.getTick() + RESCALE_THRESHOLD);
    }

    @Override
    public int size() {
        return (int) min(size, count.get());
    }

    @Override
    public synchronized void update(final long value) {
        update(value, currentTimeInSeconds());
    }

    private final static Random random = new Random();

    /**
     * Adds an old value with a fixed timestamp to the reservoir.
     *
     * @param value
     *            the value to be added
     * @param timestamp
     *            the epoch timestamp of {@code value} in seconds
     */
    public void update(final long value, final long timestamp) {
        rescaleIfNeeded();
        lockForRegularUsage();
        try {
            final double itemWeight = weight(timestamp - startTime);
            final WeightedSample sample = new WeightedSample(value, itemWeight);