com.ibm.dtfj.analyzer.base
Class DumpAnalyzer

java.lang.Object
  extended by MessageLogger
      extended by com.ibm.dtfj.analyzer.base.DumpAnalyzer
All Implemented Interfaces:
IProgress

public class DumpAnalyzer
extends MessageLogger
implements IProgress

The primary class defining the DumpAnalyzer. This provides a mainline for command line invocation as well as an interface for ISA to invoke.


Constructor Summary
DumpAnalyzer(java.lang.String fname, RuntimeParameters parms)
          Build an analyzer to examine the named dump.
DumpAnalyzer(java.lang.String fname, java.lang.String[] analyzers)
          Build an analyzer to examine the named dump.
DumpAnalyzer(java.lang.String fname, java.lang.String[] analyzers, RuntimeParameters parms)
          Build an analyzer to examine the named dump.
 
Method Summary
 boolean analysisRequired()
           
static java.lang.String analyze(java.lang.String fname, java.lang.String opts, java.lang.String scriptDir)
          Provide an interface to ISA in order to analyse the dump given on the constructor.
 void analyzeFile()
          Analyze the file for which this analyzer was built
static long estimateAnalysisMillisecs(java.lang.String fname)
          Provide an interface to ISA in order to guess the time that the analysis of a dump will take.
 java.lang.String generateHTMLErrors()
          Get a string with the errors in html form (separated by
tags)
 java.lang.ClassLoader getClassLoader()
          Get the ClassLoader used for finding analyzers.
 java.util.logging.Logger getLogger()
           
static void main(java.lang.String[] args)
          This mainline can be used to drive analysis of a specific dump using a specific set of analyzers or scripts.
 void notifyAnalysisComplete(IAnalyzerBase analyzer, IAnalyzerContext context, java.lang.String type)
          (non-Javadoc)
 void notifyAnalysisPhase(IAnalyzerBase analyzer, IAnalyzerContext context, int phase, int target)
          (non-Javadoc)
 boolean notifyAnalysisProgress(IAnalyzerBase analyzer, IAnalyzerContext context, int progress, int target)
          (non-Javadoc)
 void notifyAnalysisStarting(IAnalyzerBase analyzer, IAnalyzerContext context, java.lang.String type)
          (non-Javadoc)
 void notifyInitialization(java.lang.String name, int progress, int target)
          (non-Javadoc)
 void printErrors()
          Print the current set of analysis errors on System.out
 IAnalysisReport produceObservationReport()
          Get a report containing all the analysis errors
 java.lang.String produceReport()
          To make the output more usable we summarise the errors at the top of the output and hence this report contains that information
 void produceReport(java.io.OutputStream out)
          To make the output more usable we summarise the errors at the top of the output and hence this report contains that information
 void run()
          Run the analysis on the named file or directory.
 void setClassLoader(java.lang.ClassLoader loader)
          Set a ClassLoader to use for finding analyzers
 void setLogFileName(java.lang.String logFileName)
          Define the file for logging
 void setScriptDir(java.lang.String dir)
          Define the directory which will contain analysis scripts
static void setTerminateVMOnSevereError(boolean terminateVM)
          By default the VM terminates with return code -10 if there are severe errors and the DumpAnalyzer is run through the main method.
static int validateFile(java.lang.String fname)
          Provide an interface to ISA to validate the dump name entered by the user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DumpAnalyzer

public DumpAnalyzer(java.lang.String fname,
                    RuntimeParameters parms)
Build an analyzer to examine the named dump.

Parameters:
fname - the dump name
parms - the runtime parameters to control the analysis

DumpAnalyzer

public DumpAnalyzer(java.lang.String fname,
                    java.lang.String[] analyzers)
Build an analyzer to examine the named dump.

Parameters:
fname - the dump name
analyzers - the analyzers to run against that dump

DumpAnalyzer

public DumpAnalyzer(java.lang.String fname,
                    java.lang.String[] analyzers,
                    RuntimeParameters parms)
Build an analyzer to examine the named dump.

Parameters:
fname - the dump name
analyzers - the analyzers to run against that dump
parms - the runtime parameters to control the analysis
Method Detail

setScriptDir

public void setScriptDir(java.lang.String dir)
Define the directory which will contain analysis scripts

Parameters:
dir - the script directory

getClassLoader

public java.lang.ClassLoader getClassLoader()
Get the ClassLoader used for finding analyzers.

Returns:
the loader

setClassLoader

public void setClassLoader(java.lang.ClassLoader loader)
Set a ClassLoader to use for finding analyzers

Parameters:
loader - the loader to set

analysisRequired

public boolean analysisRequired()
Returns:
true if some actual analysis is required. Return false implies that only help was requested.

run

public void run()
Run the analysis on the named file or directory. If a directory then we analyze all the files in it.


analyzeFile

public void analyzeFile()
Analyze the file for which this analyzer was built


printErrors

public void printErrors()
Print the current set of analysis errors on System.out


generateHTMLErrors

public java.lang.String generateHTMLErrors()
Get a string with the errors in html form (separated by
tags)

Returns:
an html version of the errors

produceObservationReport

public IAnalysisReport produceObservationReport()
Get a report containing all the analysis errors

Returns:
a report of all the analysis errors

setLogFileName

public void setLogFileName(java.lang.String logFileName)
Define the file for logging

Parameters:
logFileName - name of the log file

produceReport

public java.lang.String produceReport()
To make the output more usable we summarise the errors at the top of the output and hence this report contains that information

Returns:
an error and analysis result report

produceReport

public void produceReport(java.io.OutputStream out)
To make the output more usable we summarise the errors at the top of the output and hence this report contains that information

Parameters:
out - OutputStream to send an error and analysis result report to

validateFile

public static int validateFile(java.lang.String fname)
Provide an interface to ISA to validate the dump name entered by the user

Parameters:
fname - - the name of the file to validate
Returns:
- boolean -1 if filename is a directory, -2 if the file isn't found or 0 for a valid file

estimateAnalysisMillisecs

public static long estimateAnalysisMillisecs(java.lang.String fname)
Provide an interface to ISA in order to guess the time that the analysis of a dump will take.

Parameters:
fname - - the name of the file to estimate
Returns:
- int giving the analysis time in milliseconds

analyze

public static java.lang.String analyze(java.lang.String fname,
                                       java.lang.String opts,
                                       java.lang.String scriptDir)
Provide an interface to ISA in order to analyse the dump given on the constructor.

Parameters:
fname - - file to analyze
opts - - analysis options
scriptDir - - the script directory
Returns:
- String containing the analysis result in pseudo-html

main

public static void main(java.lang.String[] args)
This mainline can be used to drive analysis of a specific dump using a specific set of analyzers or scripts.

Parameters:
args - - first arg is the dump name or directory containing dumps - remaining args are the list of analyzers to run against the dump

setTerminateVMOnSevereError

public static void setTerminateVMOnSevereError(boolean terminateVM)
By default the VM terminates with return code -10 if there are severe errors and the DumpAnalyzer is run through the main method. This method provides a mechanism for returning normally if there are severe errors.

Parameters:
terminateVM - - set to be false if do not want the vm to terminate if there are severe errors and true otherwise (default is true)

notifyInitialization

public void notifyInitialization(java.lang.String name,
                                 int progress,
                                 int target)
(non-Javadoc)

Specified by:
notifyInitialization in interface IProgress
Parameters:
name - the file being processed
progress - the progress made so far
target - the target
See Also:
IProgress.notifyInitialization(java.lang.String, int, int)

notifyAnalysisStarting

public void notifyAnalysisStarting(IAnalyzerBase analyzer,
                                   IAnalyzerContext context,
                                   java.lang.String type)
(non-Javadoc)

Specified by:
notifyAnalysisStarting in interface IProgress
Parameters:
analyzer - the current analyzer which may be null during parsing of the input file
context - the current analysis context which may be null during parsing of the input file
type - the analysis type
See Also:
IProgress.notifyAnalysisStarting(com.ibm.dtfj.analyzer.ext.IAnalyzerBase, com.ibm.dtfj.analyzer.ext.IAnalyzerContext, java.lang.String)

notifyAnalysisComplete

public void notifyAnalysisComplete(IAnalyzerBase analyzer,
                                   IAnalyzerContext context,
                                   java.lang.String type)
(non-Javadoc)

Specified by:
notifyAnalysisComplete in interface IProgress
Parameters:
analyzer - the current analyzer which may be null during parsing of the input file
context - the current analysis context which may be null during parsing of the input file
type - the analysis type
See Also:
IProgress.notifyAnalysisComplete(com.ibm.dtfj.analyzer.ext.IAnalyzerBase, com.ibm.dtfj.analyzer.ext.IAnalyzerContext, java.lang.String)

notifyAnalysisPhase

public void notifyAnalysisPhase(IAnalyzerBase analyzer,
                                IAnalyzerContext context,
                                int phase,
                                int target)
(non-Javadoc)

Specified by:
notifyAnalysisPhase in interface IProgress
Parameters:
analyzer - the current analyzer which may be null during parsing of the input file
context - the current analysis context which may be null during parsing of the input file
phase - the current analysis phase - this will be analyzer dependent
target - the target value or 0 if the target phase is not known
See Also:
IProgress.notifyAnalysisPhase(com.ibm.dtfj.analyzer.ext.IAnalyzerBase, com.ibm.dtfj.analyzer.ext.IAnalyzerContext, int, int)

notifyAnalysisProgress

public boolean notifyAnalysisProgress(IAnalyzerBase analyzer,
                                      IAnalyzerContext context,
                                      int progress,
                                      int target)
(non-Javadoc)

Specified by:
notifyAnalysisProgress in interface IProgress
Parameters:
analyzer - the current analyzer which may be null during parsing of the input file
context - the current analysis context which may be null during parsing of the input file
progress - the progress made so far
target - the target value or 0 if the target is not known
Returns:
true if the information was used by at least one subscriber else false.
See Also:
IProgress.notifyAnalysisProgress(com.ibm.dtfj.analyzer.ext.IAnalyzerBase, com.ibm.dtfj.analyzer.ext.IAnalyzerContext, int, int)

getLogger

public java.util.logging.Logger getLogger()
See Also:
com.ibm.dtfj.analyzer.internal.MessageLogger#getLogger()


© Copyright IBM Corp. 2007, 2008 All Rights Reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.