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