當前位置: 首頁>>代碼示例>>Java>>正文


Java EncodableHistogram類代碼示例

本文整理匯總了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;
}
 
開發者ID:hazelcast,項目名稱:hazelcast-simulator,代碼行數:17,代碼來源:HistogramLogProcessor.java

示例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");
    }
}
 
開發者ID:orpiske,項目名稱:hdr-histogram-plotter,代碼行數:56,代碼來源:HdrPropertyWriter.java


注:本文中的org.HdrHistogram.EncodableHistogram類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。