Lines 30-36
Link Here
|
30 |
import org.eclipse.swt.graphics.ImageLoader; |
30 |
import org.eclipse.swt.graphics.ImageLoader; |
31 |
import org.eclipse.swt.widgets.Display; |
31 |
import org.eclipse.swt.widgets.Display; |
32 |
import org.eclipse.test.internal.performance.data.Dim; |
32 |
import org.eclipse.test.internal.performance.data.Dim; |
33 |
import org.eclipse.test.internal.performance.data.DimensionMessages; |
|
|
34 |
import org.eclipse.test.internal.performance.results.AbstractResults; |
33 |
import org.eclipse.test.internal.performance.results.AbstractResults; |
35 |
import org.eclipse.test.internal.performance.results.BuildResults; |
34 |
import org.eclipse.test.internal.performance.results.BuildResults; |
36 |
import org.eclipse.test.internal.performance.results.ComponentResults; |
35 |
import org.eclipse.test.internal.performance.results.ComponentResults; |
Lines 66-71
Link Here
|
66 |
this.rootDir = outputDir; |
65 |
this.rootDir = outputDir; |
67 |
} |
66 |
} |
68 |
|
67 |
|
|
|
68 |
/* |
69 |
* Create a file handle verifying that its name does not go over |
70 |
* the maximum authorized length. |
71 |
*/ |
72 |
private File createFile(File outputDir, String subdir, String name, String extension) { |
73 |
File dir = outputDir; |
74 |
if (subdir != null) { |
75 |
dir = new File(outputDir, subdir); |
76 |
if (!dir.exists()) { |
77 |
dir.mkdir(); |
78 |
} |
79 |
} |
80 |
return new File(dir, name + '.' + extension); |
81 |
} |
82 |
|
83 |
/* |
84 |
* Returns a LineGraph object representing measurements for a scenario over builds. |
85 |
*/ |
86 |
private TimeLineGraph getLineGraph(ScenarioResults scenarioResults, ConfigResults configResults, Dim dim, List highlightedPoints, List currentBuildIdPrefixes) { |
87 |
Display display = Display.getDefault(); |
88 |
|
89 |
Color black = display.getSystemColor(SWT.COLOR_BLACK); |
90 |
Color yellow = display.getSystemColor(SWT.COLOR_DARK_YELLOW); |
91 |
Color magenta = display.getSystemColor(SWT.COLOR_MAGENTA); |
92 |
|
93 |
String scenarioName = scenarioResults.getName(); |
94 |
TimeLineGraph graph = new TimeLineGraph(scenarioName + ": " + dim.getName(), dim); |
95 |
String baseline = configResults.getBaselineBuildName(); |
96 |
String current = configResults.getCurrentBuildName(); |
97 |
|
98 |
Iterator builds = configResults.getResults(); |
99 |
List lastSevenNightlyBuilds = configResults.lastNightlyBuildNames(7); |
100 |
buildLoop: while (builds.hasNext()) { |
101 |
BuildResults buildResults = (BuildResults) builds.next(); |
102 |
String buildID = buildResults.getName(); |
103 |
int underscoreIndex = buildID.indexOf('_'); |
104 |
String label = (underscoreIndex != -1 && (buildID.equals(baseline) || buildID.equals(current))) ? buildID.substring(0, underscoreIndex) : buildID; |
105 |
|
106 |
double value = buildResults.getValue(dim.getId()); |
107 |
|
108 |
if (buildID.equals(current)) { |
109 |
Color color = black; |
110 |
if (buildID.startsWith("N")) |
111 |
color = yellow; |
112 |
|
113 |
graph.addItem("main", label, dim.getDisplayValue(value), value, color, true, Utils.getDateFromBuildID(buildID), true); |
114 |
continue; |
115 |
} |
116 |
if (highlightedPoints.contains(buildID)) { |
117 |
graph.addItem("main", label, dim.getDisplayValue(value), value, black, false, Utils.getDateFromBuildID(buildID, false), true); |
118 |
continue; |
119 |
} |
120 |
if (buildID.charAt(0) == 'N') { |
121 |
if (lastSevenNightlyBuilds.contains(buildID)) { |
122 |
graph.addItem("main", buildID, dim.getDisplayValue(value), value, yellow, false, Utils.getDateFromBuildID(buildID), false); |
123 |
} |
124 |
continue; |
125 |
} |
126 |
for (int i=0;i<currentBuildIdPrefixes.size();i++){ |
127 |
if (buildID.startsWith(currentBuildIdPrefixes.get(i).toString())) { |
128 |
graph.addItem("main", buildID, dim.getDisplayValue(value), value, black, false, Utils.getDateFromBuildID(buildID), false); |
129 |
continue buildLoop; |
130 |
} |
131 |
} |
132 |
if (buildID.equals(baseline)) { |
133 |
boolean drawBaseline = (baselinePrefix != null) ? false : true; |
134 |
graph.addItem("reference", label, dim.getDisplayValue(value), value, magenta, true, Utils.getDateFromBuildID(buildID, true), true, drawBaseline); |
135 |
continue; |
136 |
} |
137 |
if (baselinePrefix != null) { |
138 |
if (buildID.startsWith(baselinePrefix) && !buildID.equals(baseline) && Utils.getDateFromBuildID(buildID, true) <= Utils.getDateFromBuildID(baseline, true)) { |
139 |
graph.addItem("reference", label, dim.getDisplayValue(value), value, magenta, false, Utils.getDateFromBuildID(buildID, true), false); |
140 |
continue; |
141 |
} |
142 |
} |
143 |
} |
144 |
return graph; |
145 |
} |
146 |
|
69 |
/** |
147 |
/** |
70 |
* Print the scenario all builds data from the given performance results. |
148 |
* Print the scenario all builds data from the given performance results. |
71 |
* |
149 |
* |
Lines 123-134
Link Here
|
123 |
} |
201 |
} |
124 |
|
202 |
|
125 |
String scenarioFileName = scenarioResults.getFileName(); |
203 |
String scenarioFileName = scenarioResults.getFileName(); |
126 |
File outFile = new File(outputDir, scenarioFileName + ".html"); |
204 |
File outputFile = new File(outputDir, scenarioFileName+".html"); |
127 |
PrintStream stream = null; |
205 |
PrintStream stream = null; |
128 |
try { |
206 |
try { |
129 |
stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outFile))); |
207 |
stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile))); |
130 |
} catch (FileNotFoundException e) { |
208 |
} catch (FileNotFoundException e) { |
131 |
System.err.println("can't create output file" + outFile); //$NON-NLS-1$ |
209 |
System.err.println("can't create output file" + outputFile); //$NON-NLS-1$ |
132 |
} |
210 |
} |
133 |
if (stream == null) { |
211 |
if (stream == null) { |
134 |
stream = System.out; |
212 |
stream = System.out; |
Lines 152-158
Link Here
|
152 |
} |
230 |
} |
153 |
|
231 |
|
154 |
// Print link to raw data. |
232 |
// Print link to raw data. |
155 |
String rawDataFile = scenarioFileName+"_raw.html"; |
233 |
String rawDataFile = "raw/" + scenarioFileName+".html"; |
156 |
stream.println("<br><br><b><a href=\""+rawDataFile+"\">Raw data and Stats</a></b><br><br>\n"); |
234 |
stream.println("<br><br><b><a href=\""+rawDataFile+"\">Raw data and Stats</a></b><br><br>\n"); |
157 |
stream.println("<b>Click measurement name to view line graph of measured values over builds.</b><br><br>\n"); |
235 |
stream.println("<b>Click measurement name to view line graph of measured values over builds.</b><br><br>\n"); |
158 |
|
236 |
|
Lines 163-170
Link Here
|
163 |
Dim[] dimensions = AbstractResults.SUPPORTED_DIMS; |
241 |
Dim[] dimensions = AbstractResults.SUPPORTED_DIMS; |
164 |
int dimLength = dimensions.length; |
242 |
int dimLength = dimensions.length; |
165 |
for (int d=0; d<dimLength; d++) { |
243 |
for (int d=0; d<dimLength; d++) { |
166 |
String dimName = dimensions[d].getName(); |
244 |
stream.print("<td><a href=\"#" + dimensions[d].getShortName() + "\"><b>" + dimensions[d].getName() + "</b></a></td>"); |
167 |
stream.print("<td><a href=\"#" + configName + "_" + scenarioFileName + "_" + dimName + "\"><b>" + dimName + "</b></a></td>"); |
|
|
168 |
} |
245 |
} |
169 |
stream.println("</tr>\n"); |
246 |
stream.println("</tr>\n"); |
170 |
|
247 |
|
Lines 187-203
Link Here
|
187 |
|
264 |
|
188 |
// print image maps of historical |
265 |
// print image maps of historical |
189 |
for (int d=0; d<dimLength; d++) { |
266 |
for (int d=0; d<dimLength; d++) { |
190 |
String dimName = dimensions[d].getName(); |
|
|
191 |
int dim_id = dimensions[d].getId(); |
192 |
TimeLineGraph lineGraph = getLineGraph(scenarioResults, configResults, dimensions[d], highlightedPoints, this.buildIDStreamPatterns); |
267 |
TimeLineGraph lineGraph = getLineGraph(scenarioResults, configResults, dimensions[d], highlightedPoints, this.buildIDStreamPatterns); |
193 |
|
268 |
|
194 |
File graphsDir = new File(outputDir, "graphs"); |
269 |
String dimShortName = dimensions[d].getShortName(); |
195 |
graphsDir.mkdir(); |
270 |
String imgFileName = scenarioFileName + "_" + dimShortName; |
196 |
File imgFile = new File(graphsDir, scenarioFileName + "_" + dimName + ".gif"); |
271 |
File imgFile = createFile(outputDir, "graphs", imgFileName, "gif"); |
197 |
saveGraph(lineGraph, imgFile); |
272 |
saveGraph(lineGraph, imgFile); |
198 |
stream.println("<br><a name=\"" + configName + "_" + scenarioFileName + "_" + dimName + "\"></a>"); |
273 |
stream.println("<br><a name=\"" + dimShortName + "\"></a>"); |
199 |
stream.println("<br><b>" + dimName + "</b><br>"); |
274 |
stream.println("<br><b>" + dimensions[d].getName() + "</b><br>"); |
200 |
stream.println(DimensionMessages.getDescription(dim_id) + "<br><br>\n"); |
275 |
stream.println(dimensions[d].getDescription() + "<br><br>\n"); |
201 |
stream.print("<img src=\"graphs/"); |
276 |
stream.print("<img src=\"graphs/"); |
202 |
stream.print(imgFile.getName()); |
277 |
stream.print(imgFile.getName()); |
203 |
stream.print("\" usemap=\"#" + lineGraph.fTitle + "\">"); |
278 |
stream.print("\" usemap=\"#" + lineGraph.fTitle + "\">"); |
Lines 285-354
Link Here
|
285 |
} |
360 |
} |
286 |
|
361 |
|
287 |
/* |
362 |
/* |
288 |
* Returns a LineGraph object representing measurements for a scenario over builds. |
|
|
289 |
*/ |
290 |
private TimeLineGraph getLineGraph(ScenarioResults scenarioResults, ConfigResults configResults, Dim dim, List highlightedPoints, List currentBuildIdPrefixes) { |
291 |
Display display = Display.getDefault(); |
292 |
|
293 |
Color black = display.getSystemColor(SWT.COLOR_BLACK); |
294 |
Color yellow = display.getSystemColor(SWT.COLOR_DARK_YELLOW); |
295 |
Color magenta = display.getSystemColor(SWT.COLOR_MAGENTA); |
296 |
|
297 |
String scenarioName = scenarioResults.getName(); |
298 |
TimeLineGraph graph = new TimeLineGraph(scenarioName + ": " + dim.getName(), dim); |
299 |
String baseline = configResults.getBaselineBuildName(); |
300 |
String current = configResults.getCurrentBuildName(); |
301 |
|
302 |
Iterator builds = configResults.getResults(); |
303 |
List lastSevenNightlyBuilds = configResults.lastNightlyBuildNames(7); |
304 |
buildLoop: while (builds.hasNext()) { |
305 |
BuildResults buildResults = (BuildResults) builds.next(); |
306 |
String buildID = buildResults.getName(); |
307 |
int underscoreIndex = buildID.indexOf('_'); |
308 |
String label = (underscoreIndex != -1 && (buildID.equals(baseline) || buildID.equals(current))) ? buildID.substring(0, underscoreIndex) : buildID; |
309 |
|
310 |
double value = buildResults.getValue(dim.getId()); |
311 |
|
312 |
if (buildID.equals(current)) { |
313 |
Color color = black; |
314 |
if (buildID.startsWith("N")) |
315 |
color = yellow; |
316 |
|
317 |
graph.addItem("main", label, dim.getDisplayValue(value), value, color, true, Utils.getDateFromBuildID(buildID), true); |
318 |
continue; |
319 |
} |
320 |
if (highlightedPoints.contains(buildID)) { |
321 |
graph.addItem("main", label, dim.getDisplayValue(value), value, black, false, Utils.getDateFromBuildID(buildID, false), true); |
322 |
continue; |
323 |
} |
324 |
if (buildID.charAt(0) == 'N') { |
325 |
if (lastSevenNightlyBuilds.contains(buildID)) { |
326 |
graph.addItem("main", buildID, dim.getDisplayValue(value), value, yellow, false, Utils.getDateFromBuildID(buildID), false); |
327 |
} |
328 |
continue; |
329 |
} |
330 |
for (int i=0;i<currentBuildIdPrefixes.size();i++){ |
331 |
if (buildID.startsWith(currentBuildIdPrefixes.get(i).toString())) { |
332 |
graph.addItem("main", buildID, dim.getDisplayValue(value), value, black, false, Utils.getDateFromBuildID(buildID), false); |
333 |
continue buildLoop; |
334 |
} |
335 |
} |
336 |
if (buildID.equals(baseline)) { |
337 |
boolean drawBaseline = (baselinePrefix != null) ? false : true; |
338 |
graph.addItem("reference", label, dim.getDisplayValue(value), value, magenta, true, Utils.getDateFromBuildID(buildID, true), true, drawBaseline); |
339 |
continue; |
340 |
} |
341 |
if (baselinePrefix != null) { |
342 |
if (buildID.startsWith(baselinePrefix) && !buildID.equals(baseline) && Utils.getDateFromBuildID(buildID, true) <= Utils.getDateFromBuildID(baseline, true)) { |
343 |
graph.addItem("reference", label, dim.getDisplayValue(value), value, magenta, false, Utils.getDateFromBuildID(buildID, true), false); |
344 |
continue; |
345 |
} |
346 |
} |
347 |
} |
348 |
return graph; |
349 |
} |
350 |
|
351 |
/* |
352 |
* Print details file of the scenario builds data. |
363 |
* Print details file of the scenario builds data. |
353 |
*/ |
364 |
*/ |
354 |
private void printDetails(String configName, String configBox, ComponentResults componentResults, File outputDir) { |
365 |
private void printDetails(String configName, String configBox, ComponentResults componentResults, File outputDir) { |
Lines 359-370
Link Here
|
359 |
if (configResults == null || !configResults.isValid()) continue; |
370 |
if (configResults == null || !configResults.isValid()) continue; |
360 |
String scenarioName= scenarioResults.getName(); |
371 |
String scenarioName= scenarioResults.getName(); |
361 |
String scenarioFileName = scenarioResults.getFileName(); |
372 |
String scenarioFileName = scenarioResults.getFileName(); |
362 |
File outFile = new File(outputDir, scenarioFileName + "_raw.html"); |
373 |
File outputFile = createFile(outputDir, "raw", scenarioFileName, "html"); |
363 |
PrintStream stream = null; |
374 |
PrintStream stream = null; |
364 |
try { |
375 |
try { |
365 |
stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outFile))); |
376 |
stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile))); |
366 |
} catch (FileNotFoundException e) { |
377 |
} catch (FileNotFoundException e) { |
367 |
System.err.println("can't create output file" + outFile); //$NON-NLS-1$ |
378 |
System.err.println("can't create output file" + outputFile); //$NON-NLS-1$ |
368 |
} |
379 |
} |
369 |
if (stream == null) stream = System.out; |
380 |
if (stream == null) stream = System.out; |
370 |
RawDataTable currentResultsTable = new RawDataTable(configResults, this.buildIDStreamPatterns, stream); |
381 |
RawDataTable currentResultsTable = new RawDataTable(configResults, this.buildIDStreamPatterns, stream); |
Lines 373-379
Link Here
|
373 |
stream.println(Utils.HTML_DEFAULT_CSS); |
384 |
stream.println(Utils.HTML_DEFAULT_CSS); |
374 |
stream.println("<title>" + scenarioName + "(" + configBox + ")" + " - Details</title></head>"); //$NON-NLS-1$ |
385 |
stream.println("<title>" + scenarioName + "(" + configBox + ")" + " - Details</title></head>"); //$NON-NLS-1$ |
375 |
stream.println("<h4>Scenario: " + scenarioName + " (" + configBox + ")</h4>"); //$NON-NLS-1$ |
386 |
stream.println("<h4>Scenario: " + scenarioName + " (" + configBox + ")</h4>"); //$NON-NLS-1$ |
376 |
stream.println("<a href=\""+scenarioFileName+".html\">VIEW GRAPH</a><br><br>"); //$NON-NLS-1$ |
387 |
stream.println("<a href=\"../"+scenarioFileName+".html\">VIEW GRAPH</a><br><br>"); //$NON-NLS-1$ |
377 |
stream.println("<table><td><b>Current Stream Test Runs</b></td><td><b>Baseline Test Runs</b></td></tr>\n"); |
388 |
stream.println("<table><td><b>Current Stream Test Runs</b></td><td><b>Baseline Test Runs</b></td></tr>\n"); |
378 |
stream.println("<tr valign=\"top\">"); |
389 |
stream.println("<tr valign=\"top\">"); |
379 |
stream.print("<td>"); |
390 |
stream.print("<td>"); |