View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   * http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  
21  package org.apache.hadoop.hbase.metrics;
22  
23  import org.apache.hadoop.hbase.classification.InterfaceAudience;
24  
25  /**
26   * A statictical sample of histogram values.
27   */
28  @InterfaceAudience.Private
29  public interface Snapshot {
30  
31    /**
32     * Return the values with the given quantiles.
33     * @param quantiles the requested quantiles.
34     * @return the value for the quantiles.
35     */
36    long[] getQuantiles(double[] quantiles);
37  
38    /**
39     * Return the values with the default quantiles.
40     * @return the value for default the quantiles.
41     */
42    long[] getQuantiles();
43  
44    /**
45     * Returns the number of values in the snapshot.
46     *
47     * @return the number of values
48     */
49    long getCount();
50  
51    /**
52     * Returns the total count below the given value
53     * @param val the value
54     * @return the total count below the given value
55     */
56    long getCountAtOrBelow(long val);
57  
58    /**
59     * Returns the value at the 25th percentile in the distribution.
60     *
61     * @return the value at the 25th percentile
62     */
63    long get25thPercentile();
64  
65    /**
66     * Returns the value at the 75th percentile in the distribution.
67     *
68     * @return the value at the 75th percentile
69     */
70    long get75thPercentile();
71  
72    /**
73     * Returns the value at the 90th percentile in the distribution.
74     *
75     * @return the value at the 90th percentile
76     */
77    long get90thPercentile();
78  
79    /**
80     * Returns the value at the 95th percentile in the distribution.
81     *
82     * @return the value at the 95th percentile
83     */
84    long get95thPercentile();
85  
86    /**
87     * Returns the value at the 98th percentile in the distribution.
88     *
89     * @return the value at the 98th percentile
90     */
91    long get98thPercentile();
92  
93    /**
94     * Returns the value at the 99th percentile in the distribution.
95     *
96     * @return the value at the 99th percentile
97     */
98    long get99thPercentile();
99  
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 }