本文整理汇总了Java中org.HdrHistogram.EncodableHistogram类的典型用法代码示例。如果您正苦于以下问题:Java EncodableHistogram类的具体用法?Java EncodableHistogram怎么用?Java EncodableHistogram使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EncodableHistogram类属于org.HdrHistogram包,在下文中一共展示了EncodableHistogram类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIntervalHistogram
import org.HdrHistogram.EncodableHistogram; //导入依赖的package包/类
private EncodableHistogram getIntervalHistogram() {
EncodableHistogram histogram = null;
try {
histogram = logReader.nextIntervalHistogram(config.rangeStartTimeSec, config.rangeEndTimeSec);
} catch (RuntimeException ex) {
System.err.println("Log file parsing error at line number " + lineNumber +
": line appears to be malformed.");
if (config.verbose) {
throw ex;
} else {
exitWithError();
}
}
lineNumber++;
return histogram;
}
示例2: writeFrom
import org.HdrHistogram.EncodableHistogram; //导入依赖的package包/类
/**
* Save a summary of the analyzed rate data to a properties file named "rate.properties"
* @param histogramFile the directory where the saved file will be located
* @throws IOException if unable to save
*/
public static void writeFrom(final String histogramFile) throws IOException {
File in = new File(histogramFile);
logger.trace("Writing properties to {}/latency.properties", in.getPath());
Properties prop = new Properties();
HistogramLogReader histogramLogReader = new HistogramLogReader(in);
EncodableHistogram eh = histogramLogReader.nextIntervalHistogram();
prop.setProperty("latencyStartTS", Long.toString(eh.getStartTimeStamp()));
prop.setProperty("latencyEndTS", Long.toString(eh.getEndTimeStamp()));
prop.setProperty("latencyMaxValue", Double.toString(eh.getMaxValueAsDouble()));
if (eh instanceof AbstractHistogram) {
AbstractHistogram ah = (AbstractHistogram) eh;
prop.setProperty("latency50th", Long.toString(ah.getValueAtPercentile(50.0)));
prop.setProperty("latency90th", Long.toString(ah.getValueAtPercentile(90.0)));
prop.setProperty("latency95th", Long.toString(ah.getValueAtPercentile(95.0)));
prop.setProperty("latency99th", Long.toString(ah.getValueAtPercentile(99.0)));
prop.setProperty("latency999th", Long.toString(ah.getValueAtPercentile(99.9)));
prop.setProperty("latency9999th", Long.toString(ah.getValueAtPercentile(99.99)));
prop.setProperty("latencyStdDeviation", Double.toString(ah.getStdDeviation()));
prop.setProperty("latencyTotalCount", Long.toString(ah.getTotalCount()));
prop.setProperty("latencyMean", Double.toString(ah.getMean()));
}
else {
if (eh instanceof DoubleHistogram) {
DoubleHistogram dh = (DoubleHistogram) eh;
prop.setProperty("latency50th", Double.toString(dh.getValueAtPercentile(50.0)));
prop.setProperty("latency90th", Double.toString(dh.getValueAtPercentile(90.0)));
prop.setProperty("latency95th", Double.toString(dh.getValueAtPercentile(95.0)));
prop.setProperty("latency99th", Double.toString(dh.getValueAtPercentile(99.0)));
prop.setProperty("latency999th", Double.toString(dh.getValueAtPercentile(99.9)));
prop.setProperty("latency9999th", Double.toString(dh.getValueAtPercentile(99.99)));
prop.setProperty("latencyStdDeviation", Double.toString(dh.getStdDeviation()));
prop.setProperty("latencyTotalCount", Long.toString(dh.getTotalCount()));
prop.setProperty("latencyMean", Double.toString(dh.getMean()));
}
}
try (FileOutputStream fos = new FileOutputStream(new File(in.getParentFile(), "latency.properties"))) {
prop.store(fos, "hdr-histogram-plotter");
}
}