Class Histogram.ConstantBinScheme
- java.lang.Object
-
- org.apache.kafka.common.metrics.stats.Histogram.ConstantBinScheme
-
- All Implemented Interfaces:
Histogram.BinScheme
- Enclosing class:
- Histogram
public static class Histogram.ConstantBinScheme extends Object implements Histogram.BinScheme
A scheme for calculating the bins where the width of each bin is a constant determined by the range of values and the number of bins.
-
-
Constructor Summary
Constructors Constructor Description ConstantBinScheme(int bins, double min, double max)
Create a bin scheme with the specified number of bins that all have the same width.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
bins()
Get the number of bins.double
fromBin(int b)
Determine the value at the upper range of the specified bin.int
toBin(double x)
Determine the 0-based bin number in which the supplied value should be placed.
-
-
-
Constructor Detail
-
ConstantBinScheme
public ConstantBinScheme(int bins, double min, double max)
Create a bin scheme with the specified number of bins that all have the same width.- Parameters:
bins
- the number of bins; must be at least 2min
- the minimum value to be counted in the binsmax
- the maximum value to be counted in the bins
-
-
Method Detail
-
bins
public int bins()
Description copied from interface:Histogram.BinScheme
Get the number of bins.- Specified by:
bins
in interfaceHistogram.BinScheme
- Returns:
- the number of bins
-
fromBin
public double fromBin(int b)
Description copied from interface:Histogram.BinScheme
Determine the value at the upper range of the specified bin.- Specified by:
fromBin
in interfaceHistogram.BinScheme
- Parameters:
b
- the 0-based bin number- Returns:
- the value at the upper end of the bin; or
negative infinity
if the bin number is negative orpositive infinity
if the 0-based bin number is greater than or equal to thenumber of bins
.
-
toBin
public int toBin(double x)
Description copied from interface:Histogram.BinScheme
Determine the 0-based bin number in which the supplied value should be placed.- Specified by:
toBin
in interfaceHistogram.BinScheme
- Parameters:
x
- the value- Returns:
- the 0-based index of the bin
-
-