View | Details | Raw Unified | Return to bug 185580 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/test/performance/ui/Utils.java (-85 / +154 lines)
Lines 20-32 Link Here
20
import java.io.InputStream;
20
import java.io.InputStream;
21
import java.io.OutputStream;
21
import java.io.OutputStream;
22
import java.io.PrintWriter;
22
import java.io.PrintWriter;
23
import java.text.DecimalFormat;
23
import java.text.NumberFormat;
24
import java.text.NumberFormat;
24
import java.util.ArrayList;
25
import java.util.ArrayList;
25
import java.util.Arrays;
26
import java.util.Arrays;
26
import java.util.Calendar;
27
import java.util.Calendar;
27
import java.util.HashMap;
28
import java.util.HashMap;
28
import java.util.Hashtable;
29
import java.util.Hashtable;
29
import java.util.Map;
30
import java.util.StringTokenizer;
30
import java.util.StringTokenizer;
31
31
32
import junit.framework.AssertionFailedError;
32
import junit.framework.AssertionFailedError;
Lines 43-52 Link Here
43
import org.eclipse.test.internal.performance.data.Dim;
43
import org.eclipse.test.internal.performance.data.Dim;
44
import org.eclipse.test.internal.performance.db.DB;
44
import org.eclipse.test.internal.performance.db.DB;
45
import org.eclipse.test.internal.performance.db.Scenario;
45
import org.eclipse.test.internal.performance.db.Scenario;
46
import org.eclipse.test.internal.performance.db.SummaryEntry;
46
import org.eclipse.test.internal.performance.db.TimeSeries;
47
import org.eclipse.test.internal.performance.db.TimeSeries;
47
import org.eclipse.test.internal.performance.db.Variations;
48
import org.eclipse.test.internal.performance.db.Variations;
48
import org.eclipse.test.internal.performance.eval.StatisticsUtil;
49
import org.eclipse.test.internal.performance.eval.StatisticsUtil.Percentile;
50
import org.eclipse.test.performance.Dimension;
49
import org.eclipse.test.performance.Dimension;
51
50
52
51
Lines 57-78 Link Here
57
	static {
56
	static {
58
		PERCENT_FORMAT.setMaximumFractionDigits(1);
57
		PERCENT_FORMAT.setMaximumFractionDigits(1);
59
	}
58
	}
60
	static final NumberFormat DOUBLE_FORMAT = NumberFormat.getNumberInstance();
59
	static final DecimalFormat DEVIATION_FORMAT = (DecimalFormat) NumberFormat.getPercentInstance();
61
	static {
60
	static {
62
		DOUBLE_FORMAT.setMaximumIntegerDigits(2);
61
		DEVIATION_FORMAT.setMaximumFractionDigits(1);
63
		DOUBLE_FORMAT.setMaximumFractionDigits(1);
62
		DEVIATION_FORMAT.setMinimumFractionDigits(1);
63
		DEVIATION_FORMAT.setPositivePrefix("+");
64
		DEVIATION_FORMAT.setNegativePrefix("- ");
65
	}
66
	static final DecimalFormat STDERR_FORMAT = (DecimalFormat) NumberFormat.getNumberInstance();
67
	static {
68
		STDERR_FORMAT.setMaximumFractionDigits(1);
69
		STDERR_FORMAT.setMinimumFractionDigits(1);
70
		STDERR_FORMAT.setMultiplier(100);
64
	}
71
	}
65
	public final static String STANDARD_ERROR_THRESHOLD_STRING = PERCENT_FORMAT.format(STANDARD_ERROR_THRESHOLD);
72
	public final static String STANDARD_ERROR_THRESHOLD_STRING = PERCENT_FORMAT.format(STANDARD_ERROR_THRESHOLD);
66
	public final static String STANDARD_ERROR_MESSAGE="Standard error on this test is higher than "+STANDARD_ERROR_THRESHOLD_STRING;
67
	public final static String OK_IMAGE="OK.gif";
73
	public final static String OK_IMAGE="OK.gif";
68
	public final static String OK_IMAGE_WARN="OK_caution.gif";
74
	public final static String OK_IMAGE_WARN="OK_caution.gif";
69
	public final static String FAIL_IMAGE="FAIL.gif";
75
	public final static String FAIL_IMAGE="FAIL.gif";
70
	public final static String FAIL_IMAGE_WARN="FAIL_caution.gif";
76
	public final static String FAIL_IMAGE_WARN="FAIL_caution.gif";
71
	public final static String FAIL_IMAGE_EXPLAINED="FAIL_greyed.gif";
77
	public final static String FAIL_IMAGE_EXPLAINED="FAIL_greyed.gif";
72
	public final static int OK = 0;
78
	public final static int OK = 0;
73
	public final static int SIGN = 0x1;
79
	public final static int WARN = 0x1;
74
	public final static int ERR = 0x2;
80
	public final static int ERR = 0x2;
75
//	public final static int TTEST = 0x2;
76
	public final static int DEV = 0x4;
81
	public final static int DEV = 0x4;
77
82
78
	/**
83
	/**
Lines 207-213 Link Here
207
212
208
		while (tokenizer.hasMoreTokens()) {
213
		while (tokenizer.hasMoreTokens()) {
209
			String labelDescriptor = tokenizer.nextToken();
214
			String labelDescriptor = tokenizer.nextToken();
210
			String[] elements = labelDescriptor.split(",");
215
			String[] elements = labelDescriptor.trim().split(",");
211
			ConfigDescriptor descriptor = new ConfigDescriptor(elements[0], elements[1]);
216
			ConfigDescriptor descriptor = new ConfigDescriptor(elements[0], elements[1]);
212
			configMap.put(elements[0], descriptor);
217
			configMap.put(elements[0], descriptor);
213
		}
218
		}
Lines 268-278 Link Here
268
		return componentNames;
273
		return componentNames;
269
	}
274
	}
270
275
271
	/**
276
	/*
272
	 * @param fp -
277
	 * @param fp -
273
	 *            a FingerPrint object
278
	 *            a FingerPrint object
274
	 * @return - an html representation of the fingerprint.
279
	 * @return - an html representation of the fingerprint.
275
	 */
280
	 *
276
	public static String getImageMap(FingerPrint fp) {
281
	public static String getImageMap(FingerPrint fp) {
277
		String componentDescription = fp.configDescriptor.description;
282
		String componentDescription = fp.configDescriptor.description;
278
		String areas = fp.bar.getAreas();
283
		String areas = fp.bar.getAreas();
Lines 287-292 Link Here
287
		}
292
		}
288
		return output;
293
		return output;
289
	}
294
	}
295
	*/
290
296
291
	/**
297
	/**
292
	 * Utility method to copy a file.
298
	 * Utility method to copy a file.
Lines 740-829 Link Here
740
			out.close();
746
			out.close();
741
		}
747
		}
742
	}
748
	}
743
	
749
744
	public static double[] resultStats(Variations variations, String scenarioName, String baseline, String config) {
750
    public static double[] resultsStatistics(TimeSeries timeSeries) {
745
		String OS = "config";
751
    	try {
746
				
752
	    	double valueRef = timeSeries.getValue(0), value = timeSeries.getValue(1);
747
		Variations tmpVariations=(Variations)variations.clone();
753
	    	long countRef = timeSeries.getCount(0), count = timeSeries.getCount(1);
748
		tmpVariations.put(OS,config);
754
	    	double stddevRef = timeSeries.getStddev(0), stddev = timeSeries.getStddev(1);
749
		Scenario[] currentScenarios = DB.queryScenarios(tmpVariations, scenarioName,OS, null);
755
	    	double stderr = (countRef == 1 || count == 1)
750
		Variations referenceVariations = (Variations) variations.clone();
756
    			? Double.NaN
751
		referenceVariations.put(PerformanceTestPlugin.BUILD, baseline);
757
				: (Double.isNaN(stddevRef)
752
		referenceVariations.put(OS, config);
758
					? Math.sqrt((stddev * stddev / count)) / valueRef
753
		Scenario[] refScenarios = DB.queryScenarios(referenceVariations,
759
					: Math.sqrt((stddevRef * stddevRef / countRef) + (stddev * stddev / count)) / valueRef);
754
				scenarioName, OS, null);
760
			return new double[] {
755
761
				(value - valueRef) / valueRef,
756
		Map referenceScenariosMap = new HashMap();
762
				stderr,
757
		Map currentScenariosMap = new HashMap();
763
			};
758
		for (int i = 0; i < refScenarios.length; i++) {
764
    	}
759
			Scenario scenario = refScenarios[i];
765
    	catch (ArrayIndexOutOfBoundsException aioobe) {
760
			String name = scenario.getScenarioName();
766
    		return null;
761
			referenceScenariosMap.put(name, scenario);
767
    	}
762
		}
763
764
		for (int i = 0; i < currentScenarios.length; i++) {
765
			Scenario scenario = currentScenarios[i];
766
			String name = scenario.getScenarioName();
767
			currentScenariosMap.put(name, scenario);
768
		}
769
		Percentile percentile = StatisticsUtil.T90;
770
		Scenario scenario = (Scenario) currentScenariosMap.get(scenarioName);
771
772
		Scenario reference = (Scenario) referenceScenariosMap.get(scenarioName);
773
		if (reference != null) {
774
			// XXX have to find out the relevant dimension
775
			Dim significanceDimension = (Dim) Dimension.ELAPSED_PROCESS;
776
			TimeSeries currentSeries = scenario.getTimeSeries(significanceDimension);
777
			TimeSeries baselineSeries = reference.getTimeSeries(significanceDimension);
778
			if (currentSeries.getLength() > 0 && baselineSeries.getLength() > 0) {
779
				return StatisticsUtil.statisticsForTimeSeries(baselineSeries, 0, currentSeries, 0, percentile);
780
			}
781
		}
782
		return null;
783
	}
768
	}
784
769
785
	public static boolean hasConfidentResult(Variations variations, String scenarioName, String baseline, String config) {
770
	public static boolean hasConfidentResult(TimeSeries timeSeries) {
786
	    double[] resultStats = resultStats(variations, scenarioName, baseline, config);
771
	    double[] resultStats = resultsStatistics(timeSeries);
787
	    return (confidenceLevel(resultStats) & ERR) == 0;
772
	    return (confidenceLevel(resultStats) & ERR) == 0;
788
    }
773
    }
789
	public static String failureMessage(Variations variations, String scenarioName, String baseline, String config) {
774
	public static String failureMessage(Variations variations, String scenarioName, String baseline, String config) {
790
		return failureMessage(resultStats(variations, scenarioName, baseline, config), true);
775
		String current = (String) variations.get(PerformanceTestPlugin.BUILD);
776
		Dim significanceDimension = (Dim) Dimension.ELAPSED_PROCESS;
777
		Scenario newScenario= DB.getScenarioSeries(scenarioName, variations, PerformanceTestPlugin.BUILD, baseline, current, new Dim[] { significanceDimension });
778
        TimeSeries timeSeries = newScenario.getTimeSeries(significanceDimension);
779
        double[] results = resultsStatistics(timeSeries);
780
		return failureMessage(results, true);
791
	}
781
	}
792
	public static String failureMessage(double[] resultStats, boolean full) {
782
	public static String failureMessage(double[] resultStats, boolean full) {
793
		StringBuffer buffer = new StringBuffer();
783
		StringBuffer buffer = new StringBuffer();
794
		int level = confidenceLevel(resultStats);
784
		int level = confidenceLevel(resultStats);
795
		boolean signal = (level & SIGN) != 0;
785
//		boolean isWarn = (level & WARN) != 0;
796
		boolean isErr = (level & ERR) != 0;
786
		boolean isErr = (level & ERR) != 0;
797
		if (full & isErr) {
787
		if (full) {
798
			buffer.append("*** WARNING ***  ");
788
			if (isErr) {
799
 			buffer.append(STANDARD_ERROR_MESSAGE);
789
				buffer.append("*** WARNING ***  ");
790
	 			buffer.append(Messages.bind(Messages.standardError, PERCENT_FORMAT.format(resultStats[1]), STANDARD_ERROR_THRESHOLD_STRING));
791
			}
792
			return buffer.toString();
800
		}
793
		}
801
		if (!full) buffer.append("<font color=\"#0000FF\" size=\"1\">  ");
802
		if (resultStats != null) {
794
		if (resultStats != null) {
803
			double deviation = resultStats[3]==0 ? 0 : -resultStats[3];
795
			double deviation = resultStats[0];
804
			if (deviation > 0) {
796
			if (Double.isNaN(deviation) || Double.isInfinite(deviation)) {
805
				buffer.append('+');
797
				buffer.append("<font color=\"red\" size=\"1\"> ");
806
			}
798
	 			buffer.append("[n/a]");
807
 			buffer.append(PERCENT_FORMAT.format(deviation));
799
 			} else {
808
 			if (signal) {
800
 				double stderr = resultStats[1];
809
	 			buffer.append("    [&#177;");
801
				deviation = Math.abs(deviation)<0.001 ? 0 : -deviation;
810
 				buffer.append(DOUBLE_FORMAT.format(resultStats[2]*100));
802
				buffer.append("<font color=\"#0000FF\" size=\"1\">");
811
 				buffer.append(']');
803
	 			if (Double.isNaN(stderr)) {
804
		 			buffer.append(DEVIATION_FORMAT.format(deviation));
805
					buffer.append("</font><font color=\"#DDDD00\" size=\"1\"> ");
806
		 			buffer.append(" [n/a]");
807
	 			} else if (Double.isInfinite(stderr)) {
808
		 			buffer.append(DEVIATION_FORMAT.format(deviation));
809
					buffer.append("</font><font color=\"red\" size=\"1\"> ");
810
		 			buffer.append(" [Infinite]");
811
	 			} else {
812
		 			buffer.append(DEVIATION_FORMAT.format(deviation));
813
	 				buffer.append(" [&#177;");
814
	 				buffer.append(STDERR_FORMAT.format(Math.abs(stderr)));
815
	 				buffer.append(']');
816
	 			}
812
 			}
817
 			}
818
			buffer.append("</font>");
813
		}
819
		}
814
		if (!full) buffer.append("</font>");
815
		return buffer.toString();
820
		return buffer.toString();
816
	}
821
	}
817
	public static int confidenceLevel(double[] resultStats) {
822
	public static int confidenceLevel(double[] resultStats) {
818
		int level = OK;
823
		int level = OK;
819
 		if (resultStats != null){
824
 		if (resultStats != null){
820
// 			if (resultStats[1] >= 0 && resultStats[0] >= resultStats[1]) { // invalid t-test
825
 			if (resultStats[1] >= (Utils.STANDARD_ERROR_THRESHOLD/2)) { // warns standard error higher than the half of authorized threshold
821
// 				level |= TTEST;
826
 				level |= WARN;
822
// 			}
823
 			if (resultStats[2] > 0) { // signal standard error higher than 0% (only one iteration)
824
 				level |= SIGN;
825
 			}
827
 			}
826
 			if (resultStats[2] >= Utils.STANDARD_ERROR_THRESHOLD) { // standard error higher than the authorized threshold
828
 			if (resultStats[1] >= Utils.STANDARD_ERROR_THRESHOLD) { // standard error higher than the authorized threshold
827
 				level |= ERR;
829
 				level |= ERR;
828
 			}
830
 			}
829
 		}
831
 		}
Lines 837-851 Link Here
837
			String previous = "";
839
			String previous = "";
838
			while (tokenizer.hasMoreTokens()) {
840
			while (tokenizer.hasMoreTokens()) {
839
				String token = tokenizer.nextToken();
841
				String token = tokenizer.nextToken();
840
				if (token.equals("%")) {
842
				if (!token.equals("%") && !token.equals("_")) {
841
					start += previous.length();
842
				} else if (token.equals("_")) {
843
					start++;
844
				} else {
845
					if (previous.equals("%")) {
843
					if (previous.equals("%")) {
846
						if (name.substring(start).indexOf(token) < 0) return false;
844
						int idx = name.substring(start).indexOf(token);
845
						if (idx < 0) return false;
846
						start += idx;
847
					} else if (previous.equals("_")) {
847
					} else if (previous.equals("_")) {
848
						if (!name.substring(start).startsWith(token)) return false;
848
						if (!name.substring(++start).startsWith(token)) return false;
849
					}
849
					}
850
					start += token.length();
850
					start += token.length();
851
				}
851
				}
Lines 861-867 Link Here
861
		return name.equals(pattern);
861
		return name.equals(pattern);
862
	}
862
	}
863
863
864
	public static String getImage(int confidence, double[] resultStats, boolean hasExplanation) {
864
	public static String getImage(int confidence, boolean hasExplanation) {
865
	    boolean scenarioFailed = (confidence & DEV) != 0;
865
	    boolean scenarioFailed = (confidence & DEV) != 0;
866
	    String image = null;
866
	    String image = null;
867
867
Lines 880-883 Link Here
880
	    }
880
	    }
881
	    return image;
881
	    return image;
882
    }
882
    }
883
}
883
884
	public static boolean hasSummary(SummaryEntry[] summaries, String scenarioName) {
885
		int length = summaries == null ? 0 : summaries.length;
886
		for (int i=0; i<length; i++) {
887
			SummaryEntry summary = summaries[i];
888
			if (summary.scenarioName.equals(scenarioName)) {
889
				return true;
890
			}
891
		}
892
		return false;
893
	}
894
895
	public static String getScenarioShortName(String scenarioName, int max) {
896
897
		// Remove class name qualification
898
		int testSeparator = scenarioName.indexOf('#');
899
		boolean hasClassName = testSeparator >= 0;
900
		if (!hasClassName) {
901
			testSeparator = scenarioName.lastIndexOf('.');
902
			if (testSeparator <= 0) {
903
				if (max > 0 && scenarioName.length() > max) {
904
					return "*"+scenarioName.substring(0, max);
905
				}
906
				return scenarioName;
907
			}
908
		}
909
		int classSeparator = scenarioName.substring(0, testSeparator).lastIndexOf('.');
910
		if (classSeparator < 0) {
911
			if (max > 0 && scenarioName.length() > max) {
912
				return "*"+scenarioName.substring(0, max);
913
			}
914
			return scenarioName;
915
		}
916
		int length = scenarioName.length();
917
		String shortName = scenarioName.substring(classSeparator+1, length);
918
		if (!hasClassName && shortName.startsWith("test.")) { // specific case for swt...
919
			shortName = shortName.substring(5);
920
		}
921
922
		// Remove qualification from test name
923
		StringTokenizer tokenizer = new StringTokenizer(shortName, " :,", true);
924
		StringBuffer buffer = new StringBuffer(tokenizer.nextToken());
925
		while (tokenizer.hasMoreTokens()) {
926
			String token = tokenizer.nextToken();
927
			char fc = token.charAt(0);
928
			while (fc == ' ' || fc == ',' || fc == ':') {
929
				buffer.append(token); // add the separator
930
				token = tokenizer.nextToken();
931
				fc = token.charAt(0);
932
			}
933
			int last = token .lastIndexOf('.');
934
			if (last >= 3) {
935
				int first = token .indexOf('.');
936
				if (first == last) {
937
					buffer.append(token);
938
				} else {
939
//					buffer.append(token.substring(0, first));
940
//					buffer.append("...");
941
					buffer.append(token.substring(last+1));
942
				}
943
			} else {
944
				buffer.append(token);
945
			}
946
		}
947
		if (max > 0 && buffer.length() > max) {
948
			return "*"+buffer.substring(0, max);
949
		}
950
		return buffer.toString();
951
	}
952
}
(-)src/org/eclipse/test/performance/ui/ScenarioStatusTable.java (-84 / +172 lines)
Lines 10-21 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.test.performance.ui;
11
package org.eclipse.test.performance.ui;
12
12
13
import java.io.PrintStream;
13
import java.util.ArrayList;
14
import java.util.ArrayList;
14
import java.util.Hashtable;
15
import java.util.Hashtable;
16
import java.util.StringTokenizer;
15
17
18
import org.eclipse.test.internal.performance.PerformanceTestPlugin;
19
import org.eclipse.test.internal.performance.data.Dim;
16
import org.eclipse.test.internal.performance.db.DB;
20
import org.eclipse.test.internal.performance.db.DB;
17
import org.eclipse.test.internal.performance.db.Scenario;
21
import org.eclipse.test.internal.performance.db.Scenario;
22
import org.eclipse.test.internal.performance.db.SummaryEntry;
23
import org.eclipse.test.internal.performance.db.TimeSeries;
18
import org.eclipse.test.internal.performance.db.Variations;
24
import org.eclipse.test.internal.performance.db.Variations;
25
import org.eclipse.test.performance.Dimension;
19
26
20
public class ScenarioStatusTable {
27
public class ScenarioStatusTable {
21
	
28
	
Lines 24-41 Link Here
24
	private String scenarioPattern;
31
	private String scenarioPattern;
25
	private ArrayList configNames=new ArrayList();
32
	private ArrayList configNames=new ArrayList();
26
	private Hashtable scenarioComments;
33
	private Hashtable scenarioComments;
34
	private SummaryEntry[] fingerprintEntries;
27
	private final String baseline;
35
	private final String baseline;
28
	
36
	
29
	private class ScenarioStatus{
37
	private class ScenarioStatus{
30
		Hashtable statusMap;
38
		Hashtable statusMap;
31
		String name;
39
		String name, shortName;
32
		Hashtable configStatus;
40
		Hashtable configStatus;
41
		Hashtable resultsMap;
33
		boolean hasSlowDownExplanation=false;
42
		boolean hasSlowDownExplanation=false;
43
		boolean fingerprint = false;
44
		boolean hasBaseline = true;
34
						
45
						
35
		public ScenarioStatus(String scenarioName){
46
		public ScenarioStatus(String scenarioName){
36
			name=scenarioName;
47
			name = scenarioName;
37
			statusMap=new Hashtable();
48
			statusMap = new Hashtable();
38
			configStatus=new Hashtable();
49
			configStatus = new Hashtable();
50
			resultsMap = new Hashtable();
39
		}
51
		}
40
52
41
	}
53
	}
Lines 48-67 Link Here
48
	 * @param scenarioPattern
60
	 * @param scenarioPattern
49
	 * @param configDescriptors
61
	 * @param configDescriptors
50
	 */
62
	 */
51
	public ScenarioStatusTable(Variations variations,String scenarioPattern,Hashtable configDescriptors,Hashtable scenarioComments, String baseline){
63
	public ScenarioStatusTable(Variations variations,String scenarioPattern,Hashtable configDescriptors,Hashtable scenarioComments, SummaryEntry[] fpSummaries, String baseline){
52
		configMaps=configDescriptors;
64
		configMaps=configDescriptors;
53
		this.variations=variations;
65
		this.variations=variations;
54
		this.scenarioPattern=scenarioPattern;
66
		this.scenarioPattern=scenarioPattern;
55
		this.scenarioComments=scenarioComments;
67
		this.scenarioComments=scenarioComments;
56
		this.baseline= baseline;
68
		this.baseline= baseline;
69
		this.fingerprintEntries = fpSummaries;
57
	}
70
	}
58
	
71
59
	/**
72
	/**
60
	 * Returns HTML representation of scenario status table.
73
	 * Prints the HTML representation of scenario status table into the given stream.
61
	 */
74
	 */
62
	public String toString() {
75
	public void print(PrintStream stream, boolean filter) {
63
		String OS="config";
76
		String OS="config";
64
		String htmlTable="";
65
        Scenario[] scenarios= DB.queryScenarios(variations, scenarioPattern, OS, null);
77
        Scenario[] scenarios= DB.queryScenarios(variations, scenarioPattern, OS, null);
66
	
78
	
67
		if (scenarios != null && scenarios.length > 0) {
79
		if (scenarios != null && scenarios.length > 0) {
Lines 70-92 Link Here
70
			for (int i= 0; i < scenarios.length; i++) {
82
			for (int i= 0; i < scenarios.length; i++) {
71
				Scenario scenario= scenarios[i];
83
				Scenario scenario= scenarios[i];
72
				String scenarioName=scenario.getScenarioName();
84
				String scenarioName=scenario.getScenarioName();
73
//				if (!Utils.matchPattern(scenarioName, scenarioPattern)) continue;
85
				if (filter && !Utils.matchPattern(scenarioName, scenarioPattern)) continue;
74
				// returns the config names. Making assumption that indices in
86
				// returns the config names. Making assumption that indices in
75
				// the configs array map to the indices of the failure messages.
87
				// the configs array map to the indices of the failure messages.
76
				String[] configs=scenario.getTimeSeriesLabels();
88
				String[] configs=scenario.getTimeSeriesLabels();
77
				String[] failureMessages= scenario.getFailureMessages();
89
				String[] failureMessages= scenario.getFailureMessages();
78
				ScenarioStatus scenarioStatus=new ScenarioStatus(scenarioName);
90
				ScenarioStatus scenarioStatus=new ScenarioStatus(scenarioName);
79
				scenarioStatusList.add(scenarioStatus);
91
				scenarioStatus.fingerprint = Utils.hasSummary(this.fingerprintEntries, scenarioName);
80
92
81
				String scenarioComment= (String)scenarioComments.get(scenarioName);
93
				String scenarioComment= (String)scenarioComments.get(scenarioName);
82
				if (scenarioComment != null)
94
				if (scenarioComment != null)
83
					scenarioStatus.hasSlowDownExplanation= true;
95
					scenarioStatus.hasSlowDownExplanation= true;
84
				
96
85
				for (int j=0;j<configs.length;j++){
97
				int confsLength = configs.length;
98
				for (int j=0; j<confsLength; j++){
86
					if (!configNames.contains(configs[j]))
99
					if (!configNames.contains(configs[j]))
87
						configNames.add(configs[j]);
100
						configNames.add(configs[j]);
88
101
89
					double[] resultStats = Utils.resultStats(variations, scenarioName, baseline, configs[j]);
102
					Variations v = (Variations) variations.clone();
103
					v.put(PerformanceTestPlugin.CONFIG, configs[j]);
104
//    				double[] resultStats = Utils.resultStats(v, scenarioName, baseline, configs[j]);
105
					String current = (String) v.get(PerformanceTestPlugin.BUILD);
106
					Dim significanceDimension = (Dim) Dimension.ELAPSED_PROCESS;
107
					Scenario newScenario= DB.getScenarioSeries(scenarioName, v, PerformanceTestPlugin.BUILD, baseline, current, new Dim[] { significanceDimension });
108
			        String[] timeSeriesLabels= newScenario.getTimeSeriesLabels();
109
			        TimeSeries timeSeries = newScenario.getTimeSeries(significanceDimension);
110
			        boolean hasBaseline = timeSeriesLabels.length == 2 && timeSeriesLabels[0].equals(baseline);
111
			        double[] resultStats = Utils.resultsStatistics(timeSeries);
112
					if (resultStats == null) continue;
113
					if (resultStats != null && resultStats[1] < 0 && scenarioStatus.hasBaseline) scenarioStatus.hasBaseline = false;
90
					int confidenceLevel = Utils.confidenceLevel(resultStats);
114
					int confidenceLevel = Utils.confidenceLevel(resultStats);
91
					
115
					
92
					boolean hasScenarioFailure = failureMessages[j] != null && failureMessages[j].indexOf(configs[j]) != -1; // ensure correct failure message relates to config
116
					boolean hasScenarioFailure = failureMessages[j] != null && failureMessages[j].indexOf(configs[j]) != -1; // ensure correct failure message relates to config
Lines 100-145 Link Here
100
						confidenceLevel |= Utils.DEV;
124
						confidenceLevel |= Utils.DEV;
101
					}
125
					}
102
126
127
					String text = Utils.failureMessage(resultStats, false);
128
					if (text == null) continue;
103
					scenarioStatus.configStatus.put(configs[j], new Integer(confidenceLevel));
129
					scenarioStatus.configStatus.put(configs[j], new Integer(confidenceLevel));
104
					scenarioStatus.statusMap.put(configs[j], new Object[] { buffer.toString(), resultStats });
130
					scenarioStatus.statusMap.put(configs[j], buffer.toString());
131
					scenarioStatus.resultsMap.put(configs[j], text);
132
					if (scenarioStatus.shortName == null) {
133
						if (hasBaseline) { // baseline is OK
134
							scenarioStatus.shortName = Utils.getScenarioShortName(scenarioName, -1);
135
						} else {
136
							StringBuffer shortName = new StringBuffer("*");
137
							shortName.append(Utils.getScenarioShortName(scenarioName, -1));
138
							shortName.append(" <small>(vs.&nbsp;");
139
							shortName.append(timeSeriesLabels[0]);
140
							shortName.append(")</small>");
141
							scenarioStatus.shortName = shortName.toString();
142
						}
143
					}
144
					
145
					if (!scenarioStatusList.contains(scenarioStatus)) {
146
						scenarioStatusList.add(scenarioStatus);
147
					}
105
				}
148
				}
106
			}
149
			}
107
			
150
			
108
			String label=null;
151
			String label=null;
109
			htmlTable=htmlTable.concat("<br><h4>Scenario Status</h4>\n" +
152
			stream.println("<br><h4>Scenario Status</h4>");
110
				"The scenario status table shows all scenarios tests result for all performance test machines. It gives a complete but compact view of performance result for the component.<br>\n" +
153
			stream.println("The scenario status table shows all scenarios tests result for all performance test machines.");
111
				"For each test (ie. in each cell of this table), following information are displayed:\n" +
154
			stream.println("It gives a complete but compact view of performance result for the component.<br>");
112
				"<ul>\n" +
155
			stream.println("For each test (ie. in each cell of this table), following information are displayed:");
113
				"<li>an icon showing whether the test fails or passes and whether it's reliable or not.<br>\n" +
156
			stream.println("<ul>");
114
				"The legend for this icon is:\n" +
157
			stream.println("<li>an icon showing whether the test fails or passes and whether it's reliable or not.<br>");
115
				"<ul>\n" +
158
			stream.println("The legend for this icon is:");
116
				"<li>Green (<img src=\""+Utils.OK_IMAGE+"\">): mark a <b>successful result</b>, which means this test has neither significant performance regression nor significant standard error</li>\n" +
159
			stream.println("<ul>");
117
				"<li>Red (<img src=\""+Utils.FAIL_IMAGE+"\">): mark a <b>failing result</b>, which means this test shows a significant performance regression (more than 10%)</li>\n" +
160
			stream.print("<li>Green (<img src=\"");
118
				"<li>Gray (<img src=\""+Utils.FAIL_IMAGE_EXPLAINED+"\">): mark a <b>failing result</b> (see above) with a comment explaining this degradation.</li>\n" +
161
			stream.print(Utils.OK_IMAGE);
119
				"<li>Yellow (<img src=\""+Utils.FAIL_IMAGE_WARN+"\"> or <img src=\""+Utils.OK_IMAGE_WARN+"\">): mark a <b>failing or successful result</b> with a significant standard error (more than "+Utils.STANDARD_ERROR_THRESHOLD_STRING+")</li>\n" +
162
			stream.print("\">): mark a <b>successful result</b>, which means this test has neither significant performance regression nor significant standard error</li>");
120
				"<li>\"n/a\": mark a test for with <b>no</b> performance results</li>\n" +
163
			stream.print("<li>Red (<img src=\"");
121
				"</ul></li>\n" +
164
			stream.print(Utils.FAIL_IMAGE);
122
				"<li>the value of the deviation from the baseline as a percentage (ie. formula is: <code>(build_test_time - baseline_test_time) / baseline_test_time</code>)</li>\n" +
165
			stream.println("\">): mark a <b>failing result</b>, which means this test shows a significant performance regression (more than 10%)</li>");
123
				"<li>the value of the standard error of this deviation as a percentage (ie. formula is: <code>sqrt(build_test_stddev^2 / N + baseline_test_stddev^2 / N) / baseline_test_time</code>)<br>\n" +
166
			stream.print("<li>Gray (<img src=\"");
124
				"Note that errors equal to 0 are not shown (tests which have only one iteration).</li>\n" +
167
			stream.print(Utils.FAIL_IMAGE_EXPLAINED);
125
				"</ul>" +
168
			stream.println("\">): mark a <b>failing result</b> (see above) with a comment explaining this degradation.</li>");
126
				"For failing tests, value of deviation with its standard error is added at the beginning of the error message you can see flying over the corresponding image.<br>\n" +
169
			stream.print("<li>Yellow (<img src=\"");
127
				"Follow the link on test box corresponding image for detailed results.<br>" +
170
			stream.print(Utils.FAIL_IMAGE_WARN);
128
				"<br>\n");
171
			stream.print("\"> or <img src=\"");
172
			stream.print(Utils.OK_IMAGE_WARN);
173
			stream.print("\">): mark a <b>failing or successful result</b> with a significant standard error (more than ");
174
			stream.print(Utils.STANDARD_ERROR_THRESHOLD_STRING);
175
			stream.println(")</li>");
176
			stream.println("<li>\"n/a\": mark a test for with <b>no</b> performance results</li>");
177
			stream.println("</ul></li>");
178
			stream.println("<li>the value of the deviation from the baseline as a percentage (ie. formula is: <code>(build_test_time - baseline_test_time) / baseline_test_time</code>)<br>");
179
			stream.println("This value may be '<font color=\"red\">[n/a]</font>' when deviation is not a number (<code>NaN</code>) or is infinite, typically when reference value is equals to 0!</li>");
180
			stream.println("<li>the value of the standard error of this deviation as a percentage (ie. formula is: <code>sqrt(build_test_stddev^2 / N + baseline_test_stddev^2 / N) / baseline_test_time</code>)<br>");
181
			stream.println("This value may be '<font color=\"#CCCC00\">[n/a]</font>' when error cannot be computed, typically when the test has only one measure!</li>");
182
			stream.println("</ul>");
183
			stream.println("<u>Hints</u>:<ul>");
184
			stream.println("<li>fly over image of failing tests to see the complete error message</li>");
185
			stream.println("<li>to look at the complete and detailed test results, click on its image</li>");
186
			stream.println("<li>scenario name may be <b>emphazised</b> when the results are also displayed in the fingerprint</li>");
187
			stream.println("<li>scenario name may start with an '*' when the scenario has no results in the last baseline run</li>");
188
			stream.println("</ul>");
189
			stream.println();
190
			stream.println("<table border=\"1\">");
191
			stream.println("<tr>");
192
			stream.print("<td><h4>All ");
193
			stream.print(scenarios.length);
194
			stream.println(" scenarios</h4></td>");
129
195
130
			htmlTable=htmlTable.concat("<table border=\"1\"><tr><td><h4>All "+scenarios.length+" scenarios</h4></td>\n");
131
			for (int i= 0; i < configNames.size(); i++){
196
			for (int i= 0; i < configNames.size(); i++){
132
				label=configNames.get(i).toString();
197
				label = configNames.get(i).toString();
133
				String columnTitle=label;
198
				String columnTitle = label;
134
				if (configMaps!=null) {
199
				if (configMaps!=null) {
135
					Utils.ConfigDescriptor configDescriptor= (Utils.ConfigDescriptor)configMaps.get(label);
200
					Utils.ConfigDescriptor configDescriptor= (Utils.ConfigDescriptor)configMaps.get(label);
136
					if (configDescriptor != null)
201
					if (configDescriptor != null) {
137
						columnTitle=configDescriptor.description;
202
						int idx = configDescriptor.description.indexOf('(');
203
						if (idx < 0) {
204
							columnTitle = configDescriptor.description;
205
						} else {
206
							// first line
207
    						StringTokenizer tokenizer = new StringTokenizer(configDescriptor.description.substring(0, idx).trim(), " ");
208
    						StringBuffer buffer = new StringBuffer(tokenizer.nextToken());
209
    						while (tokenizer.hasMoreTokens()) {
210
    							buffer.append("&nbsp;");
211
    							buffer.append(tokenizer.nextToken());
212
    						}
213
    						buffer.append(' ');
214
    						// second line
215
    						tokenizer = new StringTokenizer(configDescriptor.description.substring(idx).trim(), " ");
216
    						buffer.append(tokenizer.nextToken());
217
    						while (tokenizer.hasMoreTokens()) {
218
    							buffer.append("&nbsp;");
219
    							buffer.append(tokenizer.nextToken());
220
    						}
221
    						columnTitle = buffer.toString();
222
						}
223
					}
138
				}
224
				}
139
				htmlTable=htmlTable.concat("<td><h5>"+columnTitle +"</h5></td>");
225
				stream.print("<td><h5>");
226
				stream.print(columnTitle);
227
				stream.println("</h5>");
140
			}
228
			}
141
			 
142
			htmlTable=htmlTable.concat("</tr>\n");
143
			
229
			
144
			// counter for js class Id's
230
			// counter for js class Id's
145
			int jsIdCount=0;
231
			int jsIdCount=0;
Lines 147-207 Link Here
147
				
233
				
148
				ScenarioStatus status=(ScenarioStatus)scenarioStatusList.get(j);
234
				ScenarioStatus status=(ScenarioStatus)scenarioStatusList.get(j);
149
235
150
				htmlTable=htmlTable.concat("<tr><td>"+status.name.substring(status.name.indexOf(".",status.name.indexOf(".test")+1)+1)+"</td>");
236
				stream.println("<tr>");
237
				stream.print("<td>");
238
				if (status.fingerprint) stream.print("<b>");
239
				if (!status.hasBaseline) stream.print("*");
240
//				stream.print(status.name.substring(status.name.indexOf(".",status.name.indexOf(".test")+1)+1));
241
				stream.print(status.shortName);
242
				if (!status.hasBaseline) stream.print("</i>");
243
				if (status.fingerprint) stream.print("</b>");
244
				stream.println();
151
				for (int i=0;i<configNames.size();i++){
245
				for (int i=0;i<configNames.size();i++){
152
					String message=null;
153
					String configName=configNames.get(i).toString();
246
					String configName=configNames.get(i).toString();
154
					String aUrl=configName;
247
					String aUrl=configName;
155
					double[] resultStats = null;
156
					if(status.statusMap.get(configName)!=null){
157
						Object[] statusInfo = (Object[]) status.statusMap.get(configName);
158
						message = (String) statusInfo[0];
159
						resultStats = (double[]) statusInfo[1];
160
					}
161
162
					if (status.statusMap.containsKey(configName)){
248
					if (status.statusMap.containsKey(configName)){
249
						String message = (String) status.statusMap.get(configName);
163
						int confidence = ((Integer) status.configStatus.get(configName)).intValue();
250
						int confidence = ((Integer) status.configStatus.get(configName)).intValue();
164
						String image = Utils.getImage(confidence, resultStats, status.hasSlowDownExplanation);
251
						String image = Utils.getImage(confidence, status.hasSlowDownExplanation);
165
						StringBuffer html = new StringBuffer("\n<td><a ");
252
						stream.print("<td><a ");
166
						if ((confidence & Utils.DEV) == 0 || message.length() == 0){
253
						if ((confidence & Utils.DEV) == 0 || message.length() == 0){
167
							// write deviation with error in table when test pass
254
							// write deviation with error in table when test pass
168
							html.append("href=\"");
255
							stream.print("href=\"");
169
							html.append(aUrl);
256
							stream.print(aUrl);
170
							html.append('/');
257
							stream.print('/');
171
							html.append(status.name.replace('#', '.').replace(':', '_').replace('\\', '_'));
258
							stream.print(status.name.replace('#', '.').replace(':', '_').replace('\\', '_'));
172
							html.append(".html\">\n<img hspace=\"10\" border=\"0\" src=\"");
259
							stream.println(".html\">");
173
							html.append(image);
260
							stream.print("<img hspace=\"10\" border=\"0\" src=\"");
174
							html.append("\"/></a>");
261
							stream.print(image);
262
							stream.println("\"/></a>");
175
						} else {
263
						} else {
176
							// create message with tooltip text including deviation with error plus failure message
264
							// create message with tooltip text including deviation with error plus failure message
177
							jsIdCount+=1;
265
							jsIdCount+=1;
178
							html.append("class=\"tooltipSource\" onMouseover=\"show_element('toolTip");
266
							stream.print("class=\"tooltipSource\" onMouseover=\"show_element('toolTip");
179
							html.append(jsIdCount);
267
							stream.print(jsIdCount);
180
							html.append("')\" onMouseout=\"hide_element('toolTip");
268
							stream.print("')\" onMouseout=\"hide_element('toolTip");
181
							html.append(jsIdCount);
269
							stream.print(jsIdCount);
182
							html.append("')\" \nhref=\"");
270
							stream.print("')\" \nhref=\"");
183
							html.append(aUrl);
271
							stream.print(aUrl);
184
							html.append('/');
272
							stream.print('/');
185
							html.append(status.name.replace('#', '.').replace(':', '_').replace('\\', '_'));
273
							stream.print(status.name.replace('#', '.').replace(':', '_').replace('\\', '_'));
186
							html.append(".html\">\n<img hspace=\"10\" border=\"0\" src=\"");
274
							stream.println(".html\">");
187
							html.append(image);
275
							stream.print("<img hspace=\"10\" border=\"0\" src=\"");
188
							html.append("\"/>\n<span class=\"hidden_tooltip\" id=\"toolTip");
276
							stream.print(image);
189
							html.append(jsIdCount);
277
							stream.println("\"/>");
190
							html.append("\">");
278
							stream.print("<span class=\"hidden_tooltip\" id=\"toolTip");
191
							html.append(message);
279
							stream.print(jsIdCount);
192
							html.append("</span></a>");
280
							stream.print("\">");
281
							stream.print(message);
282
							stream.println("</span></a>");
193
						}
283
						}
194
						html.append(Utils.failureMessage(resultStats, false));
284
						String results = (String) status.resultsMap.get(configName);
195
						html.append("</td>");
285
						if (results != null) stream.println(results);
196
						htmlTable=htmlTable.concat(html.toString());
197
					}else{
286
					}else{
198
						htmlTable=htmlTable.concat("<td>n/a</td>");
287
						stream.println("<td>n/a");
199
					}
288
					}
200
				}
289
				}
290
				stream.flush();
201
			}
291
			}
202
			
292
			stream.println("</table>");
203
			htmlTable=htmlTable.concat("</tr>\n");		
204
		}
293
		}
205
		return htmlTable;
294
    }
206
	}
207
}
295
}
(-)src/org/eclipse/test/performance/ui/FingerPrint.java (-26 / +36 lines)
Lines 19-35 Link Here
19
import java.util.Hashtable;
19
import java.util.Hashtable;
20
20
21
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.events.PaintEvent;
23
import org.eclipse.swt.events.PaintListener;
24
import org.eclipse.swt.graphics.GC;
22
import org.eclipse.swt.graphics.GC;
25
import org.eclipse.swt.graphics.Image;
23
import org.eclipse.swt.graphics.Image;
26
import org.eclipse.swt.graphics.ImageData;
24
import org.eclipse.swt.graphics.ImageData;
27
import org.eclipse.swt.graphics.ImageLoader;
25
import org.eclipse.swt.graphics.ImageLoader;
28
import org.eclipse.swt.graphics.Point;
29
import org.eclipse.swt.layout.FillLayout;
30
import org.eclipse.swt.widgets.Canvas;
31
import org.eclipse.swt.widgets.Display;
26
import org.eclipse.swt.widgets.Display;
32
import org.eclipse.swt.widgets.Shell;
33
import org.eclipse.test.internal.performance.PerformanceTestPlugin;
27
import org.eclipse.test.internal.performance.PerformanceTestPlugin;
34
import org.eclipse.test.internal.performance.data.Dim;
28
import org.eclipse.test.internal.performance.data.Dim;
35
import org.eclipse.test.internal.performance.db.DB;
29
import org.eclipse.test.internal.performance.db.DB;
Lines 37-45 Link Here
37
import org.eclipse.test.internal.performance.db.SummaryEntry;
31
import org.eclipse.test.internal.performance.db.SummaryEntry;
38
import org.eclipse.test.internal.performance.db.TimeSeries;
32
import org.eclipse.test.internal.performance.db.TimeSeries;
39
import org.eclipse.test.internal.performance.db.Variations;
33
import org.eclipse.test.internal.performance.db.Variations;
40
import org.eclipse.test.internal.performance.eval.StatisticsUtil;
41
import org.eclipse.test.internal.performance.eval.StatisticsUtil.Percentile;
42
import org.eclipse.test.performance.Dimension;
43
import org.eclipse.test.performance.ui.Utils.ConfigDescriptor;
34
import org.eclipse.test.performance.ui.Utils.ConfigDescriptor;
44
35
45
36
Lines 74-90 Link Here
74
        if (component==null){
65
        if (component==null){
75
        	entries= DB.querySummaries(variations,null);
66
        	entries= DB.querySummaries(variations,null);
76
        	this.component="";
67
        	this.component="";
77
        }
68
        } else {
78
        else
79
        	entries=DB.querySummaries(variations,component+'%');
69
        	entries=DB.querySummaries(variations,component+'%');
80
       	run(entries);
70
        }
