#created on: Aug 5, 2007 package edu.uoregon.tau.perfexplorer.rules #list any import classes here. import edu.uoregon.tau.perfexplorer.glue.*; #declare any global variables here #function myFunction( ... ) #function content (can have multiple functions) #end rule "Differences in Processes" salience 1 when // there exists a difference operation between metadata collections d : DifferenceMetadataOperation () f : FactWrapper ( factName == "node_count", factType == DifferenceMetadataOperation.NAME ) then String[] values = (String[])d.getDifferences().get("node_count"); System.out.println("Differences in processes... " + values[0] + ", " + values[1]); double tmp = Double.parseDouble(values[0]) / Double.parseDouble(values[1]); // an increase in processors means a decrease in time d.setExpectedRatio(d.getExpectedRatio() * tmp); System.out.println("New Expected Ratio: " + d.getExpectedRatio()); d.removeFact("node_count"); end rule "Differences in Particles Per Cell" salience 1 when // there exists a difference operation between metadata collections d : DifferenceMetadataOperation () f : FactWrapper ( factName == "input:micell", factType == DifferenceMetadataOperation.NAME ) then String[] values = (String[])d.getDifferences().get("input:micell"); System.out.println("Differences in particles per cell... " + values[0] + ", " + values[1]); double tmp = Double.parseDouble(values[0]) / Double.parseDouble(values[1]); // an increase in particles per cell means an increase in time d.setExpectedRatio(d.getExpectedRatio() / tmp); System.out.println("New Expected Ratio: " + d.getExpectedRatio()); d.removeFact("input:micell"); end rule "Differences in Timesteps" salience 1 when // there exists a difference operation between metadata collections d : DifferenceMetadataOperation () f : FactWrapper ( factName == "input:mstep", factType == DifferenceMetadataOperation.NAME ) then String[] values = (String[])d.getDifferences().get("input:mstep"); double tmp = Double.parseDouble(values[0]) / Double.parseDouble(values[1]); // an increase in timesteps means an increase in time d.setExpectedRatio(d.getExpectedRatio() / tmp); System.out.println("New Expected Ratio: " + d.getExpectedRatio()); d.removeFact("input:mstep"); end rule "Performance exceeds expectation" salience 0 when // there exists a difference operation between performance data d : DifferenceOperation ( t : differenceType, pr : performanceRatio ) m : DifferenceMetadataOperation ( er : expectedRatio > pr ) then System.out.println("The comparison trial is faster than expected, relative to the baseline trial"); System.out.println("Expected ratio: " + er + ", Actual ratio: " + pr); end rule "Performance falls short of expectation" salience 0 when // there exists a difference operation between performance data d : DifferenceOperation ( t : differenceType, pr : performanceRatio ) m : DifferenceMetadataOperation ( er : expectedRatio < pr ) then System.out.println("The comparison trial is slower than expected, relative to the baseline trial"); System.out.println("Expected ratio: " + er + ", Actual ratio: " + pr); end