blueflood-core/src/main/java/com/rackspacecloud/blueflood/rollup/Granularity.java
public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis, Clock ttlComparisonClock) {
        if (from >= to) {
            throw new RuntimeException("Invalid interval specified for fromPointsInInterval");
        }

        double requestedDuration = to - from;

        if (algorithm.startsWith("GEOMETRIC"))
            return granularityFromPointsGeometric(tenantid, from, to, requestedDuration, points, assumedIntervalMillis, ttlComparisonClock);
        else if (algorithm.startsWith("LINEAR"))
            return granularityFromPointsLinear(requestedDuration, points, assumedIntervalMillis);
        else if (algorithm.startsWith("LESSTHANEQUAL"))
            return granularityFromPointsLessThanEqual(requestedDuration, points, assumedIntervalMillis);

        return granularityFromPointsGeometric(tenantid, from, to, requestedDuration, points, assumedIntervalMillis, ttlComparisonClock);
    }
public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis, Clock ttlComparisonClock) {
        if (from >= to) {
            throw new RuntimeException("Invalid interval specified for fromPointsInInterval");
        }

        double requestedDuration = to - from;

        if (algorithm.startsWith("GEOMETRIC"))
            return granularityFromPointsGeometric(tenantid, from, to, requestedDuration, points, assumedIntervalMillis, ttlComparisonClock);
        else if (algorithm.startsWith("LINEAR"))
            return granularityFromPointsLinear(requestedDuration, points, assumedIntervalMillis);
        else if (algorithm.startsWith("LESSTHANEQUAL"))
            return granularityFromPointsLessThanEqual(requestedDuration, points, assumedIntervalMillis);

        return granularityFromPointsGeometric(tenantid, from, to, requestedDuration, points, assumedIntervalMillis, ttlComparisonClock);
    }
Return granularity that maps most closely to requested number of points based on
provided selection algorithm

@param from beginning of interval (millis)
@param to end of interval (millis)
@param points count of desired data points
@param algorithm the algorithm to use. Valid values are
{@code "GEOMETRIC"}, {@code "LINEAR"}, and
{@code "LESSTHANEQUAL"}. Any other value is treated as
{@code "GEOMETRIC"}.
@param assumedIntervalMillis FULL resolution is tricky because we don't
know the period of check in question.
Assume the minimum period and go from there.
NOTE: This value and description was from a
previous version of the software, and the
original author is no longer available to
clarify. The exact purpose of this
parameter is not yet fully understood.
@param ttlComparisonClock The GEOMETRIC algorithm checks the specified
interval against a TTL. Normally, the TTL is
measured relative to the current point in
time. For testing purposes, an alternate time
source can be provided, to measure the TTL
relative to a different point in time.
@return