Skip to content
Snippets Groups Projects
Commit 918b155e authored by Sean Busbey's avatar Sean Busbey
Browse files

Merge pull request #381 from nitsanw/master

[core] Fix #380 by working around recorder/logger initialization timing.
parents 593c2625 ff562cee
No related branches found
No related tags found
No related merge requests found
......@@ -46,8 +46,7 @@ public class OneMeasurementHdrHistogram extends OneMeasurement {
final PrintStream log;
final HistogramLogWriter histogramLogWriter;
final Recorder histogram = new Recorder(3);
final Recorder histogram;
Histogram totalHistogram;
public OneMeasurementHdrHistogram(String name, Properties props) {
......@@ -56,19 +55,22 @@ public class OneMeasurementHdrHistogram extends OneMeasurement {
if (!shouldLog) {
log = null;
histogramLogWriter = null;
return;
}
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);
} 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();
}
histogramLogWriter = new HistogramLogWriter(log);
histogramLogWriter.outputComment("[Logging for: " + name + "]");
histogramLogWriter.outputLogFormatVersion();
histogramLogWriter.outputStartTime(System.currentTimeMillis());
histogramLogWriter.outputLegend();
histogram = new Recorder(3);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment