View | Details | Raw Unified | Return to bug 253757
Collapse All | Expand All

(-)src/org/eclipse/test/internal/performance/InternalPerformanceMeter.java (-2 / +26 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.test.internal.performance;
12
package org.eclipse.test.internal.performance;
13
13
14
import java.io.FileNotFoundException;
15
import java.io.FileOutputStream;
16
import java.io.IOException;
14
import java.io.PrintStream;
17
import java.io.PrintStream;
15
import java.text.MessageFormat;
18
import java.text.MessageFormat;
16
import java.text.NumberFormat;
19
import java.text.NumberFormat;
Lines 94-101 Link Here
94
			if (variations != null)
97
			if (variations != null)
95
				DB.store(variations, sample);
98
				DB.store(variations, sample);
96
			if (!DB.isActive() || System.getProperty(VERBOSE_PERFORMANCE_METER_PROPERTY) != null) {
99
			if (!DB.isActive() || System.getProperty(VERBOSE_PERFORMANCE_METER_PROPERTY) != null) {
97
				printSample(System.out, sample);
100
//				printSample(System.out, sample);
98
//				printSampleCSV(System.out, sample);
101
				FileOutputStream out = null;
102
				try {
103
					String filename = System.getProperty("user.dir")
104
							+ "/perf_run_"
105
							+ System.getProperty("perf.branch") + "_"
106
							+ PerformanceTestPlugin.getDefault().getQualifier()
107
							+ ".csv";
108
					out = new FileOutputStream(filename, true);
109
					printSampleCSV(new PrintStream(out), sample);
110
				} catch (FileNotFoundException e) {
111
					// TODO Auto-generated catch block
112
					e.printStackTrace();
113
				} finally {
114
					if (out!=null) {
115
						try {
116
							out.close();
117
						} catch (IOException e) {
118
							// TODO Auto-generated catch block
119
							e.printStackTrace();
120
						}
121
					}
122
				}
99
			}
123
			}
100
		}
124
		}
101
	}
125
	}
