2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * ident "%Z%%M% %I% %E% SMI" 2N/A * A linear frequency distribution aggregated by the DTrace {@code 2N/A * lquantize()} action. Aggregated values fall into consecutive ranges 2N/A * bounded by the step parameter of the {@code lquantize()} action. 2N/A * Each range, known as a bucket, begins at the {@code lquantize()} 2N/A * lower bound, or base, plus a multiple of the {@code lquantize()} 2N/A * step, unless it is the first bucket, which is the frequency of all 2N/A * aggregated values less than the base. The last bucket counts all 2N/A * aggregated values greater than or equal to the {@code lquantize()} 2N/A * upper bound. For example 2N/A * <pre> {@code @ = lquantize(n, 0, 100, 10);}</pre> 2N/A * results in a distribution with a base of 0, an upper bound of 100, 2N/A * and a step of 10. It has twelve buckets starting with {@code n < 0} 2N/A * and ending with {@code n >= 100}. The buckets in between are {@code 2N/A * 0 .. 9}, {@code 10 .. 19}, etc. 2N/A * @see LogDistribution 2N/A * @author Tom Erickson 2N/A * Called by native C code 2N/A // initializes using lowerBound and frequencyStep 2N/A * Creates a linear distribution with the given base, step, and 2N/A * frequencies. Supports XML persistence. 2N/A * @param lowerBound also known as the <i>base</i>; the minimum of 2N/A * the second bucket in this distribution (the first bucket contains 2N/A * the frequency of everything lower than the base) 2N/A * @param bucketStep the distance between the lower bound of one 2N/A * bucket and the lower bound of the next consecutive bucket 2N/A * (excluding the first bucket) 2N/A * @param frequencies list of frequencies in each bucket range 2N/A * @throws NullPointerException if {@code frequencies} is {@code 2N/A * @throws IllegalArgumentException if the given step is less than 2N/A * one, or if any bucket does not have the expected range 2N/A * (consecutive steps) 2N/A * Gets a two element array: the first elelemt is the range minimum 2N/A * (inclusive), the second element is the range maximum (inclusive). 2N/A // first bucket is everything less than the base 2N/A // last bucket is everything greater than or equal to 2N/A * Gets the lower bound of this distribution. In a linear 2N/A * distribution, the first bucket holds the frequency of all values 2N/A * less than the base, so the base is the minimum of the second 2N/A * @return the lower bound of this distribution 2N/A * Gets the difference between the lower bounds of consecutive 2N/A * buckets after the first. 2N/A * @return the step between the lower bounds of consecutive buckets 2N/A for (
int i =
1; i < (
len -
1); ++i) {
2N/A // There doesn't seem to be any reason to add one to the 2N/A // minimum of the last bucket range, but that's how it's 2N/A // implemented in libdtrace dt_aggregate.c. 2N/A * Compares the {@code double} values of {@link #getValue()} for 2N/A * overall magnitude, and if those are equal, compares the 2N/A * frequencies at zero if the distributions include a bucket whose 2N/A * range has a minimum of zero. 2N/A * Gets a string representation of this linear distribution useful 2N/A * for logging and not intended for display. The exact details of 2N/A * the representation are unspecified and subject to change, but the 2N/A * following format may be regarded as typical: 2N/A * class-name[property1 = value1, property2 = value2]