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 { ...@@ -46,8 +46,7 @@ public class OneMeasurementHdrHistogram extends OneMeasurement {
final PrintStream log; final PrintStream log;
final HistogramLogWriter histogramLogWriter; final HistogramLogWriter histogramLogWriter;
final Recorder histogram = new Recorder(3); final Recorder histogram;
Histogram totalHistogram; Histogram totalHistogram;
public OneMeasurementHdrHistogram(String name, Properties props) { public OneMeasurementHdrHistogram(String name, Properties props) {
...@@ -56,19 +55,22 @@ public class OneMeasurementHdrHistogram extends OneMeasurement { ...@@ -56,19 +55,22 @@ public class OneMeasurementHdrHistogram extends OneMeasurement {
if (!shouldLog) { if (!shouldLog) {
log = null; log = null;
histogramLogWriter = null; histogramLogWriter = null;
return; } else {
} try {
try { final String hdrOutputFilename = props.getProperty("hdrhistogram.output.path", "") + name + ".hdr";
final String hdrOutputFilename = props.getProperty("hdrhistogram.output.path", "") +name+".hdr"; log = new PrintStream(new FileOutputStream(hdrOutputFilename), false);
log = new PrintStream(new FileOutputStream(hdrOutputFilename), false); } catch (FileNotFoundException e) {
} catch (FileNotFoundException e) { throw new RuntimeException("Failed to open hdr histogram output file", 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); histogram = new Recorder(3);
histogramLogWriter.outputComment("[Logging for: " + name + "]");
histogramLogWriter.outputLogFormatVersion();
histogramLogWriter.outputStartTime(System.currentTimeMillis());
histogramLogWriter.outputLegend();
} }
/** /**
......
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