71
       	run();
81
    }    
72
    }    
82
    
73
    
83
    /**
74
    /**
84
     * Creates the fingerprint gif, image map and scenario status table for the component.
75
     * Creates the fingerprint gif, image map and scenario status table for the component.
85
     * @param entries - the result of a database query for summaries for a specified variation.
86
     */
76
     */
87
    public void run(Object[] entries) {
77
    public void run() {
88
        new File(outputDirectory).mkdirs();
78
        new File(outputDirectory).mkdirs();
89
        String referenceName=referenceBuildId;
79
        String referenceName=referenceBuildId;
90
        String currentName=currentBuildId;
80
        String currentName=currentBuildId;
Lines 101-112 Link Here
101
                
91
                
102
        if (entries != null) {
92
        if (entries != null) {
103
            for (int i= 0; i < entries.length; i++) {
93
            for (int i= 0; i < entries.length; i++) {
104
                SummaryEntry se= (SummaryEntry)entries[i];
94
                SummaryEntry summary = entries[i];
105
                if (se.comment==null)
95
                if (summary.comment==null)
106
                	add(bar, se.shortName, new Dim[] { se.dimension }, se.scenarioName);
96
                	add(summary.shortName, new Dim[] { summary.dimension }, summary.scenarioName);
107
                else{
97
                else{
108
                	setComment(se.scenarioName, se.comment);
98
                	setComment(summary.scenarioName, summary.comment);
109
                	add(bar, se.shortName, new Dim[] { se.dimension }, se.scenarioName,se.comment);
99
                	add(summary.shortName, new Dim[] { summary.dimension }, summary.scenarioName, summary.comment);
110
                }
100
                }
111
            }
101
            }
112
        }
102
        }
Lines 115-121 Link Here
115
               
105
               
116
        if (component=="")
106
        if (component=="")
117
        	outName= "FP_"+referenceName + '_' + currentBuildId+"."+configDescriptor.name;
107
        	outName= "FP_"+referenceName + '_' + currentBuildId+"."+configDescriptor.name;
118
        save(bar, outputDirectory + '/' + outName);
108
        save(outputDirectory + '/' + outName);
119
        
109
        
120
        //show(bar);
110
        //show(bar);
121
     
111
     
Lines 127-137 Link Here
127
    	scenarioComments.put(scenario,comment);
117
    	scenarioComments.put(scenario,comment);
128
    }
118
    }
