“度量”直方图中“偏差”的含义是什么

时间:2013-04-25 11:40:17

标签: java metrics

Codahale的“Metrics”收到的其中一个属性是“有偏见的” 有人能解释一下这是什么意思吗?

public Histogram newHistogram(Class<?> klass,
                     String name,
                     boolean biased)
Creates a new Histogram and registers it under the given class and name.
Parameters:
klass - the class which owns the metric
name - the name of the metric
biased - whether or not the histogram should be biased
Returns:
a new Histogram

1 个答案:

答案 0 :(得分:6)

如有疑问,请查看来源:

    /**
     * Uses an exponentially decaying sample of 1028 elements, which offers a 99.9% confidence
     * level with a 5% margin of error assuming a normal distribution, and an alpha factor of
     * 0.015, which heavily biases the sample to the past 5 minutes of measurements.
     */
    BIASED {
        @Override
        public Sample newSample() {
            return new ExponentiallyDecayingSample(DEFAULT_SAMPLE_SIZE, DEFAULT_ALPHA);
        }
    };

有偏见的直方图是对更近期的测量给予更多权重的直方图。