001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.metrics;
019
020import org.apache.yetus.audience.InterfaceAudience;
021
022/**
023 * A statictical sample of histogram values.
024 */
025@InterfaceAudience.Private
026public interface Snapshot {
027
028  /**
029   * Return the values with the given quantiles.
030   * @param quantiles the requested quantiles.
031   * @return the value for the quantiles.
032   */
033  long[] getQuantiles(double[] quantiles);
034
035  /**
036   * Return the values with the default quantiles.
037   * @return the value for default the quantiles.
038   */
039  long[] getQuantiles();
040
041  /**
042   * Returns the number of values in the snapshot.
043   * @return the number of values
044   */
045  long getCount();
046
047  /**
048   * Returns the total count below the given value
049   * @param val the value
050   * @return the total count below the given value
051   */
052  long getCountAtOrBelow(long val);
053
054  /**
055   * Returns the value at the 25th percentile in the distribution.
056   * @return the value at the 25th percentile
057   */
058  long get25thPercentile();
059
060  /**
061   * Returns the value at the 75th percentile in the distribution.
062   * @return the value at the 75th percentile
063   */
064  long get75thPercentile();
065
066  /**
067   * Returns the value at the 90th percentile in the distribution.
068   * @return the value at the 90th percentile
069   */
070  long get90thPercentile();
071
072  /**
073   * Returns the value at the 95th percentile in the distribution.
074   * @return the value at the 95th percentile
075   */
076  long get95thPercentile();
077
078  /**
079   * Returns the value at the 98th percentile in the distribution.
080   * @return the value at the 98th percentile
081   */
082  long get98thPercentile();
083
084  /**
085   * Returns the value at the 99th percentile in the distribution.
086   * @return the value at the 99th percentile
087   */
088  long get99thPercentile();
089
090  /**
091   * Returns the value at the 99.9th percentile in the distribution.
092   * @return the value at the 99.9th percentile
093   */
094  long get999thPercentile();
095
096  /**
097   * Returns the median value in the distribution.
098   * @return the median value
099   */
100  long getMedian();
101
102  /**
103   * Returns the highest value in the snapshot.
104   * @return the highest value
105   */
106  long getMax();
107
108  /**
109   * Returns the arithmetic mean of the values in the snapshot.
110   * @return the arithmetic mean
111   */
112  long getMean();
113
114  /**
115   * Returns the lowest value in the snapshot.
116   * @return the lowest value
117   */
118  long getMin();
119
120  // TODO: Dropwizard histograms also track stddev
121}