本文整理汇总了Java中com.yammer.metrics.stats.UniformSample类的典型用法代码示例。如果您正苦于以下问题:Java UniformSample类的具体用法?Java UniformSample怎么用?Java UniformSample使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UniformSample类属于com.yammer.metrics.stats包,在下文中一共展示了UniformSample类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MetricsHistogram
import com.yammer.metrics.stats.UniformSample; //导入依赖的package包/类
/**
* Constructor to create a new histogram metric
* @param nam the name to publish the metric under
* @param registry where the metrics object will be registered
* @param description the metric's description
* @param forwardBiased true if you want this histogram to give more
* weight to recent data,
* false if you want all data to have uniform weight
*/
public MetricsHistogram(final String nam, final MetricsRegistry registry,
final String description, boolean forwardBiased) {
super(nam, description);
this.min = new AtomicLong();
this.max = new AtomicLong();
this.sum = new AtomicLong();
this.sample = forwardBiased ?
new ExponentiallyDecayingSample(DEFAULT_SAMPLE_SIZE, DEFAULT_ALPHA)
: new UniformSample(DEFAULT_SAMPLE_SIZE);
this.variance = new AtomicReference<double[]>(new double[]{-1, 0});
this.count = new AtomicLong();
this.clear();
if (registry != null) {
registry.add(nam, this);
}
}
示例2: testSetup
import com.yammer.metrics.stats.UniformSample; //导入依赖的package包/类
void testSetup() throws IOException {
if (!opts.oneCon) {
this.connection = ConnectionFactory.createConnection(conf);
}
onStartup();
latency = YammerHistogramUtils.newHistogram(new UniformSample(1024 * 500));
valueSize = YammerHistogramUtils.newHistogram(new UniformSample(1024 * 500));
}
示例3: testSetup
import com.yammer.metrics.stats.UniformSample; //导入依赖的package包/类
void testSetup() throws IOException {
this.connection = HConnectionManager.createConnection(conf);
this.table = connection.getTable(opts.tableName);
this.table.setAutoFlush(opts.autoFlush, true);
try {
Constructor<?> ctor =
Histogram.class.getDeclaredConstructor(com.yammer.metrics.stats.Sample.class);
ctor.setAccessible(true);
latency = (Histogram) ctor.newInstance(new UniformSample(1024 * 500));
} catch (Exception e) {
throw new RuntimeException(e);
}
}