Lines 10-441
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.test.performance.ui; |
11 |
package org.eclipse.test.performance.ui; |
12 |
|
12 |
|
13 |
import java.io.File; |
13 |
import java.io.*; |
14 |
import java.io.FileOutputStream; |
|
|
15 |
import java.io.PrintStream; |
16 |
import java.net.URL; |
14 |
import java.net.URL; |
17 |
import java.util.ArrayList; |
15 |
import java.util.*; |
18 |
import java.util.Arrays; |
|
|
19 |
import java.util.Enumeration; |
20 |
import java.util.Hashtable; |
21 |
|
16 |
|
|
|
17 |
import org.eclipse.core.runtime.FileLocator; |
18 |
import org.eclipse.equinox.app.IApplication; |
19 |
import org.eclipse.equinox.app.IApplicationContext; |
20 |
import org.eclipse.test.internal.performance.PerformanceTestPlugin; |
21 |
import org.eclipse.test.internal.performance.results.AbstractResults; |
22 |
import org.eclipse.test.internal.performance.results.ConfigResults; |
23 |
import org.eclipse.test.internal.performance.results.DB_Results; |
24 |
import org.eclipse.test.internal.performance.results.PerformanceResults; |
25 |
import org.eclipse.test.internal.performance.results.ScenarioResults; |
22 |
import org.osgi.framework.Bundle; |
26 |
import org.osgi.framework.Bundle; |
23 |
|
27 |
|
24 |
import org.eclipse.core.runtime.IPlatformRunnable; |
28 |
/** |
25 |
import org.eclipse.core.runtime.Platform; |
29 |
* Main class to generate performance results of all scenarii matching a given pattern |
26 |
|
30 |
* in one HTML page per component. |
27 |
import org.eclipse.test.internal.performance.db.Scenario; |
31 |
* |
28 |
import org.eclipse.test.internal.performance.db.SummaryEntry; |
32 |
* @see #printUsage() method to see a detailed parameters usage |
29 |
import org.eclipse.test.internal.performance.db.Variations; |
33 |
*/ |
30 |
import org.eclipse.test.performance.ui.Utils.ConfigDescriptor; |
34 |
public class Main implements IApplication { |
31 |
|
35 |
|
32 |
public class Main implements IPlatformRunnable{ |
36 |
/** |
33 |
|
37 |
* Prefix of baseline builds displayed in data graphs. |
34 |
private String baseline; |
38 |
* This field is set using <b>-baselinePrefix</b> argument. |
35 |
private String baselinePrefix=null; |
39 |
* <p> |
36 |
private String output; |
40 |
* Example: |
37 |
private String[] configNames; |
41 |
* <pre>-baseline.prefix 3.2_200606291905</pre> |
38 |
private Hashtable configDescriptors; |
42 |
* |
39 |
private String currentBuildId; |
43 |
* @see #currentBuildPrefixes |
40 |
private ArrayList currentBuildStreamIdPrefixes; |
44 |
*/ |
41 |
private ArrayList pointsOfInterest; |
45 |
private String baselinePrefix = null; |
42 |
private Variations variations; |
46 |
|
43 |
private Scenario[] scenarios; |
47 |
/** |
44 |
private String jvm; |
48 |
* Root directory where all files are generated. |
45 |
private String scenarioFilter; |
49 |
* This field is set using <b>-output</b> argument. |
46 |
private boolean genFingerPrints = false; |
50 |
* <p> |
47 |
private boolean genScenarioSummaries =false; |
51 |
* Example: |
48 |
private boolean genAll = true; |
52 |
* <pre>-output /releng/results/I20070615-1200/performance</pre> |
49 |
private Hashtable fingerPrints = new Hashtable(); |
53 |
*/ |
50 |
private Hashtable scenarioComments=new Hashtable(); |
54 |
private File outputDir; |
51 |
private Hashtable rawDataTables=new Hashtable(); |
55 |
|
52 |
private boolean local = false; |
56 |
/** |
53 |
|
57 |
* Arrays of 2 strings which contains config information: name and description. |
54 |
public Object run(Object args) throws Exception { |
58 |
* This field is set using <b>-config</b> and/or <b>-config.properties</b> arguments. |
55 |
parse(args); |
59 |
* <p> |
56 |
|
60 |
* Example: |
57 |
try { |
61 |
* <pre> |
58 |
if (this.local) { |
62 |
* -config eclipseperflnx3_R3.3,eclipseperfwin2_R3.3,eclipseperflnx2_R3.3,eclipseperfwin1_R3.3,eclipseperflnx1_R3.3 |
59 |
int length = configNames.length; |
63 |
* -config.properties |
60 |
for (int i=0; i<length; i++) { |
64 |
* "eclipseperfwin1_R3.3,Win XP Sun 1.4.2_08 (2 GHz 512 MB); |
61 |
generate((ConfigDescriptor)configDescriptors.get(configNames[i])); |
65 |
* eclipseperflnx1_R3.3,RHEL 3.0 Sun 1.4.2_08 (2 GHz 512 MB); |
62 |
} |
66 |
* eclipseperfwin2_R3.3,Win XP Sun 1.4.2_08 (3 GHz 2 GB); |
63 |
} else { |
67 |
* eclipseperflnx2_R3.3,RHEL 3.0 Sun 1.4.2_08 (3 GHz 2 GB); |
64 |
Enumeration configIds=configDescriptors.keys(); |
68 |
* eclipseperflnx3_R3.3,RHEL 4.0 Sun 1.4.2_08 (3 GHz 2.5 GB)" |
65 |
while (configIds.hasMoreElements()){ |
69 |
* </pre> |
66 |
generate((ConfigDescriptor)configDescriptors.get(configIds.nextElement())); |
70 |
* Note that: |
67 |
} |
71 |
* <ul> |
68 |
} |
72 |
* <li>if only <b>-config</b> is set, then configuration name is used for description </li> |
69 |
|
73 |
* <li>if only <b>-config.properties</b> is set, then all configurations defined with this argument are generated |
70 |
Utils.printVariabilityTable(rawDataTables,output+"/cvsummary.html",configDescriptors); |
74 |
* <li>if both arguments are defined, then only configurations defined by <b>-config</b> argument are generated, |
71 |
|
75 |
* <b>-config.properties</b> argument is only used to set the configuration description.</li> |
72 |
Enumeration components = fingerPrints.keys(); |
76 |
* </ul> |
73 |
Bundle bundle= UiPlugin.getDefault().getBundle(); |
77 |
*/ |
74 |
URL images=bundle.getEntry("images"); |
78 |
private String[][] configDescriptors; |
75 |
URL scripts=bundle.getEntry("scripts"); |
79 |
|
76 |
|
80 |
/** |
77 |
if (images!=null) { |
81 |
* Scenario pattern used to generate performance results. |
78 |
images= Platform.resolve(images); |
82 |
* This field is set using <b>-scenarioPattern</b> argument. |
79 |
Utils.copyImages(new File(images.getPath()), new File(output)); |
83 |
* <p> |
80 |
} |
84 |
* Note that this pattern uses SQL conventions, not RegEx ones, |
81 |
if (scripts!=null){ |
85 |
* which means that '%' is used to match several consecutive characters |
82 |
scripts= Platform.resolve(scripts); |
86 |
* and '_' to match a single character. |
83 |
Utils.copyScripts(new File(scripts.getPath()), new File(output)); |
87 |
* <p> |
84 |
} |
88 |
* Example: |
85 |
|
89 |
* <pre>-scenario.pattern org.eclipse.%.test</pre> |
86 |
// print fingerprint/scenario status pages |
90 |
*/ |
87 |
while (components.hasMoreElements()) { |
91 |
private String scenarioPattern; |
88 |
String component = components.nextElement().toString(); |
92 |
|
89 |
File outputFile = new File(output, component + ".php"); |
93 |
/** |
90 |
outputFile.getParentFile().mkdirs(); |
94 |
* A list of prefixes for builds displayed in data graphs. |
91 |
PrintStream os = new PrintStream(new FileOutputStream(outputFile)); |
95 |
* This field is set using <b>-currentPrefix</b> argument. |
92 |
os.println(Utils.HTML_OPEN); |
96 |
* <p> |
93 |
os.println("<link href=\"ToolTip.css\" rel=\"stylesheet\" type=\"text/css\">"+ |
97 |
* Example: |
94 |
"<script src=\"ToolTip.js\"></script>"); |
98 |
* <pre>-current.prefix N, I</pre> |
95 |
os.println(Utils.HTML_DEFAULT_CSS); |
99 |
* |
96 |
os.println("<body>"); |
100 |
* @see #baselinePrefix |
97 |
Hashtable fps = (Hashtable) fingerPrints.get(component); |
101 |
*/ |
98 |
|
102 |
private List currentBuildPrefixes; |
99 |
int baselineUnderScoreIndex=baseline.indexOf("_"); |
103 |
|
100 |
int currentUnderScoreIndex=currentBuildId.indexOf("_"); |
104 |
/** |
101 |
|
105 |
* A list of prefixes of builds to highlight in displayed data graphs. |
102 |
String baselineName=(baselineUnderScoreIndex!=-1)?baseline.substring(0, baseline.indexOf("_")):baseline; |
106 |
* This field is set using <b>-highlight</b> and/or <b>-highlight.latest</b> arguments. |
103 |
String currentName=(currentUnderScoreIndex!=-1)?currentBuildId.substring(0, currentBuildId.indexOf("_")):currentBuildId; |
107 |
* <p> |
104 |
boolean isGlobal = component.equals("global"); |
108 |
* Example: |
105 |
StringBuffer title = new StringBuffer("<h3>Performance of "); |
109 |
* <pre>-higlight 3_2</pre> |
106 |
if (!isGlobal) { |
110 |
*/ |
107 |
title.append(component); |
111 |
private List pointsOfInterest; |
108 |
title.append(": "); |
112 |
|
109 |
} |
113 |
/** |
110 |
title.append(currentName); |
114 |
* Tells whether only fingerprints has to be generated. |
111 |
title.append(" relative to "); |
115 |
* This field is set to <code>true</code> if <b>-fingerprints</b> argument is specified. |
112 |
title.append(baselineName); |
116 |
* <p> |
113 |
title.append( "</h3>"); |
117 |
* Default is <code>false</code> which means that scenario data |
114 |
os.println(title.toString()); |
118 |
* will also be generated. |
115 |
|
119 |
* |
116 |
//print the html representation of fingerprint for each config |
120 |
* @see #genData |
117 |
Enumeration configs = fps.keys(); |
121 |
* @see #genAll |
118 |
SummaryEntry[] fpSummaries = null; |
122 |
*/ |
119 |
while (configs.hasMoreElements()) { |
123 |
private boolean genFingerPrints = false; |
120 |
String config = configs.nextElement().toString(); |
124 |
|
121 |
FingerPrint fingerPrint = (FingerPrint) fps.get(config); |
125 |
/** |
122 |
os.println(fingerPrint.getImageMap()); |
126 |
* Tells whether only fingerprints has to be generated. |
123 |
if (fpSummaries == null) { |
127 |
* This field is set to <code>true</code> if <b>-data</b> argument is specified. |
124 |
fpSummaries = fingerPrint.entries; |
128 |
* <p> |
125 |
} |
129 |
* Default is <code>false</code> which means that fingerprints |
126 |
} |
130 |
* will also be generated. |
127 |
if (isGlobal) { |
131 |
* |
128 |
if (this.local) { |
132 |
* @see #genFingerPrints |
129 |
os.println("<table border=0 cellpadding=2 cellspacing=5 width=\"100%\">"); |
133 |
* @see #genAll |
130 |
os.println("<tbody><tr> <td colspan=3 align=\"left\" bgcolor=\"#0080c0\" valign=\"top\"><b><font color=\"#ffffff\" face=\"Arial,Helvetica\">"); |
134 |
*/ |
131 |
os.println("Detailed performance data grouped by scenario prefix</font></b></td></tr></tbody></table>"); |
135 |
private boolean genData = false; |
132 |
os.println("<a href=\"org.eclipse.ant.php?\">org.eclipse.ant*</a><br>"); |
136 |
|
133 |
os.println("<a href=\"org.eclipse.compare.php?\">org.eclipse.compare*</a><br>"); |
137 |
/** |
134 |
os.println("<a href=\"org.eclipse.core.php?\">org.eclipse.core*</a><br>"); |
138 |
* Tells whether only fingerprints has to be generated. |
135 |
os.println("<a href=\"org.eclipse.help.php?\">org.eclipse.help*</a><br>"); |
139 |
* This field is set to <code>false</code> |
136 |
os.println("<a href=\"org.eclipse.jdt.core.php?\">org.eclipse.jdt.core*</a><br>"); |
140 |
* if <b>-fingerprints</b> or <b>-data</b> argument is specified. |
137 |
os.println("<a href=\"org.eclipse.jdt.debug.php?\">org.eclipse.jdt.debug*</a><br>"); |
141 |
* <p> |
138 |
os.println("<a href=\"org.eclipse.jdt.text.php?\">org.eclipse.jdt.text*</a><br>"); |
142 |
* Default is <code>true</code> which means that scenario data |
139 |
os.println("<a href=\"org.eclipse.jdt.ui.php?\">org.eclipse.jdt.ui*</a><br>"); |
143 |
* will also be generated. |
140 |
os.println("<a href=\"org.eclipse.jface.php?\">org.eclipse.jface*</a><br>"); |
144 |
* |
141 |
os.println("<a href=\"org.eclipse.osgi.php?\">org.eclipse.osgi*</a><br>"); |
145 |
* @see #genData |
142 |
os.println("<a href=\"org.eclipse.pde.ui.php?\">org.eclipse.pde.ui*</a><br>"); |
146 |
* @see #genFingerPrints |
143 |
os.println("<a href=\"org.eclipse.swt.php?\">org.eclipse.swt*</a><br>"); |
147 |
*/ |
144 |
os.println("<a href=\"org.eclipse.team.php?\">org.eclipse.team*</a><br>"); |
148 |
private boolean genAll = true; |
145 |
os.println("<a href=\"org.eclipse.ua.php?\">org.eclipse.ua*</a><br>"); |
149 |
|
146 |
os.println("<a href=\"org.eclipse.ui.php?\">org.eclipse.ui*</a><br><p><br><br>"); |
150 |
/** |
147 |
} |
151 |
* Tells whether information should be displayed in the console while generating. |
148 |
} else if (component.length() > 0) { |
152 |
* This field is set to <code>true</code> if <b>-print</b> argument is specified. |
149 |
// print the component scenario status table beneath the fingerprint |
153 |
* <p> |
150 |
variations.put("config", "%"); |
154 |
* Default is <code>false</code> which means that nothing is print during the generation. |
151 |
boolean filter = this.local && this.scenarioFilter != null; // use scenario filter to minimize DB requests while testing... |
155 |
*/ |
152 |
ScenarioStatusTable sst = filter |
156 |
private boolean print = false; |
153 |
? new ScenarioStatusTable(variations, this.scenarioFilter, configDescriptors,scenarioComments, fpSummaries, baseline) |
157 |
|
154 |
: new ScenarioStatusTable(variations, component + "%", configDescriptors,scenarioComments, fpSummaries, baseline); |
158 |
/* |
155 |
sst.print(os, filter); |
159 |
* Parse the command arguments and create corresponding performance |
156 |
} |
160 |
* results object. |
|
|
161 |
*/ |
162 |
private PerformanceResults parse(Object argsObject) { |
163 |
StringBuffer buffer = new StringBuffer("Parameters used to generate performance results:\n"); |
164 |
String[] args = (String[]) argsObject; |
165 |
int i = 0; |
166 |
if (args.length == 0) { |
167 |
printUsage(); |
168 |
} |
157 |
|
169 |
|
158 |
os.println(Utils.HTML_CLOSE); |
170 |
String currentBuildId = null; |
159 |
os.close(); |
171 |
String baseline = null; |
|
|
172 |
String jvm = null; |
173 |
this.configDescriptors = null; |
174 |
|
175 |
while (i < args.length) { |
176 |
String arg = args[i]; |
177 |
if (!arg.startsWith("-")) { |
178 |
i++; |
179 |
continue; |
180 |
} |
181 |
if (args.length == i + 1 && i != args.length - 1) { |
182 |
System.out.println("Missing value for last parameter"); |
183 |
printUsage(); |
184 |
} |
185 |
if (arg.equals("-baseline")) { |
186 |
baseline = args[i + 1]; |
187 |
if (baseline.startsWith("-")) { |
188 |
System.out.println("Missing value for -baseline parameter"); |
189 |
printUsage(); |
160 |
} |
190 |
} |
161 |
} catch (Exception e) { |
191 |
buffer.append(" -baseline = "+baseline+'\n'); |
162 |
// Need to print any unexpected exception otherwise the failure will be completely silent... |
192 |
i++; |
163 |
e.printStackTrace(); |
193 |
continue; |
164 |
} |
194 |
} |
165 |
|
195 |
if (arg.equals("-baseline.prefix")) { |
166 |
return null; |
196 |
this.baselinePrefix = args[i + 1]; |
167 |
} |
197 |
if (this.baselinePrefix.startsWith("-")) { |
168 |
|
198 |
System.out.println("Missing value for -baseline.prefix parameter"); |
169 |
|
199 |
printUsage(); |
170 |
private void generate(Utils.ConfigDescriptor cd) { |
|
|
171 |
//String config=cd.getName(); |
172 |
String dbloc_property= System.getProperty("eclipse.perf.dbloc"); |
173 |
if (dbloc_property == null || dbloc_property.equals("")) |
174 |
System.out.println("WARNING: eclipse.perf.dbloc value set to null"); |
175 |
scenarios = Utils.getScenarios("%", scenarioFilter, cd.name, jvm); |
176 |
variations = Utils.getVariations("%", cd.name, jvm); |
177 |
|
178 |
//creates and stores fingerprint objects |
179 |
if (genFingerPrints || genAll) { |
180 |
System.out.print(cd.name + ": generating fingerprints and scenario status tables..."); |
181 |
|
182 |
//global |
183 |
FingerPrint global = new FingerPrint(null, cd, baseline, currentBuildId, variations, output); |
184 |
|
185 |
//store mappings of fingerprints per config for each component |
186 |
Hashtable t; |
187 |
if (fingerPrints.get("global") != null) |
188 |
t = (Hashtable) fingerPrints.get("global"); |
189 |
else |
190 |
t = new Hashtable(); |
191 |
|
192 |
t.put(cd.name, global); |
193 |
fingerPrints.put("global", t); |
194 |
|
195 |
//get unique component names from scenario names |
196 |
ArrayList components = Utils.getComponentNames(scenarios); |
197 |
|
198 |
//store fingerprints for config for each component |
199 |
for (int i = 0; i < components.size(); i++) { |
200 |
String component = components.get(i).toString(); |
201 |
variations.put("config", cd.name); |
202 |
FingerPrint componentFp = new FingerPrint(component, cd, baseline, currentBuildId, variations, output); |
203 |
if (fingerPrints.get(component) != null) |
204 |
t = (Hashtable) fingerPrints.get(component); |
205 |
else |
206 |
t = new Hashtable(); |
207 |
t.put(cd.name, componentFp); |
208 |
fingerPrints.put(component, t); |
209 |
if (componentFp.scenarioComments!=null) |
210 |
scenarioComments.putAll(componentFp.scenarioComments); |
211 |
} |
212 |
System.out.println("done."); |
213 |
} |
200 |
} |
214 |
|
201 |
buffer.append(" -baselinePrefix = "+this.baselinePrefix+'\n'); |
215 |
//generates scenario result pages and line graphs |
202 |
i++; |
216 |
if (genScenarioSummaries || genAll) { |
203 |
continue; |
217 |
System.out.print(cd.name |
|
|
218 |
+ ": generating scenario results..."); |
219 |
new ScenarioResults(cd,scenarios, baseline,baselinePrefix,currentBuildId,pointsOfInterest,scenarioComments,currentBuildStreamIdPrefixes,rawDataTables,output,variations); |
220 |
System.out.println("done."); |
221 |
} |
222 |
} |
223 |
|
224 |
|
225 |
private void parse(Object argsObject) { |
226 |
String []args=(String[])argsObject; |
227 |
int i = 0; |
228 |
if (args.length == 0) { |
229 |
printUsage(); |
230 |
} |
204 |
} |
231 |
|
205 |
if (arg.equals("-current.prefix")) { |
232 |
while (i < args.length) { |
206 |
String idPrefixList = args[i + 1]; |
233 |
String arg = args[i]; |
207 |
if (idPrefixList.startsWith("-")) { |
234 |
if (!arg.startsWith("-")){ |
208 |
System.out.println("Missing value for -current.prefix parameter"); |
235 |
i++; |
|
|
236 |
continue; |
237 |
} |
238 |
if (args.length==i+1&&i!=args.length-1){ |
239 |
System.out.println("Missing value for last parameter"); |
240 |
printUsage(); |
209 |
printUsage(); |
241 |
} |
210 |
} |
242 |
if (arg.equals("-baseline")) { |
211 |
buffer.append(" -current.prefix = "); |
243 |
baseline = args[i + 1]; |
212 |
String[] ids = idPrefixList.split(","); |
244 |
if (baseline.startsWith("-")) { |
213 |
this.currentBuildPrefixes = new ArrayList(); |
245 |
System.out.println("Missing value for -baseline parameter"); |
214 |
for (int j = 0; j < ids.length; j++) { |
246 |
printUsage(); |
215 |
this.currentBuildPrefixes.add(ids[j]); |
247 |
} |
216 |
buffer.append(ids[j]); |
248 |
i++; |
|
|
249 |
continue; |
250 |
} |
217 |
} |
251 |
if (arg.equals("-baseline.prefix")) { |
218 |
buffer.append('\n'); |
252 |
baselinePrefix = args[i + 1]; |
219 |
i++; |
253 |
if (baselinePrefix.startsWith("-")) { |
220 |
continue; |
254 |
System.out.println("Missing value for -baseline.prefix parameter"); |
221 |
} |
255 |
printUsage(); |
222 |
if (arg.equals("-highlight") || arg.equals("-highlight.latest")) { |
256 |
} |
223 |
if (args[i + 1].startsWith("-")) { |
257 |
i++; |
224 |
System.out.println("Missing value for -highlight parameter"); |
258 |
continue; |
225 |
printUsage(); |
259 |
} |
226 |
} |
260 |
if (arg.equals("-current.prefix")) { |
227 |
buffer.append(" "+arg+" = "); |
261 |
String idPrefixList=args[i + 1]; |
228 |
String[] ids = args[i + 1].split(","); |
262 |
if (idPrefixList.startsWith("-")) { |
229 |
this.pointsOfInterest = new ArrayList(); |
263 |
System.out.println("Missing value for -current.prefix parameter"); |
230 |
for (int j = 0; j < ids.length; j++) { |
264 |
printUsage(); |
231 |
this.pointsOfInterest.add(ids[j]); |
265 |
} |
232 |
buffer.append(ids[j]); |
266 |
String []ids=idPrefixList.split(","); |
|
|
267 |
currentBuildStreamIdPrefixes=new ArrayList(); |
268 |
for (int j=0;j<ids.length;j++){ |
269 |
currentBuildStreamIdPrefixes.add(ids[j]); |
270 |
} |
271 |
i++; |
272 |
continue; |
273 |
} |
233 |
} |
274 |
if (arg.equals("-highlight")||arg.equals("-highlight.latest")) { |
234 |
buffer.append('\n'); |
275 |
if (args[i + 1].startsWith("-")) { |
235 |
i++; |
276 |
System.out.println("Missing value for -highlight parameter"); |
236 |
continue; |
277 |
printUsage(); |
237 |
} |
278 |
} |
238 |
if (arg.equals("-current")) { |
279 |
String []ids=args[i + 1].split(","); |
239 |
currentBuildId = args[i + 1]; |
280 |
pointsOfInterest=new ArrayList(); |
240 |
if (currentBuildId.startsWith("-")) { |
281 |
for (int j=0;j<ids.length;j++){ |
241 |
System.out.println("Missing value for -current parameter"); |
282 |
pointsOfInterest.add(ids[j]); |
242 |
printUsage(); |
283 |
} |
|
|
284 |
i++; |
285 |
continue; |
286 |
} |
243 |
} |
287 |
if (arg.equals("-current")) { |
244 |
buffer.append(" -current = "+currentBuildId+'\n'); |
288 |
currentBuildId = args[i + 1]; |
245 |
i++; |
289 |
if (currentBuildId.startsWith("-")) { |
246 |
continue; |
290 |
System.out.println("Missing value for -current parameter"); |
247 |
} |
291 |
printUsage(); |
248 |
if (arg.equals("-jvm")) { |
292 |
} |
249 |
jvm = args[i + 1]; |
293 |
i++; |
250 |
if (jvm.startsWith("-")) { |
294 |
continue; |
251 |
System.out.println("Missing value for -jvm parameter"); |
|
|
252 |
printUsage(); |
295 |
} |
253 |
} |
296 |
if (arg.equals("-jvm")) { |
254 |
buffer.append(" -jvm = "+jvm+'\n'); |
297 |
jvm = args[i + 1]; |
255 |
i++; |
298 |
if (jvm.startsWith("-")) { |
256 |
continue; |
299 |
System.out.println("Missing value for -jvm parameter"); |
257 |
} |
300 |
printUsage(); |
258 |
if (arg.equals("-output")) { |
301 |
} |
259 |
String dir = args[++i]; |
302 |
i++; |
260 |
if (dir.startsWith("-")) { |
303 |
continue; |
261 |
System.out.println("Missing value for -output parameter"); |
|
|
262 |
printUsage(); |
304 |
} |
263 |
} |
305 |
if (arg.equals("-output")) { |
264 |
this.outputDir = new File(dir); |
306 |
output = args[i + 1]; |
265 |
if (!this.outputDir.exists() && !this.outputDir.mkdirs()) { |
307 |
if (output.startsWith("-")) { |
266 |
System.err.println("Cannot create directory "+dir+" to write results in!"); |
308 |
System.out.println("Missing value for -output parameter"); |
267 |
System.exit(2); |
309 |
printUsage(); |
|
|
310 |
} |
311 |
i++; |
312 |
continue; |
313 |
} |
268 |
} |
314 |
if (arg.equals("-config")) { |
269 |
buffer.append(" -output = "+dir+'\n'); |
315 |
String configs = args[i + 1]; |
270 |
continue; |
316 |
if (configs.startsWith("-")) { |
271 |
} |
317 |
System.out.println("Missing value for -config parameter"); |
272 |
if (arg.equals("-config")) { |
318 |
printUsage(); |
273 |
String configs = args[i + 1]; |
319 |
} |
274 |
if (configs.startsWith("-")) { |
320 |
configNames = configs.split(","); |
275 |
System.out.println("Missing value for -config parameter"); |
321 |
Arrays.sort(configNames); |
276 |
printUsage(); |
322 |
i++; |
277 |
} |
323 |
continue; |
278 |
String[] names = configs.split(","); |
324 |
} |
279 |
int length = names.length; |
325 |
if (arg.equals("-config.properties")) { |
280 |
buffer.append(" -config = "); |
326 |
String configProperties = args[i + 1]; |
281 |
for (int j=0; j<length; j++) { |
327 |
if (configProperties.startsWith("-")) { |
282 |
if (j>0) buffer.append(','); |
328 |
System.out.println("Missing value for -config.properties parameter"); |
283 |
buffer.append(names[j]); |
329 |
printUsage(); |
284 |
} |
|
|
285 |
if (this.configDescriptors == null) { |
286 |
this.configDescriptors = new String[length][2]; |
287 |
for (int j=0; j<length; j++) { |
288 |
this.configDescriptors[j][0] = names[j]; |
289 |
this.configDescriptors[j][1] = names[j]; |
330 |
} |
290 |
} |
331 |
configDescriptors = Utils.getConfigDescriptors(configProperties); |
291 |
} else { |
332 |
i++; |
292 |
int confLength = this.configDescriptors[0].length; |
333 |
continue; |
293 |
int newLength = confLength; |
334 |
} |
294 |
mainLoop: for (int j=0; j<confLength; j++) { |
335 |
if (arg.equals("-scenario.filter")||arg.equals("-scenario.pattern")) { |
295 |
for (int k=0; k<length; k++) { |
336 |
scenarioFilter = args[i + 1]; |
296 |
if (this.configDescriptors[j][0].equals(names[k])) { |
337 |
if (scenarioFilter.startsWith("-")) { |
297 |
continue mainLoop; |
338 |
System.out.println("Missing value for -baseline parameter"); |
298 |
} |
339 |
printUsage(); |
299 |
} |
|
|
300 |
this.configDescriptors[j][0] = null; |
301 |
this.configDescriptors[j][1] = null; |
302 |
newLength--; |
303 |
} |
304 |
if (newLength < confLength) { |
305 |
String[][] newDescriptors = new String[newLength][2]; |
306 |
for (int j=0, c=0; j<newLength; j++) { |
307 |
if (this.configDescriptors[c] != null) { |
308 |
newDescriptors[j][0] = this.configDescriptors[c][0]; |
309 |
newDescriptors[j][1] = this.configDescriptors[c][1]; |
310 |
} else { |
311 |
c++; |
312 |
} |
313 |
} |
314 |
this.configDescriptors = newDescriptors; |
340 |
} |
315 |
} |
341 |
i++; |
|
|
342 |
continue; |
343 |
} |
316 |
} |
344 |
if (arg.equals("-fingerprints")) { |
317 |
buffer.append('\n'); |
345 |
genFingerPrints = true; |
318 |
i++; |
346 |
genAll = false; |
319 |
continue; |
347 |
i++; |
320 |
} |
348 |
continue; |
321 |
if (arg.equals("-config.properties")) { |
|
|
322 |
String configProperties = args[i + 1]; |
323 |
if (configProperties.startsWith("-")) { |
324 |
System.out.println("Missing value for -config.properties parameter"); |
325 |
printUsage(); |
349 |
} |
326 |
} |
350 |
if (arg.equals("-scenarioresults")) { |
327 |
if (this.configDescriptors == null) { |
351 |
genScenarioSummaries = true; |
328 |
System.out.println("Missing -config parameter"); |
352 |
genAll = false; |
329 |
printUsage(); |
353 |
i++; |
|
|
354 |
continue; |
355 |
} |
330 |
} |
356 |
if (arg.equals("-local")) { |
331 |
int length = this.configDescriptors.length; |
357 |
this.local = true; |
332 |
StringTokenizer tokenizer = new StringTokenizer(configProperties, ";"); |
358 |
i++; |
333 |
buffer.append(" -config.properties = "); |
359 |
continue; |
334 |
while (tokenizer.hasMoreTokens()) { |
|
|
335 |
String labelDescriptor = tokenizer.nextToken(); |
336 |
String[] elements = labelDescriptor.trim().split(","); |
337 |
for (int j=0; j<length; j++) { |
338 |
if (elements[0].equals(this.configDescriptors[j][0])) { |
339 |
this.configDescriptors[j][1] = elements[1]; |
340 |
buffer.append("\n\t\t+ "); |
341 |
buffer.append(elements[0]); |
342 |
buffer.append(" -> "); |
343 |
buffer.append(elements[1]); |
344 |
} |
345 |
} |
360 |
} |
346 |
} |
361 |
|
347 |
buffer.append('\n'); |
362 |
i++; |
348 |
i++; |
|
|
349 |
continue; |
363 |
} |
350 |
} |
364 |
if (baseline == null || output == null || configNames == null |
351 |
if (arg.equals("-scenario.filter") || arg.equals("-scenario.pattern")) { |
365 |
|| jvm == null |
352 |
this.scenarioPattern= args[i + 1]; |
366 |
|| currentBuildId == null) |
353 |
if (this.scenarioPattern.startsWith("-")) { |
367 |
printUsage(); |
354 |
System.out.println("Missing value for -baseline parameter"); |
368 |
|
355 |
printUsage(); |
369 |
if (currentBuildStreamIdPrefixes==null){ |
356 |
} |
370 |
currentBuildStreamIdPrefixes=new ArrayList(); |
357 |
buffer.append(" "+arg+" = "+this.scenarioPattern+'\n'); |
371 |
currentBuildStreamIdPrefixes.add("N"); |
358 |
i++; |
372 |
currentBuildStreamIdPrefixes.add("I"); |
359 |
continue; |
373 |
} |
360 |
} |
374 |
if (configDescriptors==null){ |
361 |
if (arg.equals("-fingerprints")) { |
375 |
configDescriptors=new Hashtable(); |
362 |
this.genFingerPrints = true; |
376 |
for (int j=0;j<configNames.length;j++){ |
363 |
this.genAll = false; |
377 |
String configName=configNames[j]; |
364 |
buffer.append(" -fingerprints\n"); |
378 |
configDescriptors.put(configName,new Utils.ConfigDescriptor(configName,configName)); |
365 |
i++; |
379 |
|
366 |
continue; |
380 |
} |
367 |
} |
381 |
} |
368 |
if (arg.equals("-data")) { |
382 |
} |
369 |
this.genData = true; |
383 |
|
370 |
this.genAll = false; |
384 |
private void printUsage() { |
371 |
buffer.append(" -data\n"); |
385 |
System.out |
372 |
i++; |
386 |
.println("Usage:\n" |
373 |
continue; |
387 |
|
374 |
} |
388 |
+ "-baseline" |
375 |
if (arg.equals("-print")) { |
389 |
+"\n\tBuild id against which to compare results." |
376 |
this.print = true; |
390 |
+"\n\tSame as value specified for the \"build\" key in the eclipse.perf.config system property.\n\n" |
377 |
buffer.append(" -print\n"); |
391 |
|
378 |
i++; |
392 |
+ "[-baseline.prefix]" |
379 |
continue; |
393 |
+"\n\tBuild id prefix used in baseline test builds and reruns. Used to plot baseline historical data." |
380 |
} |
394 |
+"\n\tA common prefix used for the value of the \"build\" key in the eclipse.perf.config system property when rerunning baseline tests.\n\n" |
381 |
i++; |
395 |
|
382 |
} |
396 |
+ "-current" |
383 |
if (this.print) System.out.println(buffer.toString()); |
397 |
+"\n\tbuild id for which to generate results. Compared to build id specified in -baseline parameter above." |
384 |
if (baseline == null || this.outputDir == null || this.configDescriptors == null || jvm == null || currentBuildId == null) { |
398 |
+"\n\tSame as value specified for the \"build\" key in the eclipse.perf.config system property. \n\n" |
385 |
printUsage(); |
399 |
|
386 |
} |
400 |
+ "[-current.prefix]" |
387 |
if (this.baselinePrefix == null) { |
401 |
+"\n\tComma separated list of build id prefixes used in current build stream." |
388 |
// Assume that baseline name format is *always* x.y_yyyyMMddhhmm_yyyyMMddhhmm |
402 |
+"\n\tUsed to plot current build stream historical data. Defaults to \"N,I\"." |
389 |
this.baselinePrefix = baseline.substring(0, baseline.lastIndexOf('_')); |
403 |
+"\n\tPrefixes for values specified for the \"build\" key in the eclipse.perf.config system property. \n\n" |
390 |
} |
404 |
|
391 |
|
405 |
+ "-jvm" |
392 |
if (this.currentBuildPrefixes == null) { |
406 |
+"\n\tValue specified in \"jvm\" key in eclipse.perf.config system property for current build.\n\n" |
393 |
this.currentBuildPrefixes = new ArrayList(); |
407 |
|
394 |
this.currentBuildPrefixes.add("N"); |
408 |
+ "-config" |
395 |
this.currentBuildPrefixes.add("I"); |
409 |
+"\n\tComma separated list of config names for which to generate results." |
396 |
} |
410 |
+"\n\tSame as values specified in \"config\" key in eclipse.perf.config system property.\n\n" |
397 |
return new PerformanceResults(currentBuildId, baseline, this.print); |
411 |
|
398 |
} |
412 |
+ "-output" |
399 |
|
413 |
+" \n\tPath to default output directory.\n\n" |
400 |
/* |
414 |
|
401 |
* Print component PHP file |
415 |
+ "[-config.properties]" |
402 |
*/ |
416 |
+"\n\tOptional. Used by scenario status table to provide the following:" |
403 |
private void printComponent(PerformanceResults performanceResults, String component) throws FileNotFoundException { |
417 |
+"\n\t\talternate descriptions of config values to use in columns." |
404 |
if (this.print) System.out.print("."); |
418 |
+"\n\tThe value should be specified in the following format:" |
405 |
File outputFile = new File(this.outputDir, component + ".php"); |
419 |
+"\n\tname1,description1;name2,description2;etc..\n\n" |
406 |
PrintStream stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile))); |
420 |
|
407 |
stream.println(Utils.HTML_OPEN); |
421 |
+ "[-highlight]" |
408 |
stream.println("<link href=\"ToolTip.css\" rel=\"stylesheet\" type=\"text/css\"><script src=\"ToolTip.js\"></script>"); |
422 |
+"\n\tOptional. Comma-separated list of build Id prefixes used to find most recent matching for each entry." + |
409 |
stream.println(Utils.HTML_DEFAULT_CSS); |
423 |
"\n\tResult used to highlight points in line graphs.\n\n" |
410 |
stream.println("<body>"); |
424 |
|
411 |
|
425 |
+ "[-scenario.pattern]" |
412 |
String baselineName = performanceResults.getBaselineName(); |
426 |
+"\n\tOptional. Scenario prefix pattern to query database. If not specified," |
413 |
String currentName = performanceResults.getName(); |
427 |
+"\n\tdefault of % used in query.\n\n" |
414 |
boolean isGlobal = component.equals("global"); |
428 |
|
415 |
StringBuffer title = new StringBuffer("<h3>Performance of "); |
429 |
+ "[-fingerprints]" |
416 |
if (!isGlobal) { |
430 |
+"\n\tOptional. Use to generate fingerprints only.\n\n" |
417 |
title.append(component); |
431 |
|
418 |
title.append(": "); |
432 |
+ "[-scenarioresults]" |
419 |
} |
433 |
+"\n\tGenerates table of scenario reference and current data with line graphs.\n\n"); |
420 |
title.append(currentName); |
434 |
|
421 |
title.append(" relative to "); |
435 |
System.exit(1); |
422 |
int index = baselineName.indexOf('_'); |
|
|
423 |
title.append(baselineName.substring(0, index)); |
424 |
title.append(" ("); |
425 |
index = baselineName.lastIndexOf('_'); |
426 |
title.append(baselineName.substring(index+1, baselineName.length())); |
427 |
title.append(")</h3>"); |
428 |
stream.println(title.toString()); |
429 |
|
430 |
// print the html representation of fingerprint for each config |
431 |
if (genFingerPrints || genAll) { |
432 |
FingerPrint fingerprint = new FingerPrint(component, stream, this.outputDir); |
433 |
try { |
434 |
fingerprint.print(performanceResults); |
435 |
} catch (Exception ex) { |
436 |
ex.printStackTrace(); |
437 |
} |
438 |
} |
439 |
|
440 |
// print scenario status table |
441 |
if (isGlobal) { |
442 |
if (!PerformanceTestPlugin.getDBLocation().startsWith("net://")) { |
443 |
stream.println("<table border=0 cellpadding=2 cellspacing=5 width=\"100%\">"); |
444 |
stream.println("<tbody><tr> <td colspan=3 align=\"left\" bgcolor=\"#0080c0\" valign=\"top\"><b><font color=\"#ffffff\" face=\"Arial,Helvetica\">"); |
445 |
stream.println("Detailed performance data grouped by scenario prefix</font></b></td></tr></tbody></table>"); |
446 |
stream.println("<a href=\"org.eclipse.ant.php?\">org.eclipse.ant*</a><br>"); |
447 |
stream.println("<a href=\"org.eclipse.compare.php?\">org.eclipse.compare*</a><br>"); |
448 |
stream.println("<a href=\"org.eclipse.core.php?\">org.eclipse.core*</a><br>"); |
449 |
stream.println("<a href=\"org.eclipse.jdt.core.php?\">org.eclipse.jdt.core*</a><br>"); |
450 |
stream.println("<a href=\"org.eclipse.jdt.debug.php?\">org.eclipse.jdt.debug*</a><br>"); |
451 |
stream.println("<a href=\"org.eclipse.jdt.text.php?\">org.eclipse.jdt.text*</a><br>"); |
452 |
stream.println("<a href=\"org.eclipse.jdt.ui.php?\">org.eclipse.jdt.ui*</a><br>"); |
453 |
stream.println("<a href=\"org.eclipse.jface.php?\">org.eclipse.jface*</a><br>"); |
454 |
stream.println("<a href=\"org.eclipse.osgi.php?\">org.eclipse.osgi*</a><br>"); |
455 |
stream.println("<a href=\"org.eclipse.pde.ui.php?\">org.eclipse.pde.ui*</a><br>"); |
456 |
stream.println("<a href=\"org.eclipse.swt.php?\">org.eclipse.swt*</a><br>"); |
457 |
stream.println("<a href=\"org.eclipse.team.php?\">org.eclipse.team*</a><br>"); |
458 |
stream.println("<a href=\"org.eclipse.ua.php?\">org.eclipse.ua*</a><br>"); |
459 |
stream.println("<a href=\"org.eclipse.ui.php?\">org.eclipse.ui*</a><br><p><br><br>"); |
460 |
} |
461 |
} else if (component.length() > 0) { |
462 |
// print the component scenario status table beneath the fingerprint |
463 |
ScenarioStatusTable sst = new ScenarioStatusTable(component, stream); |
464 |
try { |
465 |
sst.print(performanceResults); |
466 |
} catch (Exception ex) { |
467 |
ex.printStackTrace(); |
468 |
} |
469 |
} |
470 |
|
471 |
stream.println(Utils.HTML_CLOSE); |
472 |
stream.close(); |
473 |
} |
474 |
|
475 |
/* |
476 |
* Print summary of coefficient of variation for each scenario of the given pattern |
477 |
* both for baseline and current builds. |
478 |
*/ |
479 |
private void printSummary(PerformanceResults performanceResults) { |
480 |
long start = System.currentTimeMillis(); |
481 |
if (this.print) System.out.print("Print scenarii variations summary..."); |
482 |
File outputFile = new File(this.outputDir, "cvsummary.html"); |
483 |
PrintStream stream = null; |
484 |
try { |
485 |
stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile))); |
486 |
printSummaryPresentation(stream); |
487 |
List scenarioNames = DB_Results.getScenariiNames(); |
488 |
int size = scenarioNames.size(); |
489 |
printSummaryColumnsTitle(stream, performanceResults); |
490 |
String[] configs = performanceResults.getConfigNames(true/*sorted*/); |
491 |
int configsLength = configs.length; |
492 |
for (int i=0; i<size; i++) { |
493 |
String scenarioName = (String) scenarioNames.get(i); |
494 |
if (scenarioName == null) continue; |
495 |
ScenarioResults scenarioResults = performanceResults.getScenarioResults(scenarioName); |
496 |
if (scenarioResults != null) { |
497 |
stream.println("<tr>"); |
498 |
for (int j=0; j<2; j++) { |
499 |
for (int c=0; c<configsLength; c++) { |
500 |
printSummaryScenarioLine(j, configs[c], scenarioResults, stream); |
501 |
} |
502 |
} |
503 |
stream.print("<td>"); |
504 |
stream.print(scenarioName); |
505 |
stream.println("</td></tr>"); |
506 |
} |
507 |
} |
508 |
} catch (Exception e) { |
509 |
e.printStackTrace(); |
510 |
} finally { |
511 |
stream.println("</table></body></html>"); |
512 |
stream.flush(); |
513 |
stream.close(); |
514 |
} |
515 |
if (this.print) System.out.println("done in "+(System.currentTimeMillis()-start)+"ms"); |
516 |
} |
436 |
|
517 |
|
|
|
518 |
/* |
519 |
* Print summary presentation (eg. file start and text presenting the purpose of this file contents).. |
520 |
*/ |
521 |
private void printSummaryPresentation(PrintStream stream) { |
522 |
stream.println(Utils.HTML_OPEN); |
523 |
stream.print(Utils.HTML_DEFAULT_CSS); |
524 |
stream.println("<title>Summary of Elapsed Process Variation Coefficients</title></head>"); |
525 |
stream.println("<body><h3>Summary of Elapsed Process Variation Coefficients</h3>\n"); |
526 |
stream.println("<p> This table provides a bird's eye view of variability in elapsed process times\n"); |
527 |
stream.print("for baseline and current build stream performance scenarios."); |
528 |
stream.print(" This summary is provided to facilitate the identification of scenarios that should be examined due to high variability."); |
529 |
stream.println("The variability for each scenario is expressed as a <a href=\"http://en.wikipedia.org/wiki/Coefficient_of_variation\">coefficient\n"); |
530 |
stream.println("of variation</a> (CV). The CV is calculated by dividing the <b>standard deviation\n"); |
531 |
stream.println("of the elapse process time over builds</b> by the <b>average elapsed process\n"); |
532 |
stream.println("time over builds</b> and multiplying by 100.\n"); |
533 |
stream.println("</p><p>High CV values may be indicative of any of the following:<br></p>\n"); |
534 |
stream.println("<ol><li> an unstable performance test. </li>\n"); |
535 |
stream.println("<ul><li>may be evidenced by an erratic elapsed process line graph.<br><br></li></ul>\n"); |
536 |
stream.println("<li>performance regressions or improvements at some time in the course of builds.</li>\n"); |
537 |
stream.println("<ul><li>may be evidenced by plateaus in elapsed process line graphs.<br><br></li></ul>\n"); |
538 |
stream.println("<li>unstable testing hardware.\n"); |
539 |
stream.print("<ul><li>consistent higher CV values for one test configuration as compared to others across"); |
540 |
stream.println(" scenarios may be related to hardward problems.</li></ul></li></ol>\n"); |
541 |
stream.println("<p> Scenarios are listed in alphabetical order in the far right column. A scenario's\n"); |
542 |
stream.println("variation coefficients (CVs) are in columns to the left for baseline and current\n"); |
543 |
stream.println("build streams for each test configuration. Scenarios with CVs > 10% are highlighted\n"); |
544 |
stream.println("in yellow (10%<CV><CV<20%) and orange(CV>20%). </p>\n"); |
545 |
stream.println("<p> Each CV value links to the scenario's detailed results to allow viewers to\n"); |
546 |
stream.println("investigate the variability.</p>\n"); |
547 |
} |
548 |
|
549 |
/* |
550 |
* Print columns titles of the summary table. |
551 |
*/ |
552 |
private void printSummaryColumnsTitle(PrintStream stream, PerformanceResults performanceResults) { |
553 |
String[] configBoxes = performanceResults.getConfigBoxes(true/*sorted*/); |
554 |
int length = configBoxes.length; |
555 |
stream.print("<table border=\"1\"><tr><td colspan=\""); |
556 |
stream.print(length); |
557 |
stream.print("\"><b>Baseline CVs</b></td><td colspan=\""); |
558 |
stream.print(length); |
559 |
stream.println("\"><b>Current Build Stream CVs</b></td><td rowspan=\"2\"><b>Scenario Name</b></td></tr>"); |
560 |
stream.print("<tr>"); |
561 |
for (int n=0; n<2; n++) { |
562 |
for (int c=0; c<length; c++) { |
563 |
stream.print("<td>"); |
564 |
stream.print(configBoxes[c]); |
565 |
stream.print("</td>"); |
566 |
} |
437 |
} |
567 |
} |
|
|
568 |
stream.println("</tr>\n"); |
569 |
} |
438 |
|
570 |
|
|
|
571 |
/* |
572 |
* Print a scenario line in the summary table. |
573 |
*/ |
574 |
private void printSummaryScenarioLine(int i, String config, ScenarioResults scenarioResults, PrintStream stream) { |
575 |
ConfigResults configResults = scenarioResults.getConfigResults(config); |
576 |
if (configResults == null || !configResults.isValid()) { |
577 |
stream.print("<td>n/a</td>"); |
578 |
return; |
579 |
} |
580 |
String url = config + "/" + scenarioResults.getFileName()+".html"; |
581 |
double[] stats = null; |
582 |
int dim_id = AbstractResults.SUPPORTED_DIMS[0].getId(); |
583 |
if (i==0) { // baseline results |
584 |
List baselinePrefixes = new ArrayList(); |
585 |
baselinePrefixes.add(this.baselinePrefix); |
586 |
stats = configResults.getStatistics(baselinePrefixes, dim_id); |
587 |
} else { |
588 |
stats = configResults.getStatistics(this.currentBuildPrefixes, dim_id); |
589 |
} |
590 |
double variation = stats[3]; |
591 |
if (variation > 10 && variation < 20) { |
592 |
stream.print("<td bgcolor=\"yellow\">"); |
593 |
} else if (variation >= 20) { |
594 |
stream.print("<td bgcolor=\"FF9900\">"); |
595 |
} else { |
596 |
stream.print("<td>"); |
597 |
} |
598 |
stream.print("<a href=\""); |
599 |
stream.print(url); |
600 |
stream.print("\"/>"); |
601 |
stream.print(variation); |
602 |
stream.print("%</a></td>"); |
603 |
} |
604 |
|
605 |
/* |
606 |
* Print usage in case one of the argument of the line was incorrect. |
607 |
* Note that calling this method ends the program run due to final System.exit() |
608 |
*/ |
609 |
private void printUsage() { |
610 |
System.out.println( |
611 |
"Usage:\n\n" + |
612 |
"-baseline\n" + |
613 |
" Build id against which to compare results.\n" + |
614 |
" Same as value specified for the \"build\" key in the eclipse.perf.config system property.\n\n" + |
615 |
|
616 |
"[-baseline.prefix]\n" + |
617 |
" Optional. Build id prefix used in baseline test builds and reruns. Used to plot baseline historical data.\n" + |
618 |
" A common prefix used for the value of the \"build\" key in the eclipse.perf.config system property when rerunning baseline tests.\n\n" + |
619 |
|
620 |
"-current\n" + |
621 |
" build id for which to generate results. Compared to build id specified in -baseline parameter above.\n" + |
622 |
" Same as value specified for the \"build\" key in the eclipse.perf.config system property. \n\n" + |
623 |
|
624 |
"[-current.prefix]\n" + |
625 |
" Optional. Comma separated list of build id prefixes used in current build stream.\n" + |
626 |
" Used to plot current build stream historical data. Defaults to \"N,I\".\n" + |
627 |
" Prefixes for values specified for the \"build\" key in the eclipse.perf.config system property. \n\n" + |
628 |
|
629 |
"-jvm\n" + |
630 |
" Value specified in \"jvm\" key in eclipse.perf.config system property for current build.\n\n" + |
631 |
|
632 |
"-config\n" + |
633 |
" Comma separated list of config names for which to generate results.\n" + |
634 |
" Same as values specified in \"config\" key in eclipse.perf.config system property.\n\n" + |
635 |
|
636 |
"-output\n" + |
637 |
" Path to default output directory.\n\n" + |
638 |
|
639 |
"[-config.properties]\n" + |
640 |
" Optional. Used by scenario status table to provide the following:\n" + |
641 |
" alternate descriptions of config values to use in columns.\n" + |
642 |
" The value should be specified in the following format:\n" + |
643 |
" name1,description1;name2,description2;etc..\n\n" + |
644 |
|
645 |
"[-highlight]\n" + |
646 |
" Optional. Comma-separated list of build Id prefixes used to find most recent matching for each entry.\n" + |
647 |
" Result used to highlight points in line graphs.\n\n" + |
648 |
|
649 |
"[-scenario.pattern]\n" + |
650 |
" Optional. Scenario prefix pattern to query database. If not specified,\n" + |
651 |
" default of % used in query.\n\n" + |
652 |
|
653 |
"[-fingerprints]\n" + |
654 |
" Optional. Use to generate fingerprints only.\n\n" + |
655 |
|
656 |
"[-data]\n" + |
657 |
" Optional. Generates table of scenario reference and current data with line graphs.\n\n" + |
658 |
|
659 |
"[-print]\n" + |
660 |
" Optional. Display output in the console while generating.\n" |
661 |
); |
662 |
|
663 |
System.exit(1); |
664 |
} |
665 |
|
666 |
/** |
667 |
* Generate the performance results for a specified build regarding to a specific reference. |
668 |
* This action generates following HTML files: |
669 |
* <ul> |
670 |
* <li>A summary table to see the variations for all the concerned scenarii</li> |
671 |
* <li>A global php file including global scenario fingerprints and links for all concerned components results php files</li> |
672 |
* <li>A php file for each component including scenario fingerprints and status table with links to a scenario data file</li> |
673 |
* <li>A data HTML file for each co nfig of each scenario included in status table</li> |
674 |
* </ul> |
675 |
* @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) |
676 |
*/ |
677 |
public Object start(IApplicationContext context) throws Exception { |
678 |
|
679 |
// Parse arguments and read DB info |
680 |
PerformanceResults performanceResults = parse(context.getArguments().get("application.args")); |
681 |
performanceResults.read(this.configDescriptors, this.scenarioPattern); |
682 |
|
683 |
// Print whole scenarii summary |
684 |
printSummary(performanceResults); |
685 |
|
686 |
// Copy images and scripts to output dir |
687 |
Bundle bundle = UiPlugin.getDefault().getBundle(); |
688 |
URL images = bundle.getEntry("images"); |
689 |
URL scripts = bundle.getEntry("scripts"); |
690 |
if (images != null) { |
691 |
images = FileLocator.resolve(images); |
692 |
Utils.copyImages(new File(images.getPath()), this.outputDir); |
693 |
} |
694 |
if (scripts != null) { |
695 |
scripts = FileLocator.resolve(scripts); |
696 |
Utils.copyScripts(new File(scripts.getPath()), this.outputDir); |
697 |
} |
439 |
|
698 |
|
|
|
699 |
// Print HTML pages and all linked files |
700 |
if (this.print) { |
701 |
System.out.println("Print performance results HTML pages:"); |
702 |
System.out.print(" - all components"); |
703 |
} |
704 |
long start = System.currentTimeMillis(); |
705 |
printComponent(performanceResults, "global"); |
706 |
Iterator components = performanceResults.getComponents().iterator(); |
707 |
while (components.hasNext()) { |
708 |
printComponent(performanceResults, (String) components.next()); |
709 |
} |
710 |
if (this.print) System.out.println("done in "+(System.currentTimeMillis()-start)+"ms"); |
711 |
|
712 |
// Print the scenarii data |
713 |
if (genData || genAll) { |
714 |
start = System.currentTimeMillis(); |
715 |
if (this.print) System.out.print(" - all scenarii data..."); |
716 |
ScenarioData data = new ScenarioData(this.baselinePrefix, this.pointsOfInterest, this.currentBuildPrefixes, this.outputDir); |
717 |
try { |
718 |
data.print(performanceResults); |
719 |
} catch (Exception ex) { |
720 |
ex.printStackTrace(); |
721 |
} |
722 |
if (this.print) System.out.println("done in "+(System.currentTimeMillis()-start)+"ms"); |
723 |
} |
724 |
return null; |
725 |
} |
440 |
|
726 |
|
|
|
727 |
/* (non-Javadoc) |
728 |
* @see org.eclipse.equinox.app.IApplication#stop() |
729 |
*/ |
730 |
public void stop() { |
731 |
// Do nothing |
732 |
} |
441 |
} |
733 |
} |