How to link your analyzers together using the scripting language

As mentioned in An overview of the scripting language you can link analyzers together using the simple scripting language shipped as part of the DumpAnalyzer. Listing 1 is an example of such a script which links the two analyzers described in Writing an analyzer that implements IAnalyze and Writing an analyzer that implements IReport.

To continue to follow along with this example create a file called script.sml in your AnalysisModule project in Eclipse and copy the contents of Listing 1 into this newly created file.



Listing 1. Example of a script linking two analyzers together

// need to import the Analyzers to run    
import mypackage.DWAnalyze
import mypackage.DWReport

// The state value is used to control the flow through the sml file
// It needs to be set to start initially
state start

// multi is set to the value returned from running the DWAnalyze class.
// It is the value that is returned from the analysisRules logic
// in this class
multi = DWAnalyze:isMultiProcessor
if (multi = true)
    // depending on the value of multi, print some output
    print DWAnalyze detected a multiprocessor dump
else
    print DWAnalyze did not detect find a multiprocessor dump
fi

// Next run the DWReport class
report DWReport		// run the report

// Finally exit
terminate ok
    


As you can see from the comments within Listing 1 this sample script runs the isMultiProcessor rule contained within the DWAnalyze class and prints out an appropriate message according to the result. It then runs the DWReport analyzer.

© 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.