(-)src/org/eclipse/test/internal/performance/PerformanceTestPlugin.java (+14 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.test.internal.performance;
11
package org.eclipse.test.internal.performance;
12
12
13
import java.text.SimpleDateFormat;
14
import java.util.Date;
15
13
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.IStatus;
14
import org.eclipse.core.runtime.Plugin;
17
import org.eclipse.core.runtime.Plugin;
15
import org.eclipse.core.runtime.Status;
18
import org.eclipse.core.runtime.Status;
Lines 57-62 Link Here
57
	/* temporary code */
60
	/* temporary code */
58
	private static boolean fgOldDBInitialized;
61
	private static boolean fgOldDBInitialized;
59
	private static boolean fgOldDB;	// true if we are talking to the old perfDB in Ottawa
62
	private static boolean fgOldDB;	// true if we are talking to the old perfDB in Ottawa
63
	private String qualifier;
60
		
64
		
61
	/**
65
	/**
62
	 * The constructor.
66
	 * The constructor.
Lines 80-85 Link Here
80
		DB.shutdown();
84
		DB.shutdown();
81
		super.stop(context);
85
		super.stop(context);
82
	}
86
	}
87
	
88
	public void start(BundleContext context) throws Exception {
89
		super.start(context);
90
		SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
91
		qualifier = format.format(new Date());
92
	}
93
	
94
	public String getQualifier() {
95
		return qualifier;
96
	}
83
		
97
		
84
	/*
98
	/*
85
	 * Returns the shared instance.
99
	 * Returns the shared instance.
(-)GenHtml.launch (+13 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
3
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4
<listEntry value="/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/GenHtml.java"/>
5
</listAttribute>
6
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7
<listEntry value="1"/>
8
</listAttribute>
9
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.test.internal.performance.GenHtml"/>
10
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${file_prompt:baselineTSV} ${file_prompt:performanceRunTSV} ${system_property:user.dir}/perf_run${system_property:perf.branch}.html"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.test.performance"/>
12
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dperf.branch=350"/>
13
</launchConfiguration>
(-)src/org/eclipse/test/internal/performance/GenHtml.java (+147 lines)
Added Link Here
1
package org.eclipse.test.internal.performance;
2
3
import java.io.BufferedReader;
4
import java.io.FileReader;
5
import java.io.FileWriter;
6
import java.io.PrintWriter;
7
import java.util.Iterator;
8
import java.util.Map;
9
import java.util.TreeMap;
10
11
public class GenHtml {
12
	private Map perfBaseline;
13
	private Map perfRun;
14
	private DimHeaders header;
15
16
	static class DimHeaders {
17
		public DimHeaders(String systemTime, String elapsedTime,
18
				String scenarioName, String scenarioTest) {
19
			this.systemTime = systemTime;
20
			this.elapsedTime = elapsedTime;
21
			this.scenarioName = scenarioName;
22
			this.scenarioTest = scenarioTest;
23
		}
24
25
		String systemTime;
26
		String elapsedTime;
27
		String scenarioName;
28
		String scenarioTest;
29
	}
30
31
	static class Dim {
32
		public Dim(int s, int e, String sc) {
33
			systemTime = s;
34
			elapsedTime = e;
35
			scenario = sc;
36
		}
37
38
		int systemTime;
39
		int elapsedTime;
40
		String scenario;
41
	}
42
43
	/**
44
	 * @param args
45
	 */
46
	public static void main(String[] args) {
47
		if (args.length != 3) {
48
			System.out.println(GenHtml.class.getName()
49
					+ ": <baselineTSV> <latestTSV> <output.html>");
50
			return;
51
		}
52
		try {
53
			GenHtml html = new GenHtml();
54
			html.read(args);
55
			html.write(args);
56
		} catch (Exception e) {
57
			e.printStackTrace();
58
		}
59
	}
60
61
	public void write(String[] args) throws Exception {
62
		PrintWriter out = new PrintWriter(new FileWriter(args[2]));
63
		writeHeader(out, args[0], args[1]);
64
		Iterator tests = perfRun.keySet().iterator();
65
		while (tests.hasNext()) {
66
			String test = (String) tests.next();
67
			String[] testInfo = test.split("#");
68
			Dim d350 = (Dim) perfRun.get(test);
69
			Dim d33x = (Dim) perfBaseline.get(test);
70
			if (d350 == null || d33x == null) {
71
				continue;
72
			}
73
			int per = ((d33x.elapsedTime - d350.elapsedTime) * 100)
74
					/ d33x.elapsedTime;
75
			String colour = " bgcolor=\"#66FF00\"";
76
			if (per < -5) {
77
				colour = " bgcolor=\"#FF0033\"";
78
			} else if (per < 0) {
79
				colour = " bgcolor=\"#FFFF66\"";
80
			}
81
			out.print("<tr><td>");
82
			out.print(testInfo.length == 1 ? testInfo[0] : testInfo[1]);
83
			out.print("</td><td align=\"right\">" + d33x.elapsedTime
84
					+ "</td><td align=\"right\">" + d350.elapsedTime
85
					+ "</td><td align=\"right\"" + colour + ">" + per
86
					+ "%</td><td>");
87
			out.print(testInfo.length == 1 ? "Not Specified" : testInfo[0]);
88
			out.println("</td></tr>");
89
		}
90
		writeFooter(out);
91
		out.close();
92
93
	}
94
95
	private void writeFooter(PrintWriter out) {
96
		out.println("</table>\n\n</body></html>");
97
	}
98
99
	public void read(String[] args) throws Exception {
100
		perfBaseline = load(args[0]);
101
		perfRun = load(args[1]);
102
	}
103
104
	private void writeHeader(PrintWriter out, String baseline, String run) {
105
		out.print("<html>\n<head>\n<title>");
106
		out.print(baseline);
107
		out.print(" vs ");
108
		out.print(run);
109
		out.print("</title>\n</head>\n<body>\n<h1>");
110
		out.print(baseline);
111
		out.print(" vs ");
112
		out.print(run);
113
		out.print("</h1>\n<table border=\"1\"><tr><th>");
114
		out.print(header.scenarioName);
115
		out.print("</th>\n<th>");
116
		out.print(header.elapsedTime + " baseline");
117
		out.print("</th>\n<th>");
118
		out.print(header.elapsedTime + " run");
119
		out.print("</th>\n<th>");
120
		out.print(header.elapsedTime + " %");
121
		out.print("</th>\n<th>");
122
		out.print(header.scenarioTest);
123
		out.print("</th>\n</tr>");
124
	}
125
126
	public Map load(String filename) throws Exception {
127
		TreeMap testMap = new TreeMap();
128
		BufferedReader perfReader = new BufferedReader(new FileReader(filename));
129
		String line;
130
		while ((line = perfReader.readLine()) != null) {
131
			String[] columns = line.split("\t");
132
			if (columns.length > 11) {
133
				if ("System Time".equals(columns[0])) {
134
					if (header == null) {
135
						header = new DimHeaders(columns[0], columns[3],
136
								"Scenario Name", "Scenario Test");
137
					}
138
					continue;
139
				}
140
				Dim d = new Dim(Integer.parseInt(columns[0]), Integer
141
						.parseInt(columns[3]), columns[11]);
142
				testMap.put(d.scenario, d);
143
			}
144
		}
145
		return testMap;
146
	}
147
}
(-)UIPerformanceTestSuite.launch (+37 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
3
<booleanAttribute key="append.args" value="true"/>
4
<booleanAttribute key="askclear" value="false"/>
5
<booleanAttribute key="automaticAdd" value="true"/>
6
<booleanAttribute key="automaticValidate" value="false"/>
7
<stringAttribute key="bootstrap" value=""/>
8
<booleanAttribute key="clearConfig" value="true"/>
9
<booleanAttribute key="clearws" value="true"/>
10
<booleanAttribute key="clearwslog" value="false"/>
11
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
12
<booleanAttribute key="default" value="true"/>
13
<booleanAttribute key="includeOptional" value="true"/>
14
<stringAttribute key="location" value="${workspace_loc}/../UIPerformanceTestSuite-workspace"/>
15
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
16
<listEntry value="/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/UIPerformanceTestSuite.java"/>
17
</listAttribute>
18
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
19
<listEntry value="1"/>
20
</listAttribute>
21
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
22
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
23
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
24
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
25
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ui.tests.performance.UIPerformanceTestSuite"/>
26
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
27
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.ui.tests.performance"/>
28
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
29
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dperf.branch=350"/>
30
<stringAttribute key="pde.version" value="3.3"/>
31
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
32
<booleanAttribute key="show_selected_only" value="false"/>
33
<booleanAttribute key="tracing" value="false"/>
34
<booleanAttribute key="useDefaultConfig" value="true"/>
35
<booleanAttribute key="useDefaultConfigArea" value="false"/>
36
<booleanAttribute key="useProduct" value="true"/>
37
</launchConfiguration>

Return to bug 253757