Skip to content
Permalink
Browse files
GEODE-6299: Create hgrm files from hlog (#48)
        * Create hgrm files from hlog file created by hdrhistogram.
	* This new file is human readable and can be used by plotters to create graphs.
  • Loading branch information
nabarunnag committed Jan 18, 2019
1 parent d75e1f3 commit 5bd36daa1efd32488fb25c71675fbe73e57e4232
Showing 1 changed file with 10 additions and 0 deletions.
@@ -20,15 +20,20 @@
import java.util.function.Consumer;

import org.HdrHistogram.Histogram;
import org.HdrHistogram.HistogramLogProcessor;
import org.HdrHistogram.HistogramLogWriter;

public class HdrHistogramWriter implements Consumer<Histogram> {

public static final String FILE_NAME = "latency.hlog";
public static final String FILE_NAME_HDR = "latency_hdr";

private final File outputFile;
private final File outputHDRFile;

public HdrHistogramWriter(File outputDir) {
this.outputFile = new File(outputDir, FILE_NAME);
this.outputHDRFile = new File(outputDir, FILE_NAME_HDR);
}

@Override
@@ -38,9 +43,14 @@ public void accept(Histogram histogram) {
HistogramLogWriter writer = new HistogramLogWriter(outputFile);
try {
writer.outputIntervalHistogram(histogram);
writer.outputIntervalHistogram(histogram);
} finally {
writer.close();
}
HistogramLogProcessor histogramLogProcessor =
new HistogramLogProcessor(new String[] {"-i", outputFile.getAbsolutePath(), "-o",
outputHDRFile.getAbsolutePath()});
histogramLogProcessor.run();
} catch (FileNotFoundException e) {
throw new UncheckedIOException(e);
}

0 comments on commit 5bd36da

Please sign in to comment.