本文整理汇总了Java中org.apache.hadoop.metrics2.util.SampleQuantiles类的典型用法代码示例。如果您正苦于以下问题:Java SampleQuantiles类的具体用法?Java SampleQuantiles怎么用?Java SampleQuantiles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SampleQuantiles类属于org.apache.hadoop.metrics2.util包,在下文中一共展示了SampleQuantiles类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MutableQuantiles
import org.apache.hadoop.metrics2.util.SampleQuantiles; //导入依赖的package包/类
/**
* Instantiates a new {@link MutableQuantiles} for a metric that rolls itself
* over on the specified time interval.
*
* @param name
* of the metric
* @param description
* long-form textual description of the metric
* @param sampleName
* type of items in the stream (e.g., "Ops")
* @param valueName
* type of the values
* @param interval
* rollover interval (in seconds) of the estimator
*/
public MutableQuantiles(String name, String description, String sampleName,
String valueName, int interval) {
String ucName = StringUtils.capitalize(name);
String usName = StringUtils.capitalize(sampleName);
String uvName = StringUtils.capitalize(valueName);
String desc = StringUtils.uncapitalize(description);
String lsName = StringUtils.uncapitalize(sampleName);
String lvName = StringUtils.uncapitalize(valueName);
numInfo = info(ucName + "Num" + usName, String.format(
"Number of %s for %s with %ds interval", lsName, desc, interval));
// Construct the MetricsInfos for the quantiles, converting to percentiles
quantileInfos = new MetricsInfo[quantiles.length];
String nameTemplate = ucName + "%dthPercentile" + uvName;
String descTemplate = "%d percentile " + lvName + " with " + interval
+ " second interval for " + desc;
for (int i = 0; i < quantiles.length; i++) {
int percentile = (int) (100 * quantiles[i].quantile);
quantileInfos[i] = info(String.format(nameTemplate, percentile),
String.format(descTemplate, percentile));
}
estimator = new SampleQuantiles(quantiles);
this.interval = interval;
scheduler.scheduleAtFixedRate(new RolloverSample(this), interval, interval,
TimeUnit.SECONDS);
}