org.perf4j
Class LogParser

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

public class LogParser
extends Object

LogParser provides the main method for reading a log of StopWatch output and generating statistics and graphs from that output. Run "java -jar pathToPerf4jJar --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(Reader inputLog, PrintStream statisticsOutput, PrintStream graphingOutput, long timeSlice, boolean createRollupStatistics, GroupedTimingStatisticsFormatter statisticsFormatter)
          Creates a new LogParser to parse log data from the input.
 
Method Summary
protected static void closeGraphingOutput(PrintStream graphingOutput)
           
protected static int getIndexOfArg(List<String> args, boolean needsParam, String... argNames)
           
protected static boolean getRollupStatistics(List<String> argsList)
           
protected static GroupedTimingStatisticsFormatter getStatisticsFormatter(List<String> argsList)
           
protected static long getTimeSlice(List<String> argsList)
           
static void main(String[] args)
           
protected  StatisticsChartGenerator newMeanTimeChartGenerator()
           
protected  StatisticsChartGenerator newTpsChartGenerator()
           
protected static PrintStream openGraphingOutput(List<String> argsList)
           
protected static Reader openInput(List<String> argsList)
           
protected static PrintStream openStatisticsOutput(List<String> argsList)
           
protected static PrintStream openStream(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(List<String> argsList)
           
protected static boolean printUsage(List<String> argsList)
           
static int runMain(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(Reader inputLog,
                 PrintStream statisticsOutput,
                 PrintStream graphingOutput,
                 long timeSlice,
                 boolean createRollupStatistics,
                 GroupedTimingStatisticsFormatter statisticsFormatter)
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.
statisticsFormatter - The formatter to use to print GroupedTimingStatistics
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(String[] args)

runMain

public static int runMain(String[] args)

printUsage

protected static boolean printUsage(List<String> argsList)

openStatisticsOutput

protected static PrintStream openStatisticsOutput(List<String> argsList)
                                           throws IOException
Throws:
IOException

openGraphingOutput

protected static PrintStream openGraphingOutput(List<String> argsList)
                                         throws IOException
Throws:
IOException

closeGraphingOutput

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

getTimeSlice

protected static long getTimeSlice(List<String> argsList)

getRollupStatistics

protected static boolean getRollupStatistics(List<String> argsList)

getStatisticsFormatter

protected static GroupedTimingStatisticsFormatter getStatisticsFormatter(List<String> argsList)

openInput

protected static Reader openInput(List<String> argsList)
                           throws IOException
Throws:
IOException

printUnknownArgs

protected static void printUnknownArgs(List<String> argsList)

getIndexOfArg

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

openStream

protected static PrintStream openStream(String fileName)
                                 throws IOException
Throws:
IOException


Copyright © 2008-2011 perf4j.org. All Rights Reserved.