alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  
"); String[] configNames = performanceResults.getConfigNames(true/*sort*/); String[] configBoxes = performanceResults.getConfigBoxes(true/*sort*/); int length = configNames.length; for (int i=0; i<length; i++) { String columnTitle = configNames[i]; String boxName = configBoxes[i]; int idx = boxName.indexOf('('); if (idx < 0) { columnTitle = boxName; } else { // first line StringTokenizer tokenizer = new StringTokenizer(boxName.substring(0, idx).trim(), " "); StringBuffer buffer = new StringBuffer(tokenizer.nextToken()); while (tokenizer.hasMoreTokens()) { buffer.append(" "); buffer.append(tokenizer.nextToken()); } buffer.append(' '); // second line tokenizer = new StringTokenizer(boxName.substring(idx).trim(), " "); buffer.append(tokenizer.nextToken()); while (tokenizer.hasMoreTokens()) { buffer.append(" "); buffer.append(tokenizer.nextToken()); } columnTitle = buffer.toString(); } this.stream.print("<td>
"); this.stream.print(columnTitle); this.stream.println("</h5>"); } } /* * Print the scenario statistics value for the given configuration. */ private void printConfigStats(ScenarioResults scenarioResults, String config) { ConfigResults configResults = scenarioResults.getConfigResults(config); if (configResults == null || !configResults.isValid()) { this.stream.print("<td>n/a"); return; } BuildResults currentBuildResults = configResults.getCurrentBuildResults(); String failure = currentBuildResults.getFailure(); double[] deviation = configResults.getCurrentBuildDeviation(); int confidence = Utils.confidenceLevel(deviation); boolean hasFailure = failure != null; String comment = currentBuildResults.getComment(); String image = Utils.getImage(confidence, hasFailure, comment != null); this.stream.print("<td>"); } else { // create message with tooltip text including deviation with error plus failure message this.jsIdCount+=1; this.stream.print("class=\"tooltipSource\" onMouseover=\"show_element('toolTip"); this.stream.print(jsIdCount); this.stream.print("')\" onMouseout=\"hide_element('toolTip"); this.stream.print(jsIdCount); this.stream.print("')\" \nhref=\""); this.stream.print(configResults.getName()); this.stream.print('/'); this.stream.print(scenarioResults.getFileName()); this.stream.println(".html\">"); this.stream.print("<img hspace=\"10\" border=\"0\" src=\""); this.stream.print(image); this.stream.println("\"/>"); this.stream.print("<span class=\"hidden_tooltip\" id=\"toolTip"); this.stream.print(jsIdCount); this.stream.print("\">"); this.stream.print(failure); this.stream.println("</span>"); } String result = Utils.failureMessage(deviation, false); this.stream.println(result); } /* * Print the status table explanationtitle. */ private void printTitle() { this.stream.println("<br>

Scenario Status

"); this.stream.println("The following table gives a complete but compact view of performance results for the component.<br>"); this.stream.println("Each line of the table shows the results for one scenario on all machines.<br>
"); this.stream.println("The name of the scenario is in <b>bold when its results are also displayed in the fingerprints
"); this.stream.println("and starts with an '*' when the scenario has no results in the last baseline run.<br>
"); this.stream.println("Here are information displayed for each test (ie. in each cell):"); this.stream.println("<ul>"); this.stream.println("<li>an icon showing whether the test fails or passes and whether it's reliable or not.
"); this.stream.println("The legend for this icon is:"); this.stream.println("<ul>"); this.stream.print("<li>Green (successful result, which means this test has neither significant performance regression nor significant standard error"); this.stream.print("<li>Red (failing result, which means this test shows a significant performance regression (more than 10%)"); this.stream.print("<li>Gray (failing result (see above) with a comment explaining this degradation."); this.stream.print("<li>Yellow (failing or successful result with a significant standard error (more than "); this.stream.print(Utils.STANDARD_ERROR_THRESHOLD_STRING); this.stream.println(")</li>"); this.stream.print("<li>Black (undefined result, which means that deviation on this test is not a number (NaN) or is infinite (happens when the reference value is equals to 0!)"); this.stream.println("<li>\"n/a\": mark a test for with no performance results"); this.stream.println("</ul>"); this.stream.println("<li>the value of the deviation from the baseline as a percentage (ie. formula is: (build_test_time - baseline_test_time) / baseline_test_time)"); this.stream.println("<li>the value of the standard error of this deviation as a percentage (ie. formula is: sqrt(build_test_stddev^2 / N + baseline_test_stddev^2 / N) / baseline_test_time)
"); this.stream.println("When test only has one measure, the standard error cannot be computed and is replaced with a '<font color=\"#CCCC00\">[n/a]'."); this.stream.println("</ul>"); this.stream.println("<u>Hints:

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*******************************************************************************
 * Copyright (c) 2005, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.test.performance.ui;

import java.io.PrintStream;
import java.util.List;
import java.util.StringTokenizer;

import org.eclipse.test.internal.performance.results.BuildResults;
import org.eclipse.test.internal.performance.results.ConfigResults;
import org.eclipse.test.internal.performance.results.PerformanceResults;
import org.eclipse.test.internal.performance.results.ScenarioResults;

/**
 * Class used to print a scenario status table.
 */
public class ScenarioStatusTable {

	private String component;
	private PrintStream stream;
	private int jsIdCount;

/**
 * Creates an HTML table of red x/green check for a scenario for each
 * configuration.
 */
public ScenarioStatusTable(String  name, PrintStream stream) {
    this.component = name;
    this.stream = stream;
}

/**
 * Prints the HTML representation of scenario status table into the given stream.
 */
public void print(PerformanceResults performanceResults) {
	printTitle();
	List scenarios = performanceResults.getComponentScenarios(this.component);
	String baselineName = performanceResults.getBaselineName();
	int size = scenarios.size();
	printColumnsTitle(size, performanceResults);
	this.jsIdCount = 0;
	for (int i=0; i<size; i++) {
		ScenarioResults scenarioResults = (ScenarioResults) scenarios.get(i);
		this.stream.println("<tr>");
		this.stream.print("<td>");
		boolean hasSummary = scenarioResults.hasSummary();
		if (hasSummary) this.stream.print("<b>");
		String scenarioBaseline = scenarioResults.getBaselineBuildName();
		boolean hasBaseline = baselineName.equals(scenarioBaseline);
		if (!hasBaseline) {
			this.stream.print("*");
			this.stream.print(scenarioResults.getShortName());
			this.stream.print(" <small>(vs. ");
			this.stream.print(scenarioBaseline);
			this.stream.print(")</small>");
		} else {
			this.stream.print(scenarioResults.getShortName());
		}
		if (hasSummary) this.stream.print("</b>");
		this.stream.println();
		String[] configs = performanceResults.getConfigNames(true/*sort*/);
		int length = configs.length;
		for (int j=0; j<length; j++) {
			printConfigStats(scenarioResults, configs[j]);
		}
	}
	this.stream.println("</table>");
}

/*
 * Print the table columns title.
 */
private void printColumnsTitle(int size, PerformanceResults performanceResults) {
	this.stream.println("<table border=\"1\">");
	this.stream.println("<tr>");
	this.stream.print("<td>

All "); this.stream.print(size); this.stream.println(" scenarios</h4>

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.