/** * Output a log format version to the log. */ public void outputLogFormatVersion() { outputComment("[Histogram log format version " + HISTOGRAM_LOG_FORMAT_VERSION +"]"); }
public OneMeasurementHdrHistogram(String name, Properties props) { super(name); percentiles = getPercentileValues(props.getProperty(PERCENTILES_PROPERTY, PERCENTILES_PROPERTY_DEFAULT)); verbose = Boolean.valueOf(props.getProperty(VERBOSE_PROPERTY, String.valueOf(false))); boolean shouldLog = Boolean.parseBoolean(props.getProperty("hdrhistogram.fileoutput", "false")); if (!shouldLog) { log = null; histogramLogWriter = null; } else { try { final String hdrOutputFilename = props.getProperty("hdrhistogram.output.path", "") + name + ".hdr"; log = new PrintStream(new FileOutputStream(hdrOutputFilename), false); } catch (FileNotFoundException e) { throw new RuntimeException("Failed to open hdr histogram output file", e); } histogramLogWriter = new HistogramLogWriter(log); histogramLogWriter.outputComment("[Logging for: " + name + "]"); histogramLogWriter.outputLogFormatVersion(); long now = System.currentTimeMillis(); histogramLogWriter.outputStartTime(now); histogramLogWriter.setBaseTime(now); histogramLogWriter.outputLegend(); } histogram = new Recorder(3); }
/** * Output a log format version to the log. */ public void outputLogFormatVersion() { outputComment("[Histogram log format version " + HISTOGRAM_LOG_FORMAT_VERSION +"]"); }
/** * By convention, it is typical for the logging application * to use a comment to indicate the logging application at the head * of the log, followed by the log format version, a startLogging time, * and a legend (in that order). */ public void startLogging() { try { logStream = new PrintStream(logfile); writer = new HistogramLogWriter(logStream); writer.outputComment("logging histograms for session " + sessionName); writer.outputLogFormatVersion(); long currentTimeMillis = System.currentTimeMillis(); writer.outputStartTime(currentTimeMillis); writer.setBaseTime(currentTimeMillis); writer.outputLegend(); } catch (FileNotFoundException e) { throw new RuntimeException("Error while starting histogram log writer", e); } this.executor = new PeriodicRunnable<HistoIntervalLogger>(this.getInterval(),this); executor.startDaemonThread(); }
static HistogramLogWriter createHistogramLogWriter(String testId, String probeName, long baseTime) { try { File latencyFile = getLatencyFile(testId, probeName); HistogramLogWriter histogramLogWriter = new HistogramLogWriter(latencyFile); histogramLogWriter.setBaseTime(baseTime); histogramLogWriter.outputStartTime(System.currentTimeMillis()); histogramLogWriter.outputComment("[Latency histograms for " + testId + '.' + probeName + ']'); histogramLogWriter.outputLogFormatVersion(); histogramLogWriter.outputLegend(); return histogramLogWriter; } catch (IOException e) { throw new TestException("Could not initialize HistogramLogWriter for test " + testId, e); } }
writer.outputComment("[Latency histograms for " + getBaseName(outputFile) + ']'); writer.outputLogFormatVersion(); writer.outputLegend();