Class HistogramLogProcessor
- java.lang.Object
-
- java.lang.Thread
-
- org.HdrHistogram.HistogramLogProcessor
-
- All Implemented Interfaces:
java.lang.Runnable
public class HistogramLogProcessor extends java.lang.Thread
HistogramLogProcessor
will process an input log and [can] generate two separate log files from a single histogram log file: a sequential interval log file and a histogram percentile distribution log file.The sequential interval log file logs a single stats summary line for each reporting interval.
The histogram percentile distribution log file includes a detailed percentiles and fine grained distribution of the entire log file range processed.
HistogramLogProcessor will process an input log file when provided with the
-i <filename>
option. When no -i option is provided, standard input will be processed.When provided with an output file name
<logfile>
with the -o option (e.g. "-o mylog"), HistogramLogProcessor will produce both output files under the names<logfile>
and<logfile>.hgrm
(e.g. mylog and mylog.hgrm).When not provided with an output file name, HistogramLogProcessor will produce [only] the histogram percentile distribution log output to standard output.
By default, HistogramLogProcessor only processes hlog file lines lines with no tag specified [aka "default tagged" lines]. An optional -tag parameter can be used to process lines of a [single] specific tag. The -listtags option can be used to list all the tags found in the input file.
HistogramLogProcessor accepts optional -start and -end time range parameters. When provided, the output will only reflect the portion of the input log with timestamps that fall within the provided start and end time range parameters.
HistogramLogProcessor also accepts and optional -csv parameter, which will cause the output formatting (of both output file forms) to use a CSV file format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
HistogramLogProcessor.HistogramLogProcessorConfiguration
-
Field Summary
Fields Modifier and Type Field Description private HistogramLogProcessor.HistogramLogProcessorConfiguration
config
private int
lineNumber
private HistogramLogReader
logReader
(package private) static java.lang.String
versionString
-
Constructor Summary
Constructors Constructor Description HistogramLogProcessor(java.lang.String[] args)
Construct aHistogramLogProcessor
with the given arguments (provided in command line style).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) EncodableHistogram
copyCorrectedForCoordinatedOmission(EncodableHistogram inputHistogram)
private EncodableHistogram
getIntervalHistogram()
private EncodableHistogram
getIntervalHistogram(java.lang.String tag)
static void
main(java.lang.String[] args)
main() method.private void
outputStartTime(java.io.PrintStream log, java.lang.Double startTime)
private void
outputTimeRange(java.io.PrintStream log, java.lang.String title)
void
run()
Run the log processor with the currently provided arguments.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
versionString
static final java.lang.String versionString
- See Also:
- Constant Field Values
-
config
private final HistogramLogProcessor.HistogramLogProcessorConfiguration config
-
logReader
private HistogramLogReader logReader
-
lineNumber
private int lineNumber
-
-
Constructor Detail
-
HistogramLogProcessor
public HistogramLogProcessor(java.lang.String[] args) throws java.io.FileNotFoundException
Construct aHistogramLogProcessor
with the given arguments (provided in command line style).[-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) [-tag tag] The tag (default no tag) of the histogram lines to be processed\n [-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) [-correctLogWithKnownCoordinatedOmission expectedInterval] When the supplied expected interval i is than 0, performs coordinated omission corection on the input log's interval histograms by adding missing values as appropriate based on the supplied expected interval value i (in wahtever units the log histograms were recorded with). This feature should only be used when the input log is known to have been recorded with coordinated ommisions, and when an expected interval is known. [-outputValueUnitRatio r] The scaling factor by which to divide histogram recorded values units in output. [default = 1000000.0 (1 msec in nsec)]"
- Parameters:
args
- command line arguments- Throws:
java.io.FileNotFoundException
- if specified input file is not found
-
-
Method Detail
-
outputTimeRange
private void outputTimeRange(java.io.PrintStream log, java.lang.String title)
-
outputStartTime
private void outputStartTime(java.io.PrintStream log, java.lang.Double startTime)
-
copyCorrectedForCoordinatedOmission
EncodableHistogram copyCorrectedForCoordinatedOmission(EncodableHistogram inputHistogram)
-
getIntervalHistogram
private EncodableHistogram getIntervalHistogram()
-
getIntervalHistogram
private EncodableHistogram getIntervalHistogram(java.lang.String tag)
-
run
public void run()
Run the log processor with the currently provided arguments.- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
main
public static void main(java.lang.String[] args)
main() method.- Parameters:
args
- command line arguments
-
-