129
119
130
    private void add(BarGraph bar, String name, Dim[] dims, String scenarioName) {
120
    private void add(String name, Dim[] dims, String scenarioName) {
131
    	add (bar,name,dims,scenarioName,null);
121
    	add (name,dims,scenarioName,null);
132
    }
122
    }
133
123
134
    private void add(BarGraph bar, String name, Dim[] dims, String scenarioName,String comment) {
124
    private void add(String name, Dim[] dims, String scenarioName, String comment) {
135
         String refData= "";
125
         String refData= "";
136
        Scenario scenario= DB.getScenarioSeries(scenarioName, variations, PerformanceTestPlugin.BUILD, referenceBuildId, currentBuildId, dims);
126
        Scenario scenario= DB.getScenarioSeries(scenarioName, variations, PerformanceTestPlugin.BUILD, referenceBuildId, currentBuildId, dims);
137
        String[] timeSeriesLabels= scenario.getTimeSeriesLabels();
127
        String[] timeSeriesLabels= scenario.getTimeSeriesLabels();
Lines 153-159 Link Here
153
            	double percent= 0.0;
143
            	double percent= 0.0;
154
            	boolean hasConfidentResult= true;
144
            	boolean hasConfidentResult= true;
155
            	if (l > 1) {
145
            	if (l > 1) {
156
            		hasConfidentResult= Utils.hasConfidentResult(variations, scenario.getScenarioName(),referenceBuildId,configDescriptor.name);
146
//            		hasConfidentResult= Utils.hasConfidentResult(variations, scenario.getScenarioName(),referenceBuildId,configDescriptor.name);
147
            		hasConfidentResult= Utils.hasConfidentResult(timeSeries);
157
            		/*if (!rejectNullHypothesis) {
148
            		/*if (!rejectNullHypothesis) {
158
            			NumberFormat percentFormatter= NumberFormat.getPercentInstance();
149
            			NumberFormat percentFormatter= NumberFormat.getPercentInstance();
159
            			String statisticsComment= "There is not enough evidence to reject the null hypothesis at the " + percentFormatter.format(percentile.inside()) + "level";
150
            			String statisticsComment= "There is not enough evidence to reject the null hypothesis at the " + percentFormatter.format(percentile.inside()) + "level";
Lines 178-184 Link Here
178
	         
169
	         
179
    }
170
    }
180
171
181
    private void save(BarGraph bar, String output) {
172
    private void save(String output) {
182
173
183
    	//if (bar.getFItems().size()==0)
174
    	//if (bar.getFItems().size()==0)
184
    		//return;
175
    		//return;
Lines 217-223 Link Here
217
    
208
    
218
    /*
209
    /*
219
     * Displays bar graph in window
210
     * Displays bar graph in window
220
     */
211
     *
221
    private void show(final BarGraph bar) {
212
    private void show(final BarGraph bar) {
222
        Display display= new Display();
213
        Display display= new Display();
223
        
214
        
Lines 246-249 Link Here
246
	public String getOutName() {
237
	public String getOutName() {
247
		return outName;
238
		return outName;
248
	}
239
	}
240
    */
241
242
	/**
243
	 * @return - an html representation of the fingerprint.
244
	 */
245
	public String getImageMap() {
246
		String componentDescription = this.configDescriptor.description;
247
		String areas = this.bar.getAreas();
248
		if (areas == null)
249
			areas = "";
250
		String output = "";
251
		if (new File(this.outputDirectory, this.outName + ".gif").exists()) {
252
			output = "<h4>" + componentDescription + "</h4>";
253
			output = output.concat("<img src=\"" + this.outName + ".gif\" usemap=\"#" + this.outName + "\">" + "<map name=\"" + this.outName + "\">" + areas + "</map>\n");
254
		} else {
255
			output = output.concat("<br><br>There is no fingerprint for " + componentDescription + "<br><br>\n");
256
		}
257
		return output;
258
	}
249
}
259
}
(-)src/org/eclipse/test/performance/ui/ScenarioResults.java (-2 / +1 lines)
Lines 15-21 Link Here
15
import java.io.FileNotFoundException;
15
import java.io.FileNotFoundException;
16
import java.io.FileOutputStream;
16
import java.io.FileOutputStream;
17
import java.io.PrintStream;
17
import java.io.PrintStream;
18
import java.text.NumberFormat;
19
import java.util.ArrayList;
18
import java.util.ArrayList;
20
import java.util.HashMap;
19
import java.util.HashMap;
21
import java.util.Hashtable;
20
import java.util.Hashtable;
Lines 48-54 Link Here
48
	 * 
47
	 * 
49
	 * @param scenarios -
48
	 * @param scenarios -
50
	 *            the array of Scenario objects for which to generate results.
49
	 *            the array of Scenario objects for which to generate results.
51
	 * @param reference -
50
	 * @param baseline -
52
	 *            the reference build ID
51
	 *            the reference build ID
53
	 * @param current -
52
	 * @param current -
54
	 *            the current buildID
53
	 *            the current buildID
(-)src/org/eclipse/test/performance/ui/Main.java (-13 / +31 lines)
Lines 25-30 Link Here
25
import org.eclipse.core.runtime.Platform;
25
import org.eclipse.core.runtime.Platform;
26
26
27
import org.eclipse.test.internal.performance.db.Scenario;
27
import org.eclipse.test.internal.performance.db.Scenario;
28
import org.eclipse.test.internal.performance.db.SummaryEntry;
28
import org.eclipse.test.internal.performance.db.Variations;
29
import org.eclipse.test.internal.performance.db.Variations;
29
import org.eclipse.test.performance.ui.Utils.ConfigDescriptor;
30
import org.eclipse.test.performance.ui.Utils.ConfigDescriptor;
30
31
Lines 48-61 Link Here
48
	private Hashtable fingerPrints = new Hashtable();
49
	private Hashtable fingerPrints = new Hashtable();
49
	private Hashtable scenarioComments=new Hashtable();
50
	private Hashtable scenarioComments=new Hashtable();
50
	private Hashtable rawDataTables=new Hashtable();
51
	private Hashtable rawDataTables=new Hashtable();
52
	private boolean local = false;
51
	
53
	
52
	public Object run(Object args) throws Exception {
54
	public Object run(Object args) throws Exception {
53
		parse(args);
55
		parse(args);
54
		
56
		
55
		Enumeration configIds=configDescriptors.keys();
57
		if (this.local) {
56
		
58
			int length = configNames.length;
57
		while (configIds.hasMoreElements()){
59
			for (int i=0; i<length; i++) {
58
			generate((ConfigDescriptor)configDescriptors.get(configIds.nextElement()));
60
				generate((ConfigDescriptor)configDescriptors.get(configNames[i]));
61
			}
62
		} else {
63
			Enumeration configIds=configDescriptors.keys();
64
			while (configIds.hasMoreElements()){
65
				generate((ConfigDescriptor)configDescriptors.get(configIds.nextElement()));
66
			}
59
		}
67
		}
60
68
61
		Utils.printVariabilityTable(rawDataTables,output+"/cvsummary.html",configDescriptors);
69
		Utils.printVariabilityTable(rawDataTables,output+"/cvsummary.html",configDescriptors);
Lines 87-93 Link Here
87
				os.println(Utils.HTML_DEFAULT_CSS);
95
				os.println(Utils.HTML_DEFAULT_CSS);
88
				os.println("<body>");
96
				os.println("<body>");
89
				Hashtable fps = (Hashtable) fingerPrints.get(component);
97
				Hashtable fps = (Hashtable) fingerPrints.get(component);
90
				Enumeration configs = fps.keys();
91
				
98
				
92
				int baselineUnderScoreIndex=baseline.indexOf("_");
99
				int baselineUnderScoreIndex=baseline.indexOf("_");
93
				int currentUnderScoreIndex=currentBuildId.indexOf("_");
100
				int currentUnderScoreIndex=currentBuildId.indexOf("_");
Lines 106-122 Link Here
106
				os.println(title);
113
				os.println(title);
107
				
114
				
108
				//print the html representation of fingerprint for each config 
115
				//print the html representation of fingerprint for each config 
116
				Enumeration configs = fps.keys();
117
				SummaryEntry[] fpSummaries = null;
109
				while (configs.hasMoreElements()) {
118
				while (configs.hasMoreElements()) {
110
					String config = configs.nextElement().toString();
119
					String config = configs.nextElement().toString();
111
					FingerPrint fp = (FingerPrint) fps.get(config);
120
					FingerPrint fingerPrint = (FingerPrint) fps.get(config);
112
					os.println(Utils.getImageMap(fp));
121
					os.println(fingerPrint.getImageMap());
122
					if (fpSummaries == null) {
123
						fpSummaries = fingerPrint.entries;
124
					}
113
				}
125
				}
114
				if (component != "") {
126
				if (component.length() > 0) {
115
				//print the component scenario status table beneath the fingerprint
127
				//print the component scenario status table beneath the fingerprint
116
					variations.put("config", "%");
128
					variations.put("config", "%");
117
					ScenarioStatusTable sst = new ScenarioStatusTable(variations, component + "%", configDescriptors,scenarioComments, baseline);
129
					boolean filter = this.local & this.scenarioFilter != null; // use scenario filter to minimize DB requests while testing...
118
//					ScenarioStatusTable sst = new ScenarioStatusTable(variations, this.scenarioFilter, configDescriptors,scenarioComments, baseline);
130
					ScenarioStatusTable sst = filter
119
					os.println(sst.toString());
131
						? new ScenarioStatusTable(variations, this.scenarioFilter, configDescriptors,scenarioComments, fpSummaries, baseline)
132
						: new ScenarioStatusTable(variations, component + "%", configDescriptors,scenarioComments, fpSummaries, baseline);
133
					sst.print(os, filter);
120
				}
134
				}
121
135
122
				os.println(Utils.HTML_CLOSE);
136
				os.println(Utils.HTML_CLOSE);
Lines 292-299 Link Here
292
					System.out.println("Missing value for -config.properties parameter");
306
					System.out.println("Missing value for -config.properties parameter");
293
					printUsage();
307
					printUsage();
294
				}
308
				}
295
				configDescriptors = Utils
309
				configDescriptors = Utils.getConfigDescriptors(configProperties);
296
						.getConfigDescriptors(configProperties);
297
				i++;
310
				i++;
298
				continue;
311
				continue;
299
			}
312
			}
Lines 318-323 Link Here
318
				i++;
331
				i++;
319
				continue;
332
				continue;
320
			}
333
			}
