org.perf4j
Class LogParser

java.lang.Object
  extended by org.perf4j.LogParser

public class LogParser
extends java.lang.Object

LogParser provides the main method for reading a log of StopWatch output and generating statistics and graphs from that output. Run "java -cp pathToPerf4jJar org.per4j.LogParser --help" for instructions.

Author:
Alex Devine

Constructor Summary
LogParser()
          Default constructor reads input from standard in, writes statistics output to standard out, does not write graph output, has a time slice window of 30 seconds, and does not create rollup statistics.
LogParser(java.io.Reader inputLog, java.io.PrintStream statisticsOutput, java.io.PrintStream graphingOutput, long timeSlice, boolean createRollupStatistics)
          Creates a new LogParser to parse log data from the input.
 
Method Summary
protected static void closeGraphingOutput(java.io.PrintStream graphingOutput)
           
protected static int getIndexOfArg(java.util.List<java.lang.String> args, boolean needsParam, java.lang.String... argNames)
           
protected static boolean getRollupStatistics(java.util.List<java.lang.String> argsList)
           
protected static long getTimeSlice(java.util.List<java.lang.String> argsList)
           
static void main(java.lang.String[] args)
           
protected  StatisticsChartGenerator newMeanTimeChartGenerator()
           
protected  StatisticsChartGenerator newTpsChartGenerator()
           
protected static java.io.PrintStream openGraphingOutput(java.util.List<java.lang.String> argsList)
           
protected static java.io.Reader openInput(java.util.List<java.lang.String> argsList)
           
protected static java.io.PrintStream openStatisticsOutput(java.util.List<java.lang.String> argsList)
           
protected static java.io.PrintStream openStream(java.lang.String fileName)
           
 void parseLog()
          Reads all the data from the inputLog, parses it, and writes the statistics data and graphing data as desired to the output streams.
protected  void printGraphOutput()
           
protected static void printUnknownArgs(java.util.List<java.lang.String> argsList)
           
protected static boolean printUsage(java.util.List<java.lang.String> argsList)
           
static int runMain(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogParser

public LogParser()
Default constructor reads input from standard in, writes statistics output to standard out, does not write graph output, has a time slice window of 30 seconds, and does not create rollup statistics.


LogParser

public LogParser(java.io.Reader inputLog,
                 java.io.PrintStream statisticsOutput,
                 java.io.PrintStream graphingOutput,
                 long timeSlice,
                 boolean createRollupStatistics)
Creates a new LogParser to parse log data from the input.

Parameters:
inputLog - The log being parsed, which should contain StopWatch log messages.
statisticsOutput - The stream where calculated statistics information should be written - if null, statistics data is not written.
graphingOutput - The stream where graphing data should be written - if null, graphs are not written.
timeSlice - The length of time, in milliseconds, of the timeslice of each statistics data created.
createRollupStatistics - Whether or not "rollup statistics" should be created for each timeslice of data.
Method Detail

parseLog

public void parseLog()
Reads all the data from the inputLog, parses it, and writes the statistics data and graphing data as desired to the output streams.


newMeanTimeChartGenerator

protected StatisticsChartGenerator newMeanTimeChartGenerator()

newTpsChartGenerator

protected StatisticsChartGenerator newTpsChartGenerator()

printGraphOutput

protected void printGraphOutput()

main

public static void main(java.lang.String[] args)

runMain

public static int runMain(java.lang.String[] args)

printUsage

protected static boolean printUsage(java.util.List<java.lang.String> argsList)

openStatisticsOutput

protected static java.io.PrintStream openStatisticsOutput(java.util.List<java.lang.String> argsList)
                                                   throws java.io.IOException
Throws:
java.io.IOException

openGraphingOutput

protected static java.io.PrintStream openGraphingOutput(java.util.List<java.lang.String> argsList)
                                                 throws java.io.IOException
Throws:
java.io.IOException

closeGraphingOutput

protected static void closeGraphingOutput(java.io.PrintStream graphingOutput)
                                   throws java.io.IOException
Throws:
java.io.IOException

getTimeSlice

protected static long getTimeSlice(java.util.List<java.lang.String> argsList)

getRollupStatistics

protected static boolean getRollupStatistics(java.util.List<java.lang.String> argsList)

openInput

protected static java.io.Reader openInput(java.util.List<java.lang.String> argsList)
                                   throws java.io.IOException
Throws:
java.io.IOException

printUnknownArgs

protected static void printUnknownArgs(java.util.List<java.lang.String> argsList)

getIndexOfArg

protected static int getIndexOfArg(java.util.List<java.lang.String> args,
                                   boolean needsParam,
                                   java.lang.String... argNames)

openStream

protected static java.io.PrintStream openStream(java.lang.String fileName)
                                         throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2008 perf4j.org. All Rights Reserved.