config = new HistogramLogProcessorConfiguration(args); if (config.inputFileName != null) { logReader = new HistogramLogReader(config.inputFileName); } else { logReader = new HistogramLogReader(System.in);
/** * Read the next interval histogram from the log. Returns a Histogram object if * an interval line was found, or null if not. * <p>Upon encountering any unexpected format errors in reading the next interval * from the input, this method will return a null. Use {@link #hasNext} to determine * whether or not additional intervals may be available for reading in the log input. * @return a DecodedInterval, or a null if no appropriately formatted interval was found */ public EncodableHistogram nextIntervalHistogram() { return nextIntervalHistogram(0.0, Long.MAX_VALUE * 1.0, true); }
HistogramLogReader reader = new HistogramLogReader(logFile); while (reader.hasNext()){ Histogram histogram = (Histogram)reader.nextIntervalHistogram(); String tag = histogram.getTag();
for (int k = 1; k < args.length; k++) { String inputFile = args[k]; readers[k - 1] = new HistogramLogReader(inputFile); Histogram merged = null; for (HistogramLogReader reader : readers) { Histogram histogram = (Histogram) reader.nextIntervalHistogram(); if (histogram == null) { continue;
if ((firstStartTime == 0.0) && (logReader.getStartTimeSec() != 0.0)) { firstStartTime = logReader.getStartTimeSec(); ((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), } else { timeIntervalLog.format(Locale.US, logFormat, ((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), ((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), } else { movingWindowLog.format(Locale.US, movingWindowLogFormat, ((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()),
if ((firstStartTime == 0.0) && (logReader.getStartTimeSec() != 0.0)) { firstStartTime = logReader.getStartTimeSec();
return nextIntervalHistogram(absoluteStartTimeSec, absoluteEndTimeSec, true);
static HistogramLogReader createHistogramLogReader(File latencyFile, String testName) { try { return new HistogramLogReader(latencyFile); } catch (IOException e) { throw new CommandLineExitException("Could not initialize HistogramLogReader for test " + testName, e); } }
if ((firstStartTime == 0.0) && (logReader.getStartTimeSec() != 0.0)) { firstStartTime = logReader.getStartTimeSec(); ((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), } else { timeIntervalLog.format(Locale.US, logFormat, ((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), ((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), } else { movingWindowLog.format(Locale.US, movingWindowLogFormat, ((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()),
return nextIntervalHistogram(startTimeSec, endTimeSec, false);
/** * Construct a {@link org.HdrHistogram.HistogramLogProcessor} with the given arguments * (provided in command line style). * <pre> * [-h] help * [-csv] Use CSV format for output log files * [-i logFileName] File name of Histogram Log to process (default is standard input) * [-o outputFileName] File name to output to (default is standard output) * (will replace occurrences of %pid and %date with appropriate information) * [-start rangeStartTimeSec] The start time for the range in the file, in seconds (default 0.0) * [-end rangeEndTimeSec] The end time for the range in the file, in seconds (default is infinite) * [-outputValueUnitRatio r] The scaling factor by which to divide histogram recorded values units * in output. [default = 1000000.0 (1 msec in nsec)]" * </pre> * * @param args command line arguments * @throws FileNotFoundException if specified input file is not found */ public HistogramLogProcessor(final String[] args) throws FileNotFoundException { this.setName("HistogramLogProcessor"); config = new HistogramLogProcessorConfiguration(args); if (config.inputFileName != null) { logReader = new HistogramLogReader(config.inputFileName); } else { logReader = new HistogramLogReader(System.in); } }
protected Object[] buildRegularHistogramStatistics(Histogram intervalHistogram, Histogram accumulatedRegularHistogram) { return new Object[]{((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), // values recorded during the last reporting interval intervalHistogram.getTotalCount(), intervalHistogram.getValueAtPercentile(50.0) / config.outputValueUnitRatio, intervalHistogram.getValueAtPercentile(90.0) / config.outputValueUnitRatio, intervalHistogram.getMaxValue() / config.outputValueUnitRatio, // values recorded from the beginning until now accumulatedRegularHistogram.getTotalCount(), accumulatedRegularHistogram.getValueAtPercentile(50.0) / config.outputValueUnitRatio, accumulatedRegularHistogram.getValueAtPercentile(90.0) / config.outputValueUnitRatio, accumulatedRegularHistogram.getValueAtPercentile(99.0) / config.outputValueUnitRatio, accumulatedRegularHistogram.getValueAtPercentile(99.9) / config.outputValueUnitRatio, accumulatedRegularHistogram.getValueAtPercentile(99.99) / config.outputValueUnitRatio, accumulatedRegularHistogram.getMaxValue() / config.outputValueUnitRatio}; }
private EncodableHistogram getIntervalHistogram() { EncodableHistogram histogram = null; try { histogram = logReader.nextIntervalHistogram(config.rangeStartTimeSec, config.rangeEndTimeSec); if (config.expectedIntervalForCoordinatedOmissionCorrection > 0.0) { // Apply Coordinated Omission correction to log histograms when arguments indicate that // such correction is desired, and an expected interval is provided. histogram = copyCorrectedForCoordinatedOmission(histogram); } } 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 { System.exit(1); } } lineNumber++; return histogram; }
config = new HistogramLogProcessorConfiguration(args); if (config.inputFileName != null) { logReader = new HistogramLogReader(config.inputFileName); } else { logReader = new HistogramLogReader(System.in);
protected Object[] buildDoubleHistogramStatistics(DoubleHistogram doubleIntervalHistogram, DoubleHistogram accumulatedDoubleHistogram) { return new Object[]{((doubleIntervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), // values recorded during the last reporting interval doubleIntervalHistogram.getTotalCount(), doubleIntervalHistogram.getValueAtPercentile(50.0) / config.outputValueUnitRatio, doubleIntervalHistogram.getValueAtPercentile(90.0) / config.outputValueUnitRatio, doubleIntervalHistogram.getMaxValue() / config.outputValueUnitRatio, // values recorded from the beginning until now accumulatedDoubleHistogram.getTotalCount(), accumulatedDoubleHistogram.getValueAtPercentile(50.0) / config.outputValueUnitRatio, accumulatedDoubleHistogram.getValueAtPercentile(90.0) / config.outputValueUnitRatio, accumulatedDoubleHistogram.getValueAtPercentile(99.0) / config.outputValueUnitRatio, accumulatedDoubleHistogram.getValueAtPercentile(99.9) / config.outputValueUnitRatio, accumulatedDoubleHistogram.getValueAtPercentile(99.99) / config.outputValueUnitRatio, accumulatedDoubleHistogram.getMaxValue() / config.outputValueUnitRatio}; }
/** * Read the next interval histogram from the log. Returns a Histogram object if * an interval line was found, or null if not. * <p>Upon encountering any unexpected format errors in reading the next interval * from the input, this method will return a null. Use {@link #hasNext} to determine * whether or not additional intervals may be available for reading in the log input. * @return a DecodedInterval, or a null if no appropriately formatted interval was found */ public EncodableHistogram nextIntervalHistogram() { return nextIntervalHistogram(0.0, Long.MAX_VALUE * 1.0, true); }
((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), (intervalHistogram.getEndTimeStamp() / 1000.0),
return nextIntervalHistogram(startTimeSec, endTimeSec, false);
((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()), (intervalHistogram.getEndTimeStamp() / 1000.0),
return nextIntervalHistogram(absoluteStartTimeSec, absoluteEndTimeSec, true);