334
			if (arg.equals("-local")) {
335
				this.local  = true;
336
				i++;
337
				continue;
338
			}
321
339
322
			i++;
340
			i++;
323
		}
341
		}
(-)src/org/eclipse/test/performance/ui/messages.properties (+14 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2000, 2007 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
10
###############################################################################
11
12
### Performance Tests Messages.
13
14
standardError = Standard error on this test is {0} (should be less than {1} to become reliable!)
(-)src/org/eclipse/test/performance/ui/Messages.java (+75 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.test.performance.ui;
12
13
import java.text.MessageFormat;
14
15
import org.eclipse.osgi.util.NLS;
16
17
public class Messages extends NLS {
18
19
	private static final String BUNDLE_NAME = "org.eclipse.test.performance.ui.messages";//$NON-NLS-1$
20
21
	private Messages() {
22
		// Do not instantiate
23
	}
24
25
	public static String standardError;
26
27
	static {
28
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
29
	}
30
	
31
	/**
32
	 * Bind the given message's substitution locations with the given string values.
33
	 * 
34
	 * @param message the message to be manipulated
35
	 * @return the manipulated String
36
	 */
37
	public static String bind(String message) {
38
		return bind(message, null);
39
	}
40
	
41
	/**
42
	 * Bind the given message's substitution locations with the given string values.
43
	 * 
44
	 * @param message the message to be manipulated
45
	 * @param binding the object to be inserted into the message
46
	 * @return the manipulated String
47
	 */
48
	public static String bind(String message, Object binding) {
49
		return bind(message, new Object[] {binding});
50
	}
51
52
	/**
53
	 * Bind the given message's substitution locations with the given string values.
54
	 * 
55
	 * @param message the message to be manipulated
56
	 * @param binding1 An object to be inserted into the message
57
	 * @param binding2 A second object to be inserted into the message
58
	 * @return the manipulated String
59
	 */
60
	public static String bind(String message, Object binding1, Object binding2) {
61
		return bind(message, new Object[] {binding1, binding2});
62
	}
63
64
	/**
65
	 * Bind the given message's substitution locations with the given string values.
66
	 * 
67
	 * @param message the message to be manipulated
68
	 * @param bindings An array of objects to be inserted into the message
69
	 * @return the manipulated String
70
	 */
71
	public static String bind(String message, Object[] bindings) {
72
		return MessageFormat.format(message, bindings);
73
	}
74
75
}

Return to bug 185580