HEAD - Improve status writing
diff --git a/bundles/org.eclipse.test.performance.ui/performanceui.jar b/bundles/org.eclipse.test.performance.ui/performanceui.jar
index fea51ff..8428f68 100644
--- a/bundles/org.eclipse.test.performance.ui/performanceui.jar
+++ b/bundles/org.eclipse.test.performance.ui/performanceui.jar
Binary files differ
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/AbstractResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/AbstractResults.java
index 4795e2a..679bf42 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/AbstractResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/AbstractResults.java
@@ -25,6 +25,16 @@
*/
public abstract class AbstractResults implements Comparable {
+ public static final double[] INVALID_RESULTS = new double[] {2};
+ public static final double[] NO_BUILD_RESULTS = new double[0];
+ public static final int BUILD_VALUE_INDEX = 0;
+ public static final int BASELINE_VALUE_INDEX = 1;
+ public static final int DELTA_VALUE_INDEX = 2;
+ public static final int DELTA_ERROR_INDEX = 3;
+ public static final int BUILD_ERROR_INDEX = 4;
+ public static final int BASELINE_ERROR_INDEX = 5;
+ public static final int NUMBERS_LENGTH = 6;
+
AbstractResults parent;
int id = -1;
String name;
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ComponentResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ComponentResults.java
index c42956f..ca3e7fb 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ComponentResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ComponentResults.java
@@ -39,16 +39,6 @@
*/
public class ComponentResults extends AbstractResults {
-public static final double[] INVALID_RESULTS = new double[] {2};
-public static final double[] NO_BUILD_RESULTS = new double[0];
-public static final int BUILD_VALUE_INDEX = 0;
-public static final int BASELINE_VALUE_INDEX = 1;
-public static final int DELTA_VALUE_INDEX = 2;
-public static final int DELTA_ERROR_INDEX = 3;
-public static final int BUILD_ERROR_INDEX = 4;
-public static final int BASELINE_ERROR_INDEX = 5;
-private static final int NUMBERS_LENGTH = 6;
-
public ComponentResults(AbstractResults parent, String name) {
super(parent, name);
this.printStream = parent.printStream;
@@ -145,7 +135,7 @@
// no result for this scenario in this build
line.add(NO_BUILD_RESULTS);
} else {
- line.add(getConfigNumbers(buildResults, configResults.getBaselineBuildResults(buildName)));
+ line.add(configResults.getNumbers(buildResults, configResults.getBaselineBuildResults(buildName)));
}
}
}
@@ -181,6 +171,7 @@
return differences;
}
+/*
double[] getConfigNumbers(BuildResults buildResults, BuildResults baselineResults) {
if (baselineResults == null) {
return INVALID_RESULTS;
@@ -190,7 +181,7 @@
values[i] = Double.NaN;
}
double buildValue = buildResults.getValue();
- values[BUILD_VALUE_INDEX] = buildValue;;
+ values[BUILD_VALUE_INDEX] = buildValue;
double baselineValue = baselineResults.getValue();
values[BASELINE_VALUE_INDEX] = baselineValue;
double delta = (baselineValue - buildValue) / baselineValue;
@@ -211,6 +202,7 @@
}
return values;
}
+*/
private ScenarioResults getScenarioResults(List scenarios, int searchedId) {
int size = scenarios.size();
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ConfigResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ConfigResults.java
index 3d1083f..7dbc07c 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ConfigResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ConfigResults.java
@@ -76,7 +76,7 @@
* Return the baseline build results run just before the given build name.
*
* @param buildName The build name
- * @return The {@link BuildResults baseline results} preceeding the given build name
+ * @return The {@link BuildResults baseline results} preceding the given build name
* or <code>null</code> if none was found.
*/
public BuildResults getBaselineBuildResults(String buildName) {
@@ -147,6 +147,25 @@
}
/**
+ * Returns the build results before a given build name.
+ *
+ * @param buildName Name of the last build (included)
+ * @return The list of the builds which precedes the given build name.
+ */
+public List getBuildsBefore(String buildName) {
+ String buildDate = Util.getBuildDate(buildName);
+ List builds = new ArrayList();
+ int size = size();
+ for (int i=0; i<size; i++) {
+ BuildResults buildResults = (BuildResults) this.children.get(i);
+ if (buildName == null || buildResults.getDate().compareTo(buildDate) <= 0) {
+ builds.add(buildResults);
+ }
+ }
+ return builds;
+}
+
+/**
* Returns a list of build results which names starts with one of the given prefixes.
*
* @param prefixes List of expected prefixes
@@ -169,20 +188,86 @@
}
/**
- * Returns the values for the current configuration.
+ * Get all results numbers for the max last builds.
+ *
+ * @param max The number of last builds to get numbers.
+ * @return An 2 dimensions array of doubles. At the first level of the array each slot
+ * represents one build. That means that the dimension of the array matches
+ * the given numbers as soon as there are enough builds in the database.
+ * <p>
+ * The slots of the second level are the numbers values:
+ * <ul>
+ * <li>{@link #BUILD_VALUE_INDEX}: the build value in milliseconds</li>
+ * <li>{@link #BASELINE_VALUE_INDEX}: the baseline value in milliseconds</li>
+ * <li>{@link #DELTA_VALUE_INDEX}: the difference between the build value and its more recent baseline</li>
+ * <li>{@link #DELTA_ERROR_INDEX}: the error made while computing the difference</li>
+ * <li>{@link #BUILD_ERROR_INDEX}: the error made while measuring the build value</li>
+ * <li>{@link #BASELINE_ERROR_INDEX}: the error made while measuring the baseline value</li>
+ * </ul>
+*/
+public double[][] getLastNumbers(int max) {
+
+ // Return null if no previous builds are expected
+ if (max <= 0) return null;
+
+ // Add numbers for each previous build
+ int size = size();
+ double[][] numbers = new double[max][];
+ int n = 0;
+ for (int i=size-1; i>=0 && n<max; i--) {
+ BuildResults buildResults = (BuildResults) this.children.get(i);
+ if (!buildResults.isBaseline()) {
+ numbers[n] = getNumbers(buildResults, getBaselineBuildResults(buildResults.getName()));
+ n++;
+ }
+ }
+
+ // Return the numbers
+ return numbers;
+}
+
+/**
+ * Returns interesting numbers for the current configuration.
*
* @return Values in an array of double:
* <ul>
- * <li>{@link ComponentResults#BUILD_VALUE_INDEX}: the build value in milliseconds</li>
- * <li>{@link ComponentResults#BASELINE_VALUE_INDEX}: the baseline value in milliseconds</li>
- * <li>{@link ComponentResults#DELTA_VALUE_INDEX}: the difference between the build value and its more recent baseline</li>
- * <li>{@link ComponentResults#DELTA_ERROR_INDEX}: the error made while computing the difference</li>
- * <li>{@link ComponentResults#BUILD_ERROR_INDEX}: the error made while measuring the build value</li>
- * <li>{@link ComponentResults#BASELINE_ERROR_INDEX}: the error made while measuring the baseline value</li>
+ * <li>{@link AbstractResults#BUILD_VALUE_INDEX}: the build value in milliseconds</li>
+ * <li>{@link AbstractResults#BASELINE_VALUE_INDEX}: the baseline value in milliseconds</li>
+ * <li>{@link AbstractResults#DELTA_VALUE_INDEX}: the difference between the build value and its more recent baseline</li>
+ * <li>{@link AbstractResults#DELTA_ERROR_INDEX}: the error made while computing the difference</li>
+ * <li>{@link AbstractResults#BUILD_ERROR_INDEX}: the error made while measuring the build value</li>
+ * <li>{@link AbstractResults#BASELINE_ERROR_INDEX}: the error made while measuring the baseline value</li>
* </ul>
*/
-public double[] getConfigNumbers() {
- return ((ComponentResults) this.parent.parent).getConfigNumbers(getCurrentBuildResults(), getBaselineBuildResults());
+double[] getNumbers(BuildResults buildResults, BuildResults baselineResults) {
+ if (baselineResults == null) {
+ return null;
+ }
+ double[] values = new double[NUMBERS_LENGTH];
+ for (int i=0 ;i<NUMBERS_LENGTH; i++) {
+ values[i] = Double.NaN;
+ }
+ double buildValue = buildResults.getValue();
+ values[BUILD_VALUE_INDEX] = buildValue;
+ double baselineValue = baselineResults.getValue();
+ values[BASELINE_VALUE_INDEX] = baselineValue;
+ double buildDelta = (baselineValue - buildValue) / baselineValue;
+ values[DELTA_VALUE_INDEX] = buildDelta;
+ if (Double.isNaN(buildDelta)) {
+ return values;
+ }
+ long baselineCount = baselineResults.getCount();
+ long currentCount = buildResults.getCount();
+ if (baselineCount > 1 && currentCount > 1) {
+ double baselineError = baselineResults.getError();
+ double currentError = buildResults.getError();
+ values[BASELINE_ERROR_INDEX] = baselineError;
+ values[BUILD_ERROR_INDEX] = currentError;
+ values[DELTA_ERROR_INDEX] = Double.isNaN(baselineError)
+ ? currentError / baselineValue
+ : Math.sqrt(baselineError*baselineError + currentError*currentError) / baselineValue;
+ }
+ return values;
}
/**
@@ -519,7 +604,10 @@
for (int i=0; i<size; i++) {
BuildResults buildResults = new BuildResults(this);
buildResults.readData(stream);
- addChild(buildResults, true);
+ String lastBuildName = getPerformance().lastBuildName;
+ if (lastBuildName == null || buildResults.getDate().compareTo(Util.getBuildDate(lastBuildName)) <= 0) {
+ addChild(buildResults, true);
+ }
}
}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/DB_Results.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/DB_Results.java
index 332098d..b96f17a 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/DB_Results.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/DB_Results.java
@@ -433,6 +433,18 @@
}
/**
+ * Returns the number of builds stored int the database.
+ *
+ * @return The number of builds stored in the database.
+ */
+public static int getBuildsNumber() {
+ if (BUILDS == null) {
+ queryAllVariations("%"); //$NON-NLS-1$
+ }
+ return BUILDS_LENGTH;
+}
+
+/**
* Get component name from a scenario.
*
* @param scenarioName The name of the scenario
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
index 8d3c8ac..d7cc894 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
@@ -42,6 +42,7 @@
String[] allBuildNames = null;
Map allScenarios;
+ String lastBuildName; // Name of the last used build
String baselineName; // Name of the baseline build used for comparison
String baselinePrefix;
private String scenarioPattern = "%"; //$NON-NLS-1$
@@ -670,14 +671,24 @@
int buildsSize = builds.size();
this.allBuildNames = new String[buildsSize];
if (buildsSize > 0) {
- builds.toArray(this.allBuildNames);
- int idx = this.allBuildNames.length-1;
- String lastBuildName = this.allBuildNames[idx--];
- while (this.name.startsWith(DB_Results.getDbBaselinePrefix())) {
- lastBuildName = this.allBuildNames[idx--];
+ int n = 0;
+ Iterator buildNames = builds.iterator();
+ while (buildNames.hasNext()) {
+ String buildName = (String) buildNames.next();
+ if (this.lastBuildName == null || Util.getBuildDate(buildName).compareTo(Util.getBuildDate(this.lastBuildName)) <= 0) {
+ this.allBuildNames[n++] = buildName;
+ }
}
- this.needToUpdateLocalFile = this.name == null || Util.getBuildDate(lastBuildName).compareTo(Util.getBuildDate(this.name)) > 0;
- this.name = lastBuildName;
+ if (n < buildsSize) {
+ System.arraycopy(this.allBuildNames, 0, this.allBuildNames = new String[n], 0, n);
+ }
+ int idx = n-1;
+ String lastBuild = this.allBuildNames[idx--];
+ while (lastBuild.startsWith(DB_Results.getDbBaselinePrefix())) {
+ lastBuild = this.allBuildNames[idx--];
+ }
+ this.needToUpdateLocalFile = this.name == null || Util.getBuildDate(lastBuild).compareTo(Util.getBuildDate(this.name)) > 0;
+ this.name = lastBuild;
}
}
@@ -781,6 +792,20 @@
}
}
+public void setLastBuildName(String lastBuildName) {
+ this.lastBuildName = lastBuildName;
+// if (lastBuildName == null) {
+// int idx = this.allBuildNames.length-1;
+// String lastBuild = this.allBuildNames[idx--];
+// while (this.name.startsWith(DB_Results.getDbBaselinePrefix())) {
+// lastBuild = this.allBuildNames[idx--];
+// }
+// this.name = lastBuild;
+// } else {
+// this.name = lastBuildName;
+// }
+}
+
/**
* Update a given build information with database contents.
*
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ScenarioResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ScenarioResults.java
index 350cea2..ea81176 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ScenarioResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ScenarioResults.java
@@ -369,7 +369,9 @@
*/
boolean updateBuild(String buildName, boolean force) {
- if (knowsBuild(buildName) && !force) return false;
+ if (!force && knowsBuild(buildName)) {
+ return false;
+ }
// Get values
print(" + scenario '"+getShortName()+"': values..."); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ComponentResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ComponentResultsElement.java
index ee05ceb..c8b21f3 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ComponentResultsElement.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ComponentResultsElement.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.test.internal.performance.results.model;
-import java.io.DataOutputStream;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
@@ -203,26 +201,32 @@
}
}
-void writeStatus(DataOutputStream stream, boolean full) throws IOException {
+StringBuffer writableStatus(StringBuffer buffer, int kind, StringBuffer excluded) {
// Write status for scenarios having error
if ((getStatus() & ERROR_MASK) != 0) {
- StringBuffer buffer = new StringBuffer(getName());
- IEclipsePreferences preferences = new InstanceScope().getNode(IPerformancesConstants.PLUGIN_ID);
- String comment = preferences.get(getId(), null);
- if (comment != null) {
- if (full) {
- buffer.append(" ");
- } else {
- buffer.append(" ");
+
+ // Get children status
+ StringBuffer childrenBuffer = super.writableStatus(new StringBuffer(), kind, excluded);
+
+ // Write status on file if not excluded
+ if (childrenBuffer.length() > 0) {
+ buffer.append(getName());
+ IEclipsePreferences preferences = new InstanceScope().getNode(IPerformancesConstants.PLUGIN_ID);
+ String comment = preferences.get(getId(), null);
+ if (comment != null) {
+ if ((kind & IPerformancesConstants.STATUS_VALUES) != 0) {
+ buffer.append(" ");
+ } else {
+ buffer.append(" ");
+ }
+ buffer.append(comment);
}
- buffer.append(comment);
+ buffer.append(Util.LINE_SEPARATOR);
+ buffer.append(childrenBuffer);
+ buffer.append(Util.LINE_SEPARATOR);
}
- buffer.append(Util.LINE_SEPARATOR);
- stream.write(buffer.toString().getBytes());
- // write status for each children
- super.writeStatus(stream, full);
- stream.write(Util.LINE_SEPARATOR.getBytes());
}
+ return buffer;
}
}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ConfigResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ConfigResultsElement.java
index 7c59aee..c1ba531 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ConfigResultsElement.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ConfigResultsElement.java
@@ -10,14 +10,10 @@
*******************************************************************************/
package org.eclipse.test.internal.performance.results.model;
-import java.io.DataOutputStream;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.test.internal.performance.results.db.*;
import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
import org.eclipse.test.internal.performance.results.utils.Util;
@@ -281,52 +277,211 @@
/*
* Write the element status in the given stream
*/
-void writeStatus(DataOutputStream stream, boolean full) throws IOException {
+StringBuffer writableStatus(StringBuffer buffer, int kind, StringBuffer excluded) {
if ((this.status & BIG_DELTA) != 0) {
+
+ // Get numbers
+ int buildsNumber = kind & IPerformancesConstants.STATUS_BUILDS_NUMBER_MASK;
ConfigResults configResults = getConfigResults();
- double[] values = configResults.getConfigNumbers();
- double buildValue = values[ComponentResults.BUILD_VALUE_INDEX];
- double baselineValue = values[ComponentResults.BASELINE_VALUE_INDEX];
- double delta = values[ComponentResults.DELTA_VALUE_INDEX];
- double error = values[ComponentResults.DELTA_ERROR_INDEX];
- StringBuffer buffer = new StringBuffer(" ");
- buffer.append(configResults.getName());
- double[] stats = null;
- if (full) {
- buffer.append(" ");
- buffer.append(buildValue);
- buffer.append(" ");
- buffer.append(baselineValue);
- buffer.append(" ");
- buffer.append(buildValue-baselineValue);
- buffer.append(" ");
- buffer.append(Util.PERCENTAGE_FORMAT.format(delta));
- buffer.append(" ");
- buffer.append(Util.PERCENTAGE_FORMAT.format(error));
- stats = getStatistics();
- if (stats != null) {
- buffer.append(" ");
- buffer.append((int) stats[0]);
- buffer.append(" ");
- buffer.append(Util.DOUBLE_FORMAT.format(stats[1]));
- buffer.append(" ");
- buffer.append(Util.DOUBLE_FORMAT.format(stats[2]));
- buffer.append(" ");
- buffer.append(Util.PERCENTAGE_FORMAT.format(stats[3]));
+ double[][] numbers = configResults.getLastNumbers(buildsNumber);
+
+ // if there are several builds to confirm the regression, then verify all deltas
+ if (buildsNumber > 1) {
+ int confirmed = 1;
+ for (int i=1; i<buildsNumber; i++) {
+ if (numbers[i][AbstractResults.DELTA_VALUE_INDEX] < -0.1) {
+ confirmed++;
+ }
+ }
+ float ratio = ((float) confirmed) / buildsNumber;
+ if (ratio < 0.8) {
+ // more than 20% of previous build didn't fail, hence skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status because only "+confirmed+" builds failed on last "+buildsNumber+" ones!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
}
}
+
+ // Add values
+ double[] values = numbers[0];
+ double buildValue = values[AbstractResults.BUILD_VALUE_INDEX];
+ double baselineValue = values[AbstractResults.BASELINE_VALUE_INDEX];
+ double delta = values[AbstractResults.DELTA_VALUE_INDEX];
+ double error = values[AbstractResults.DELTA_ERROR_INDEX];
+ StringBuffer localBuffer = new StringBuffer(" ");
+ localBuffer.append(configResults.getName());
+ double[] stats = null;
+ boolean printValues = (kind & IPerformancesConstants.STATUS_VALUES) != 0;
+ if (printValues) {
+ localBuffer.append(" ");
+ localBuffer.append(buildValue);
+ localBuffer.append(" ");
+ localBuffer.append(baselineValue);
+ localBuffer.append(" ");
+ localBuffer.append(buildValue-baselineValue);
+ localBuffer.append(" ");
+ localBuffer.append(Util.PERCENTAGE_FORMAT.format(delta));
+ localBuffer.append(" ");
+ localBuffer.append(Util.PERCENTAGE_FORMAT.format(error));
+ stats = getStatistics();
+ if (stats != null) {
+ localBuffer.append(" ");
+ localBuffer.append((int) stats[0]);
+ localBuffer.append(" ");
+ localBuffer.append(Util.DOUBLE_FORMAT.format(stats[1]));
+ localBuffer.append(" ");
+ localBuffer.append(Util.DOUBLE_FORMAT.format(stats[2]));
+ localBuffer.append(" ");
+ localBuffer.append(Util.PERCENTAGE_FORMAT.format(stats[3]));
+ }
+ }
+
+ /* Add comment
IEclipsePreferences preferences = new InstanceScope().getNode(IPerformancesConstants.PLUGIN_ID);
String comment = preferences.get(getId(), null);
if (comment != null) {
- if (stats == null && full) {
+ if (stats == null && printValues) {
buffer.append(" ");
}
buffer.append(" ");
buffer.append(comment);
}
+ */
+
+ // Add status info
+ if (this.status != BIG_DELTA) { // there's some other info in the status
+// if (comment == null) {
+ if (stats == null && printValues) {
+ localBuffer.append(" ");
+ }
+// }
+ localBuffer.append(" ");
+ String separator = "";
+
+ // Error
+ if ((this.status & BIG_ERROR) != 0) {
+ int statusErrorLevel = kind & IPerformancesConstants.STATUS_ERROR_LEVEL_MASK;
+ if (statusErrorLevel == IPerformancesConstants.STATUS_ERROR_NOTICEABLE) {
+ // Skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status due to a noticeable error!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
+ }
+ localBuffer.append(separator);
+ localBuffer.append("error (");
+ localBuffer.append(Util.PERCENTAGE_FORMAT.format(error));
+ localBuffer.append(")");
+ separator = "+";
+ double ratio = -(error/delta);
+ if (ratio > 1) {
+ switch (statusErrorLevel) {
+ case IPerformancesConstants.STATUS_ERROR_INVALID:
+ case IPerformancesConstants.STATUS_ERROR_WEIRD:
+ case IPerformancesConstants.STATUS_ERROR_SUSPICIOUS:
+ // Skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status due to an invalid error!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
+ }
+ localBuffer.append(": invalid measure!");
+ } else if (ratio > 0.5) {
+ switch (statusErrorLevel) {
+ case IPerformancesConstants.STATUS_ERROR_WEIRD:
+ case IPerformancesConstants.STATUS_ERROR_SUSPICIOUS:
+ // Skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status due to a weird error!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
+ }
+ localBuffer.append(": weird measure!");
+ } else if (ratio > 0.25) {
+ if (statusErrorLevel == IPerformancesConstants.STATUS_ERROR_SUSPICIOUS) {
+ // Skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status due to a suspicious error!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
+ }
+ localBuffer.append(": suspicious measure!");
+ }
+ }
+
+ // Small value
+ if ((this.status & SMALL_VALUE) != 0) {
+ int statusSmallValue = kind & IPerformancesConstants.STATUS_SMALL_VALUE_MASK;
+ localBuffer.append(separator);
+ if (buildValue < 100) {
+ if (statusSmallValue == IPerformancesConstants.STATUS_SMALL_VALUE_BUILD) {
+ // Skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status due to a small build value!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
+ }
+ localBuffer.append("small build value (");
+ localBuffer.append((int)buildValue);
+ localBuffer.append("ms)");
+ }
+ int diff = (int) Math.abs(baselineValue - buildValue);
+ if (diff < 100) {
+ if (statusSmallValue == IPerformancesConstants.STATUS_SMALL_VALUE_DELTA) {
+ // Skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status due to a small delta value!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
+ }
+ localBuffer.append("small delta value (");
+ localBuffer.append(diff);
+ localBuffer.append("ms)");
+ }
+ separator = "+";
+ }
+
+ // Statistics
+ if ((this.status & NOT_RELIABLE) != 0) {
+ if ((kind & IPerformancesConstants.STATUS_STATISTICS_ERRATIC) != 0) {
+ // Skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status due to erratic statistics!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
+ }
+ localBuffer.append(separator);
+ localBuffer.append("erratic");
+ separator = "+";
+ } else if ((this.status & NOT_STABLE) != 0) {
+ if ((kind & IPerformancesConstants.STATUS_STATISTICS_UNSTABLE) != 0) {
+ // Skip result
+ if (excluded != null) {
+ excluded.append(configResults+" excluded from status due to unstable statistics!");
+ excluded.append(Util.LINE_SEPARATOR);
+ }
+ return buffer;
+ }
+ localBuffer.append(separator);
+ localBuffer.append("unstable");
+ separator = "+";
+ }
+ }
+
+ // Write status
+ buffer.append(localBuffer);
buffer.append(Util.LINE_SEPARATOR);
- stream.write(buffer.toString().getBytes());
}
+ return buffer;
}
}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java
index 1c6a39d..5150a36 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java
@@ -19,6 +19,7 @@
import java.util.Arrays;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.test.internal.performance.results.db.*;
+import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
import org.eclipse.test.internal.performance.results.utils.Util;
public class PerformanceResultsElement extends ResultsElement {
@@ -27,6 +28,7 @@
public static PerformanceResultsElement PERF_RESULTS_MODEL = new PerformanceResultsElement();
String[] buildNames;
+ String lastBuildName;
boolean fingerprints = true;
public PerformanceResultsElement() {
@@ -155,9 +157,11 @@
return super.isInitialized() && this.results.size() > 0;
}
-public void readLocal(File dataDir, IProgressMonitor monitor) {
+public void readLocal(File dataDir, IProgressMonitor monitor, String lastBuild) {
reset(null);
- getPerformanceResults().readLocal(dataDir, monitor);
+ PerformanceResults performanceResults = getPerformanceResults();
+ performanceResults.setLastBuildName(lastBuild);
+ performanceResults.readLocal(dataDir, monitor);
}
public void reset(String buildName) {
@@ -198,29 +202,100 @@
resetStatus();
}
+public void setLastBuildName(String lastBuildName) {
+ this.lastBuildName = lastBuildName;
+ this.name = null;
+}
+
/*
* Write the component status in the given file
*/
-public boolean writeStatus(File resultsFile, boolean full) {
+public StringBuffer writeStatus(File resultsFile, int kind) {
if (this.results == null) {
- return false;
+ return null;
}
+ boolean values = (kind & IPerformancesConstants.STATUS_VALUES) != 0;
// Write status only for component with error
+ StringBuffer excluded = new StringBuffer();
try {
DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(resultsFile)));
try {
- // Print columns title
StringBuffer buffer = new StringBuffer();
+ // Print build name
+ buffer.append("Status for ");
+ buffer.append(getPerformanceResults().getName());
+ buffer.append(Util.LINE_SEPARATOR);
+ // Print status options
+ if ((kind & ~IPerformancesConstants.STATUS_VALUES) > 0) {
+ buffer.append("Options: ");
+ buffer.append(Util.LINE_SEPARATOR);
+ final int errorLevel = kind & IPerformancesConstants.STATUS_ERROR_LEVEL_MASK;
+ if (errorLevel != 0) {
+ buffer.append(" error level: ");
+ switch (errorLevel) {
+ case IPerformancesConstants.STATUS_ERROR_NONE:
+ buffer.append("include all failures whatever the error level is");
+ break;
+ case IPerformancesConstants.STATUS_ERROR_NOTICEABLE:
+ buffer.append("all failures with at least a noticeable error (> 3%) are excluded!");
+ break;
+ case IPerformancesConstants.STATUS_ERROR_SUSPICIOUS:
+ buffer.append("all failures with at least a suspicious error (> 25%) are excluded!");
+ break;
+ case IPerformancesConstants.STATUS_ERROR_WEIRD:
+ buffer.append("all failures with at least a weird error (> 50%) are excluded!");
+ break;
+ case IPerformancesConstants.STATUS_ERROR_INVALID:
+ buffer.append("all failures with an invalid error (> 100%) are excluded!");
+ break;
+ }
+ buffer.append(Util.LINE_SEPARATOR);
+ }
+ final int smallValue = kind & IPerformancesConstants.STATUS_SMALL_VALUE_MASK;
+ if (smallValue > 0) {
+ buffer.append(" small value: ");
+ switch (smallValue) {
+ case IPerformancesConstants.STATUS_SMALL_VALUE_BUILD:
+ buffer.append("all failures with a small build value (<100ms) are excluded!");
+ break;
+ case IPerformancesConstants.STATUS_SMALL_VALUE_DELTA:
+ buffer.append("all failures with a small delta value (<100ms) are excluded!");
+ break;
+ case IPerformancesConstants.STATUS_SMALL_VALUE_MASK:
+ buffer.append("all failures with a small build or delta value (<100ms) are excluded!");
+ break;
+ }
+ buffer.append(Util.LINE_SEPARATOR);
+ }
+ final int stats = kind & IPerformancesConstants.STATUS_STATISTICS_MASK;
+ if (stats > 0) {
+ buffer.append(" statistics: ");
+ switch (stats) {
+ case IPerformancesConstants.STATUS_STATISTICS_ERRATIC:
+ buffer.append("all failures with erratic baseline results (variation > 20%) are excluded!");
+ break;
+ case IPerformancesConstants.STATUS_STATISTICS_UNSTABLE:
+ buffer.append("all failures with unstable baseline results (10% < variation < 20%) are excluded!");
+ break;
+ }
+ buffer.append(Util.LINE_SEPARATOR);
+ }
+ int buildsNumber = kind & IPerformancesConstants.STATUS_BUILDS_NUMBER_MASK;
+ buffer.append(" builds to confirm a regression: ");
+ buffer.append(buildsNumber);
+ buffer.append(Util.LINE_SEPARATOR);
+ }
+ // Print columns title
buffer.append("Component");
buffer.append(" Scenario");
buffer.append(" Machine");
- if (full) {
+ if (values) {
buffer.append(" Build ");
buffer.append(" History ");
}
buffer.append(" Comment");
buffer.append(Util.LINE_SEPARATOR);
- if (full) {
+ if (values) {
buffer.append(" value");
buffer.append(" baseline");
buffer.append(" variation");
@@ -233,7 +308,10 @@
buffer.append(Util.LINE_SEPARATOR);
}
stream.write(buffer.toString().getBytes());
- writeStatus(stream, full);
+ StringBuffer componentBuffer = writableStatus(new StringBuffer(), kind, excluded);
+ if (componentBuffer.length() > 0) {
+ stream.write(componentBuffer.toString().getBytes());
+ }
}
finally {
stream.close();
@@ -243,7 +321,7 @@
} catch (IOException e) {
e.printStackTrace();
}
- return true;
+ return excluded;
}
}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ResultsElement.java
index 8c93a2c..b3646d3 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ResultsElement.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ResultsElement.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.test.internal.performance.results.model;
-import java.io.DataOutputStream;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
@@ -500,7 +498,7 @@
}
// Store if there's a big delta (over 10%)
- if (delta < -0.1) {
+ if (delta <= -0.1) {
this.status |= BIG_DELTA;
double currentBuildValue = buildResults.getValue();
double diff = Math.abs(baselineValue - currentBuildValue);
@@ -589,11 +587,13 @@
/*
* Write the element status in the given stream
*/
-void writeStatus(DataOutputStream stream, boolean full) throws IOException {
+StringBuffer writableStatus(StringBuffer buffer, int kind, StringBuffer excluded) {
int length = this.children.length;
for (int i=0; i<length; i++) {
- this.children[i].writeStatus(stream, full);
+ this.children[i].writableStatus(buffer, kind, excluded);
}
+ return buffer;
}
+
}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ScenarioResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ScenarioResultsElement.java
index 334a853..5957d6a 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ScenarioResultsElement.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ScenarioResultsElement.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.test.internal.performance.results.model;
-import java.io.DataOutputStream;
-import java.io.IOException;
import java.util.Vector;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
@@ -128,26 +126,33 @@
}
}
-void writeStatus(DataOutputStream stream, boolean full) throws IOException {
+StringBuffer writableStatus(StringBuffer buffer, int kind, StringBuffer excluded) {
// Write status for scenarios having error
if ((getStatus() & ERROR_MASK) != 0) {
- StringBuffer buffer = new StringBuffer(" ");
- buffer.append(getLabel(null));
- IEclipsePreferences preferences = new InstanceScope().getNode(IPerformancesConstants.PLUGIN_ID);
- String comment = preferences.get(getId(), null);
- if (comment != null) {
- if (full) {
- buffer.append(" ");
- } else {
- buffer.append(" ");
+
+ // Get children status
+ StringBuffer childrenBuffer = super.writableStatus(new StringBuffer(), kind, excluded);
+
+ // Write status on file if not excluded
+ if (childrenBuffer.length() > 0) {
+ buffer.append(" ");
+ buffer.append(getLabel(null));
+ IEclipsePreferences preferences = new InstanceScope().getNode(IPerformancesConstants.PLUGIN_ID);
+ String comment = preferences.get(getId(), null);
+ if (comment != null) {
+ if ((kind & IPerformancesConstants.STATUS_VALUES) != 0) {
+ buffer.append(" ");
+ } else {
+ buffer.append(" ");
+ }
+ buffer.append(comment);
}
- buffer.append(comment);
+ buffer.append(Util.LINE_SEPARATOR);
+ buffer.append(childrenBuffer);
+ buffer.append(Util.LINE_SEPARATOR);
}
- buffer.append(Util.LINE_SEPARATOR);
- stream.write(buffer.toString().getBytes());
- // write status for each children
- super.writeStatus(stream, full);
}
+ return buffer;
}
}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/BuildsView.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/BuildsView.java
index 2a7039a..207bcf6 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/BuildsView.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/BuildsView.java
@@ -408,6 +408,15 @@
}
/*
+ * (non-Javadoc)
+ * @see org.eclipse.test.internal.performance.results.ui.PerformancesView#fillLocalPullDown(org.eclipse.jface.action.IMenuManager)
+ */
+void fillFiltersDropDown(IMenuManager manager) {
+ super.fillFiltersDropDown(manager);
+ manager.add(this.filterLastBuilds);
+}
+
+/*
* Fill the local data drop-down menu
*/
void fillLocalDataDropDown(IMenuManager manager) {
@@ -474,20 +483,59 @@
*/
public void resetView() {
+ boolean debug = true;
+
// Look whether database constants has changed or not
int eclipseVersion = this.preferences.getInt(IPerformancesConstants.PRE_ECLIPSE_VERSION, IPerformancesConstants.DEFAULT_ECLIPSE_VERSION);
boolean connected = this.preferences.getBoolean(IPerformancesConstants.PRE_DATABASE_CONNECTION, IPerformancesConstants.DEFAULT_DATABASE_CONNECTION);
String databaseLocation = this.preferences.get(IPerformancesConstants.PRE_DATABASE_LOCATION, IPerformancesConstants.NETWORK_DATABASE_LOCATION);
+ String lastBuild = this.preferences.get(IPerformancesConstants.PRE_LAST_BUILD, null);
+ boolean noLastBuild = lastBuild.length() == 0;
+ if (debug) {
+ System.out.println("Reset View:");
+ System.out.println(" - eclispe version = "+eclipseVersion);
+ System.out.println(" - connected = "+connected);
+ System.out.println(" - db location = "+databaseLocation);
+ System.out.println(" - last build = "+(noLastBuild?"<none>":lastBuild));
+ }
final boolean sameVersion = DB_Results.getDbVersion().endsWith(Integer.toString(eclipseVersion));
final boolean sameConnection = connected == DB_Results.DB_CONNECTION;
final boolean sameDB = sameVersion && databaseLocation.equals(DB_Results.getDbLocation());
+ boolean sameLastBuild = (noLastBuild && LAST_BUILD == null) || lastBuild.equals(LAST_BUILD);
+ if (debug) {
+ System.out.println(" - same version: "+sameVersion);
+ System.out.println(" - same connection: "+sameConnection);
+ System.out.println(" - same DB: "+sameDB);
+ System.out.println(" - same last build: "+sameLastBuild);
+ }
+ final PerformancesView siblingView = getSiblingView();
if (sameConnection && sameDB) {
+ if (!sameLastBuild) {
+ // Set last build
+ LAST_BUILD = noLastBuild ? null : lastBuild;
+ this.results.setLastBuildName(LAST_BUILD);
+ siblingView.results.setLastBuildName(LAST_BUILD);
+
+ // Reset views content
+ resetInput();
+ siblingView.resetInput();
+
+ // May be read local data now
+ File newDataDir = changeDataDir();
+ if (newDataDir == null) {
+ this.dataDir = null;
+ siblingView.dataDir = null;
+ }
+ }
// No database preferences has changed do nothing
return;
}
// Update database constants
boolean updated = DB_Results.updateDbConstants(connected, eclipseVersion, databaseLocation);
+ if (debug) {
+ System.out.println(" - updated: "+updated);
+ }
if (!connected) {
if (!updated) {
MessageDialog.openError(this.shell, getTitleToolTip(), "Error while updating database results constants!\nOpen error log to see more details on this error");
@@ -501,24 +549,24 @@
DB_Results.updateDbConstants(false, eclipseVersion, databaseLocation);
}
setTitleToolTip();
- getSiblingView().setTitleToolTip();
+ siblingView.setTitleToolTip();
// Refresh view
- if (sameVersion) {
+ if (sameVersion && sameLastBuild) {
// Refresh only builds view as the sibling view (Components) contents is based on local data files contents
this.results.resetBuildNames();
refreshInput();
} else {
// Reset views content
resetInput();
- getSiblingView().resetInput();
+ siblingView.resetInput();
// May be read local data now
if (MessageDialog.openQuestion(this.shell, getTitleToolTip(), "Do you want to read local data right now?")) {
changeDataDir();
} else {
this.dataDir = null;
- getSiblingView().dataDir = null;
+ siblingView.dataDir = null;
}
}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ComponentsView.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ComponentsView.java
index 041f7f8..442d6db 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ComponentsView.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ComponentsView.java
@@ -10,11 +10,17 @@
*******************************************************************************/
package org.eclipse.test.internal.performance.results.ui;
+import java.io.BufferedOutputStream;
+import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -100,16 +106,26 @@
// Actions
Action filterAdvancedScenarios;
Action writeStatus;
- Action writeFullStatus;
// SWT resources
Font boldFont;
+ // Write Status
+ static int WRITE_STATUS;
+
/**
* Default constructor.
*/
public ComponentsView() {
// this.onlyFingerprintsImageDescriptor = ImageDescriptor.createFromFile(getClass(), "filter_ps.gif");
+ super();
+
+ // Get preferences
+ this.preferences = new InstanceScope().getNode(IPerformancesConstants.PLUGIN_ID);
+
+ // Init status
+ WRITE_STATUS = this.preferences.getInt(IPerformancesConstants.PRE_WRITE_STATUS, IPerformancesConstants.DEFAULT_WRITE_STATUS);
+
}
/*
@@ -232,7 +248,6 @@
super.fillLocalPullDown(manager);
manager.add(new Separator());
manager.add(this.writeStatus);
- manager.add(this.writeFullStatus);
}
/*
@@ -314,16 +329,7 @@
// Write status
this.writeStatus = new Action("Write status") {
public void run() {
- writeStatus(false/*not full*/);
- }
- };
- this.writeStatus.setEnabled(true);
- this.writeStatus.setToolTipText("Write component status to a file");
-
- // Write full status
- this.writeFullStatus = new Action("Write full status") {
- public void run() {
- writeStatus(true/*full*/);
+ writeStatus();
}
};
this.writeStatus.setEnabled(true);
@@ -355,12 +361,12 @@
this.filterOldBuilds.setChecked(checked);
}
- // Filter nightly builds change
- if (propertyName.equals(IPerformancesConstants.PRE_FILTER_NIGHTLY_BUILDS)) {
- boolean checked = newValue == null ? IPerformancesConstants.DEFAULT_FILTER_NIGHTLY_BUILDS : "true".equals(newValue);
- filterNightlyBuilds(checked, false/*do not update preference*/);
- this.filterNightlyBuilds.setChecked(checked);
+ // Write status
+ if (propertyName.equals(IPerformancesConstants.PRE_WRITE_STATUS)) {
+ WRITE_STATUS = newValue == null ? IPerformancesConstants.DEFAULT_WRITE_STATUS : Integer.parseInt((String)newValue);
}
+
+ super.preferenceChange(event);
}
void restoreState() {
@@ -438,7 +444,7 @@
}
}
-protected void writeStatus(boolean full) {
+protected void writeStatus() {
String filter = (this.resultsDir == null) ? null : this.resultsDir.getPath();
File newDir = changeDir(filter, "Select a directory to write the status");
if (newDir != null) {
@@ -449,29 +455,58 @@
newDir = new File(newDir, "all");
}
newDir.mkdir();
- if (full) {
- newDir = new File(newDir, "full");
+ if ((WRITE_STATUS & IPerformancesConstants.STATUS_VALUES) != 0) {
+ newDir = new File(newDir, "values");
}
+ int buildsNumber = WRITE_STATUS & IPerformancesConstants.STATUS_BUILDS_NUMBER_MASK;
+ if (buildsNumber > 1) {
+ newDir = new File(newDir, Integer.toString(buildsNumber));
+ }
+ newDir.mkdirs();
String prefix = this.results.getName();
File resultsFile = new File(newDir, prefix+".log");
+ File exclusionFile = new File(newDir, prefix+"_excluded.log");
if (resultsFile.exists()) {
int i=0;
while (true) {
String newFileName = prefix+"_";
if (i<10) newFileName += "0";
- newFileName += i+".log";
- File renamedFile = new File(newDir, newFileName);
- if (resultsFile.renameTo(renamedFile)) break;
+ newFileName += i;
+ File renamedFile = new File(newDir, newFileName+".log");
+ if (resultsFile.renameTo(renamedFile)) {
+ File renamedExclusionFile = new File(newDir, newFileName+"_excluded.log");
+ exclusionFile.renameTo(renamedExclusionFile);
+ break;
+ }
i++;
}
}
ResultsElement[] components = this.results.getChildren();
int length = components.length;
+ StringBuffer fullExcluded = new StringBuffer();
for (int i=0; i<length; i++) {
- if (!this.results.writeStatus(resultsFile, full)) {
+ StringBuffer excluded = this.results.writeStatus(resultsFile, WRITE_STATUS);
+ if (excluded == null) {
MessageDialog.openWarning(this.shell, getTitleToolTip(), "The component is not read, hence no results can be written!");
+ } else {
+ fullExcluded.append(excluded);
}
}
+
+ // Write exclusion file
+ try {
+ DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(exclusionFile)));
+ try {
+ stream.write(fullExcluded.toString().getBytes());
+ }
+ finally {
+ stream.close();
+ }
+ } catch (FileNotFoundException e) {
+ System.err.println("Can't create exclusion file"+exclusionFile); //$NON-NLS-1$
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
}
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ConfigTab.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ConfigTab.java
index 34bb218..6b50a04 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ConfigTab.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ConfigTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 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
@@ -15,15 +15,8 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.test.internal.performance.results.db.ComponentResults;
-import org.eclipse.test.internal.performance.results.model.BuildResultsElement;
-import org.eclipse.test.internal.performance.results.model.ComponentResultsElement;
-import org.eclipse.test.internal.performance.results.model.ConfigResultsElement;
-import org.eclipse.test.internal.performance.results.model.ResultsElement;
-import org.eclipse.test.internal.performance.results.model.ScenarioResultsElement;
-import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
-import org.eclipse.test.internal.performance.results.utils.Util;
-
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.events.MouseEvent;
@@ -43,9 +36,14 @@
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.ToolTip;
-
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.test.internal.performance.results.db.AbstractResults;
+import org.eclipse.test.internal.performance.results.model.BuildResultsElement;
+import org.eclipse.test.internal.performance.results.model.ComponentResultsElement;
+import org.eclipse.test.internal.performance.results.model.ConfigResultsElement;
+import org.eclipse.test.internal.performance.results.model.ResultsElement;
+import org.eclipse.test.internal.performance.results.model.ScenarioResultsElement;
+import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
+import org.eclipse.test.internal.performance.results.utils.Util;
/**
@@ -375,20 +373,20 @@
}
// Otherwise get values for a scenario
double[] values = (double[]) line.get(col);
- if (values == ComponentResults.NO_BUILD_RESULTS) {
+ if (values == AbstractResults.NO_BUILD_RESULTS) {
item.setText(col, "Missing");
item.setForeground(col, GRAY);
item.setFont(col, italic2);
- } else if (values == ComponentResults.INVALID_RESULTS) {
+ } else if (values == AbstractResults.INVALID_RESULTS) {
item.setText(col, "Invalid");
item.setForeground(col, RED);
item.setFont(col, italic2);
} else {
// Get values array
- double buildValue = values[ComponentResults.BUILD_VALUE_INDEX];
- double baselineValue = values[ComponentResults.BASELINE_VALUE_INDEX];
- double delta = values[ComponentResults.DELTA_VALUE_INDEX];
- double error = values[ComponentResults.DELTA_ERROR_INDEX];
+ double buildValue = values[AbstractResults.BUILD_VALUE_INDEX];
+ double baselineValue = values[AbstractResults.BASELINE_VALUE_INDEX];
+ double delta = values[AbstractResults.DELTA_VALUE_INDEX];
+ double error = values[AbstractResults.DELTA_ERROR_INDEX];
// Set text with delta value
item.setText(col, Util.PERCENTAGE_FORMAT.format(delta));
@@ -398,8 +396,8 @@
// error is over the 3% threshold
item.setImage(col, ResultsElement.WARN_IMAGE);
item.setForeground(col, this.darkyellow);
- toolTipText= "May be not reliable";
- toolTipMessage= "The error on this result is " + Util.PERCENTAGE_FORMAT.format(error) + ", hence it may be not reliable";
+ toolTipText = "May be not reliable";
+ toolTipMessage = "The error on this result is "+Util.PERCENTAGE_FORMAT.format(error)+", hence it may be not reliable";
toolTipStyle |= SWT.ICON_WARNING;
}
if (delta < -0.1) {
@@ -453,7 +451,7 @@
configResultsElement = (ConfigResultsElement) scenarioResultsElement.getResultsElement(this.configName);
configs[col-1] = configResultsElement;
}
- double deviation = configResultsElement.getStatistics()[3];
+ double deviation = configResultsElement == null ? 0 : configResultsElement.getStatistics()[3];
if (deviation > 0.2) {
// deviation is over 20% over the entire history
if (toolTipText == null) {
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferenceInitializer.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferenceInitializer.java
index f71a336..d6bfb1d 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferenceInitializer.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferenceInitializer.java
@@ -40,6 +40,9 @@
defaultPreferences.putBoolean(PRE_DATABASE_LOCAL, IPerformancesConstants.DEFAULT_DATABASE_LOCAL);
defaultPreferences.put(PRE_DATABASE_LOCATION, IPerformancesConstants.NETWORK_DATABASE_LOCATION);
+ // Status
+ defaultPreferences.putInt(PRE_WRITE_STATUS, IPerformancesConstants.DEFAULT_WRITE_STATUS);
+
// Config descriptors
String[][] configDescriptors = PerformanceTestPlugin.getConfigDescriptors();
int cdLength = configDescriptors.length;
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferencePage.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferencePage.java
index c7d4a88..53d9f12 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferencePage.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferencePage.java
@@ -11,6 +11,7 @@
package org.eclipse.test.internal.performance.results.ui;
import java.io.File;
+import java.util.Arrays;
import java.util.Iterator;
import org.osgi.service.prefs.BackingStoreException;
@@ -33,9 +34,11 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -61,14 +64,30 @@
private Button dbRelengRadioButton;
private Button dbLocalRadioButton;
private CCombo defaultDimensionCombo;
-// private Button lastBuildCheckBox;
private CCombo lastBuildCombo;
private List resultsDimensionsList;
private CCombo milestonesCombo;
private Label dbLocationLabel;
+
+ // Status SWT objects
+ private Button statusValuesCheckBox;
+ private Button statusErrorNoneRadioButton;
+ private Button statusErrorNoticeableRadioButton;
+ private Button statusErrorSuspiciousRadioButton;
+ private Button statusErrorWeirdRadioButton;
+ private Button statusErrorInvalidRadioButton;
+ private Button statusSmallBuildValueCheckBox;
+ private Button statusSmallDeltaValueCheckBox;
+ private Button statusStatisticNoneRadioButton;
+ private Button statusStatisticErraticRadioButton;
+ private Button statusStatisticUnstableRadioButton;
+ private Text statusBuildsToConfirm;
+
// TODO See whether config descriptors need to be set as preferences or not...
// private Table configDescriptorsTable;
+ private BuildsView buildsView;
+
/**
* Utility method that creates a push button instance and sets the default
* layout data.
@@ -143,77 +162,119 @@
*/
protected Control createContents(Composite parent) {
- // Eclipse version choice
- Composite composite_eclipseVersion = createComposite(parent, 5, 1);
- createLabel(composite_eclipseVersion, "Eclipse version", false);
- Composite composite_versionChoice = createComposite(composite_eclipseVersion, 5, 1);
- this.mVersionRadioButton = createRadioButton(composite_versionChoice, "v"+ECLIPSE_MAINTENANCE_VERSION);
- this.dVersionRadionButton = createRadioButton(composite_versionChoice, "v"+ECLIPSE_DEVELOPMENT_VERSION);
+ this.buildsView = (BuildsView) PerformancesView.getWorkbenchView("org.eclipse.test.internal.performance.results.ui.BuildsView");
+ if (this.buildsView == null) {
+ Label errorLabel = createLabel(parent, "No performances preferences can be set because the build view has not been created yet!", false);
+ errorLabel.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
+ } else {
+ // Eclipse version choice
+ Composite composite_eclipseVersion = createComposite(parent, 5, 1);
+ createLabel(composite_eclipseVersion, "Eclipse version", false);
+ Composite composite_versionChoice = createComposite(composite_eclipseVersion, 5, 1);
+ this.mVersionRadioButton = createRadioButton(composite_versionChoice, "v"+ECLIPSE_MAINTENANCE_VERSION);
+ this.dVersionRadionButton = createRadioButton(composite_versionChoice, "v"+ECLIPSE_DEVELOPMENT_VERSION);
- // Database location
- Composite compositeDatabase = createComposite(parent, 5, 1);
- Group databaseGroup = createGroup(compositeDatabase, "Database");
- Composite compositeDatabaseConnection = createComposite(databaseGroup, 3, 5);
- this.dbConnectionCheckBox = createCheckBox(compositeDatabaseConnection, "Connected");
- this.dbRelengRadioButton = createRadioButton(compositeDatabaseConnection, "Releng");
- this.dbLocalRadioButton = createRadioButton(compositeDatabaseConnection, "Local");
- this.dbLocationLabel = createLabel(databaseGroup, "Location", false);
- this.databaseLocationCombo = createCombo(databaseGroup);
- this.databaseLocationCombo.setEditable(false);
- this.dbLocalBrowseButton = createPushButton(databaseGroup, "Browse");
+ // Database location
+ Composite compositeDatabase = createComposite(parent, 5, 1);
+ Group databaseGroup = createGroup(compositeDatabase, "Database", 5);
+ Composite compositeDatabaseConnection = createComposite(databaseGroup, 3, 5);
+ this.dbConnectionCheckBox = createCheckBox(compositeDatabaseConnection, "Connected");
+ this.dbRelengRadioButton = createRadioButton(compositeDatabaseConnection, "Releng");
+ this.dbLocalRadioButton = createRadioButton(compositeDatabaseConnection, "Local");
+ this.dbLocationLabel = createLabel(databaseGroup, "Location", false);
+ this.databaseLocationCombo = createCombo(databaseGroup);
+ this.databaseLocationCombo.setEditable(false);
+ this.dbLocalBrowseButton = createPushButton(databaseGroup, "Browse");
- // Milestones
- Composite compositeMilestones = createComposite(parent, 3, 1);
- createLabel(compositeMilestones, "Milestones", false);
- this.milestonesCombo = createCombo(compositeMilestones);
- this.milestonesCombo.setToolTipText("Enter the date of the milestone as yyyymmddHHMM");
+ // Status
+ Composite compositeStatus = createComposite(parent, 1, 3);
+ Group statusGroup = createGroup(compositeStatus, "Status", 1);
+ this.statusValuesCheckBox = createCheckBox(statusGroup, "Values");
+ this.statusValuesCheckBox.setToolTipText("Include numbers while writing status");
+ Group statusErrorGroup = createGroup(statusGroup, "Error level", 5);
+ statusErrorGroup.setToolTipText("Exclude from the written status failures depending on their build result error...");
+ this.statusErrorNoneRadioButton = createRadioButton(statusErrorGroup, "None");
+ this.statusErrorNoneRadioButton.setToolTipText("Do not exclude failures if they have a noticeable error");
+ this.statusErrorInvalidRadioButton = createRadioButton(statusErrorGroup, "Invalid");
+ this.statusErrorInvalidRadioButton.setToolTipText("Exclude all invalid failures (i.e. result error is over 100%)");
+ this.statusErrorWeirdRadioButton = createRadioButton(statusErrorGroup, "Weird");
+ this.statusErrorWeirdRadioButton.setToolTipText("Exclude all weird failures (i.e. result error is over 50%)");
+ this.statusErrorSuspiciousRadioButton = createRadioButton(statusErrorGroup, "Suspicious");
+ this.statusErrorSuspiciousRadioButton.setToolTipText("Exclude all suspicious failures (i.e. result error is over 25%)");
+ this.statusErrorNoticeableRadioButton = createRadioButton(statusErrorGroup, "Noticeable");
+ this.statusErrorNoticeableRadioButton.setToolTipText("Exclude all failures which have a noticeable error (i.e result error is over 3%)");
+ Group statusSmallGroup = createGroup(statusGroup, "Small value", 5);
+ statusErrorGroup.setToolTipText("Exclude from the written status failures depending on their value");
+ this.statusSmallBuildValueCheckBox = createCheckBox(statusSmallGroup, "Build value");
+ this.statusSmallBuildValueCheckBox.setToolTipText("Exclude all failures which have a build result value smaller than 100ms");
+ this.statusSmallDeltaValueCheckBox = createCheckBox(statusSmallGroup, "Delta value");
+ this.statusSmallDeltaValueCheckBox.setToolTipText("Exclude all failures which have a delta result value smaller than 100ms");
+ Group statusStatisticsGroup = createGroup(statusGroup, "Statistics", 5);
+ statusStatisticsGroup.setToolTipText("Exclude from the written status failures depending on build results statistics...");
+ this.statusStatisticNoneRadioButton = createRadioButton(statusStatisticsGroup, "None");
+ this.statusStatisticNoneRadioButton.setToolTipText("Do not exclude failures which have bad baseline results statistics (i.e. variation is over 10%)");
+ this.statusStatisticUnstableRadioButton = createRadioButton(statusStatisticsGroup, "Unstable");
+ this.statusStatisticUnstableRadioButton.setToolTipText("Exclude all failures which have unstable baseline results statistics (i.e. variation is between 10% and 20%)");
+ this.statusStatisticErraticRadioButton = createRadioButton(statusStatisticsGroup, "Erratic");
+ this.statusStatisticErraticRadioButton.setToolTipText("Exclude all failures which have erratic baseline results statistics (i.e. variation is over 20%)");
+ createLabel(statusGroup, "Builds to confirm:", false);
+ this.statusBuildsToConfirm = createTextField(statusGroup);
+ this.statusBuildsToConfirm.setToolTipText("The number of previous builds to take into account to confirm a regression");
- // Last build
- StringBuffer tooltip = new StringBuffer("Select the last build to display performance results\n");
- tooltip.append("If set then performance results won't be displayed for any build after this date...");
- String tooltipText = tooltip.toString();
- Composite compositeLastBuild = createComposite(parent, 3, 1);
-// this.lastBuildCheckBox = createCheckBox(compositeLastBuild, "Until last build");
- createLabel(compositeLastBuild, "Last build: ", false);
- this.lastBuildCombo = createCombo(compositeLastBuild);
- this.lastBuildCombo.setEditable(false);
- this.lastBuildCombo.setToolTipText(tooltipText);
- initBuildsList();
+ // Milestones
+ Composite compositeMilestones = createComposite(parent, 3, 1);
+ createLabel(compositeMilestones, "Milestones", false);
+ this.milestonesCombo = createCombo(compositeMilestones);
+ this.milestonesCombo.setToolTipText("Enter the date of the milestone as yyyymmddHHMM");
- // Default dimension layout
- tooltip = new StringBuffer("Select the default dimension which will be used for performance results\n");
- tooltip.append("When changed, the new selected dimension is automatically added to the dimensions list below...");
- tooltipText = tooltip.toString();
- Composite compositeDefaultDimension = createComposite(parent, 3, 1);
- createLabel(compositeDefaultDimension, "Default dimension: ", false);
- this.defaultDimensionCombo = createCombo(compositeDefaultDimension);
- this.defaultDimensionCombo.setEditable(false);
- this.defaultDimensionCombo.setToolTipText(tooltipText);
+ // Last build
+ StringBuffer tooltip = new StringBuffer("Select the last build to display performance results\n");
+ tooltip.append("If set then performance results won't be displayed for any build after this date...");
+ String tooltipText = tooltip.toString();
+ Composite compositeLastBuild = createComposite(parent, 3, 1);
+ // this.lastBuildCheckBox = createCheckBox(compositeLastBuild, "Until last build");
+ createLabel(compositeLastBuild, "Last build: ", false);
+ this.lastBuildCombo = createCombo(compositeLastBuild);
+ this.lastBuildCombo.setEditable(false);
+ this.lastBuildCombo.setToolTipText(tooltipText);
+ this.lastBuildCombo.add("");
+ initBuildsList();
- // Results dimensions layout
- tooltip = new StringBuffer("Select the dimensions which will be used while generating performance results\n");
- tooltip.append("When changed, the default dimension above is automatically added to the new list...");
- tooltipText = tooltip.toString();
- Composite compositeResultsDimensions = createComposite(parent, 3, 1);
- createLabel(compositeResultsDimensions, "Results dimensions: ", true/*beginning*/);
- this.resultsDimensionsList = createList(compositeResultsDimensions);
- this.resultsDimensionsList.setToolTipText(tooltipText);
+ // Default dimension layout
+ tooltip = new StringBuffer("Select the default dimension which will be used for performance results\n");
+ tooltip.append("When changed, the new selected dimension is automatically added to the dimensions list below...");
+ tooltipText = tooltip.toString();
+ Composite compositeDefaultDimension = createComposite(parent, 3, 1);
+ createLabel(compositeDefaultDimension, "Default dimension: ", false);
+ this.defaultDimensionCombo = createCombo(compositeDefaultDimension);
+ this.defaultDimensionCombo.setEditable(false);
+ this.defaultDimensionCombo.setToolTipText(tooltipText);
- // Config descriptors layout
- /* TODO See whether config descriptors need to be set as preferences or not...
- Composite compositeConfigDescriptors = createComposite(parent, 3);
- createLabel(compositeConfigDescriptors, "Config descriptors: ", false);
- this.configDescriptorsTable = createTable(compositeConfigDescriptors);
- TableColumn firstColumn = new TableColumn(this.configDescriptorsTable, SWT.LEFT);
- firstColumn.setText ("Name");
- firstColumn.setWidth(50);
- TableColumn secondColumn = new TableColumn(this.configDescriptorsTable, SWT.FILL | SWT.LEFT);
- secondColumn.setText ("Description");
- secondColumn.setWidth(300);
- */
+ // Results dimensions layout
+ tooltip = new StringBuffer("Select the dimensions which will be used while generating performance results\n");
+ tooltip.append("When changed, the default dimension above is automatically added to the new list...");
+ tooltipText = tooltip.toString();
+ Composite compositeResultsDimensions = createComposite(parent, 3, 1);
+ createLabel(compositeResultsDimensions, "Results dimensions: ", true/*beginning*/);
+ this.resultsDimensionsList = createList(compositeResultsDimensions);
+ this.resultsDimensionsList.setToolTipText(tooltipText);
- // init values
- initializeValues();
+ // Config descriptors layout
+ /* TODO See whether config descriptors need to be set as preferences or not...
+ Composite compositeConfigDescriptors = createComposite(parent, 3);
+ createLabel(compositeConfigDescriptors, "Config descriptors: ", false);
+ this.configDescriptorsTable = createTable(compositeConfigDescriptors);
+ TableColumn firstColumn = new TableColumn(this.configDescriptorsTable, SWT.LEFT);
+ firstColumn.setText ("Name");
+ firstColumn.setWidth(50);
+ TableColumn secondColumn = new TableColumn(this.configDescriptorsTable, SWT.FILL | SWT.LEFT);
+ secondColumn.setText ("Description");
+ secondColumn.setWidth(300);
+ */
+
+ // init values
+ initializeValues();
+ }
// font = null;
Composite contents = new Composite(parent, SWT.NULL);
@@ -231,9 +292,9 @@
* the text for the new label
* @return the new label
*/
-private Group createGroup(Composite parent, String text) {
+private Group createGroup(Composite parent, String text, int columns) {
Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout(5, false));
+ group.setLayout(new GridLayout(columns, false));
group.setText(text);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
// data.horizontalSpan = 1;
@@ -348,7 +409,7 @@
* @param parent
* the parent of the new text field
* @return the new text field
- *
+ */
private Text createTextField(Composite parent) {
Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
text.addModifyListener(this);
@@ -433,8 +494,9 @@
*/
private void initBuildsList() {
String[] builds = DB_Results.getBuilds();
+ Arrays.sort(builds, Util.BUILD_DATE_COMPARATOR);
int length = builds.length;
- for (int i=0; i<length; i++) {
+ for (int i=length-1; i>=0; i--) {
this.lastBuildCombo.add(builds[i]);
}
}
@@ -460,6 +522,10 @@
this.databaseLocationCombo.setText(store.getString(PRE_DATABASE_LOCATION));
updateDatabaseGroup();
+ // Init default status values
+ int writeStatus = store.getDefaultInt(PRE_WRITE_STATUS);
+ initStatusValues(writeStatus);
+
// Init eclipse version
this.mVersionRadioButton.setSelection(false);
this.dVersionRadionButton.setSelection(false);
@@ -506,6 +572,7 @@
private void initializeValues() {
IPreferenceStore store = getPreferenceStore();
+ // Init database info
this.dbConnectionCheckBox.setSelection(store.getBoolean(PRE_DATABASE_CONNECTION));
final boolean dbLocal = store.getBoolean(PRE_DATABASE_LOCAL);
if (dbLocal) {
@@ -525,6 +592,9 @@
}
updateDatabaseGroup();
+ // Init status values
+ int writeStatus = store.getInt(PRE_WRITE_STATUS);
+ initStatusValues(writeStatus);
// Init eclipse version
int version = store.getInt(PRE_ECLIPSE_VERSION);
@@ -593,6 +663,50 @@
}
/**
+ * @param store
+ */
+private void initStatusValues(int writeStatus) {
+ this.statusValuesCheckBox.setSelection((writeStatus & STATUS_VALUES) != 0);
+ switch (writeStatus & STATUS_ERROR_LEVEL_MASK) {
+ case STATUS_ERROR_NONE:
+ this.statusErrorNoneRadioButton.setSelection(true);
+ break;
+ case STATUS_ERROR_NOTICEABLE:
+ this.statusErrorNoticeableRadioButton.setSelection(true);
+ break;
+ case STATUS_ERROR_SUSPICIOUS:
+ this.statusErrorSuspiciousRadioButton.setSelection(true);
+ break;
+ case STATUS_ERROR_WEIRD:
+ this.statusErrorWeirdRadioButton.setSelection(true);
+ break;
+ case STATUS_ERROR_INVALID:
+ this.statusErrorInvalidRadioButton.setSelection(true);
+ break;
+ }
+ switch (writeStatus & STATUS_SMALL_VALUE_MASK) {
+ case STATUS_SMALL_VALUE_BUILD:
+ this.statusSmallBuildValueCheckBox.setSelection(true);
+ break;
+ case STATUS_SMALL_VALUE_DELTA:
+ this.statusSmallDeltaValueCheckBox.setSelection(true);
+ break;
+ }
+ switch (writeStatus & STATUS_STATISTICS_MASK) {
+ case 0:
+ this.statusStatisticNoneRadioButton.setSelection(true);
+ break;
+ case STATUS_STATISTICS_ERRATIC:
+ this.statusStatisticErraticRadioButton.setSelection(true);
+ break;
+ case STATUS_STATISTICS_UNSTABLE:
+ this.statusStatisticUnstableRadioButton.setSelection(true);
+ break;
+ }
+ this.statusBuildsToConfirm.setText(String.valueOf(writeStatus & STATUS_BUILDS_NUMBER_MASK));
+}
+
+/**
* (non-Javadoc) Method declared on ModifyListener
*/
public void modifyText(ModifyEvent event) {
@@ -724,6 +838,25 @@
this.milestonesCombo.setText("");
}
}
+
+ // Verify the 'builds to confirm' number
+ if (event.getSource() == this.statusBuildsToConfirm) {
+ try {
+ int number = Integer.parseInt(this.statusBuildsToConfirm.getText());
+ if (number < 1 ) {
+ this.statusBuildsToConfirm.setText("1");
+ } else {
+ int buildsNumber = DB_Results.getBuildsNumber();
+ if (number > buildsNumber) {
+ this.statusBuildsToConfirm.setText(String.valueOf(buildsNumber));
+ }
+ }
+ }
+ catch (NumberFormatException nfe) {
+ this.statusBuildsToConfirm.setText("1");
+ }
+
+ }
}
@@ -746,17 +879,17 @@
* (non-Javadoc) Method declared on PreferencePage
*/
public boolean performOk() {
- storeValues();
- try {
- IEclipsePreferences preferences = new InstanceScope().getNode(PLUGIN_ID);
- preferences.flush();
- BuildsView buildsView = (BuildsView) PerformancesView.getWorkbenchView("org.eclipse.test.internal.performance.results.ui.BuildsView");
- if (buildsView != null) {
- buildsView.resetView();
+ final boolean hasBuildsView = this.buildsView != null;
+ if (hasBuildsView) {
+ storeValues();
+ try {
+ IEclipsePreferences preferences = new InstanceScope().getNode(PLUGIN_ID);
+ preferences.flush();
+ this.buildsView.resetView();
+ } catch (BackingStoreException e) {
+ e.printStackTrace();
+ return false;
}
- } catch (BackingStoreException e) {
- e.printStackTrace();
- return false;
}
return true;
}
@@ -808,6 +941,38 @@
i++;
}
+ // Set status values
+ int writeStatus = 0;
+ if (this.statusValuesCheckBox.getSelection()) {
+ writeStatus |= STATUS_VALUES;
+ }
+ if (this.statusErrorNoneRadioButton.getSelection()) {
+ writeStatus |= STATUS_ERROR_NONE;
+ } else if (this.statusErrorNoticeableRadioButton.getSelection()) {
+ writeStatus |= STATUS_ERROR_NOTICEABLE;
+ } else if (this.statusErrorSuspiciousRadioButton.getSelection()) {
+ writeStatus |= STATUS_ERROR_SUSPICIOUS;
+ } else if (this.statusErrorWeirdRadioButton.getSelection()) {
+ writeStatus |= STATUS_ERROR_WEIRD;
+ } else if (this.statusErrorInvalidRadioButton.getSelection()) {
+ writeStatus |= STATUS_ERROR_INVALID;
+ }
+ if (this.statusSmallBuildValueCheckBox.getSelection()) {
+ writeStatus |= STATUS_SMALL_VALUE_BUILD;
+ }
+ if (this.statusSmallDeltaValueCheckBox.getSelection()) {
+ writeStatus |= STATUS_SMALL_VALUE_DELTA;
+ }
+ if (this.statusStatisticNoneRadioButton.getSelection()) {
+ writeStatus &= ~STATUS_STATISTICS_MASK;
+ } else if (this.statusStatisticErraticRadioButton.getSelection()) {
+ writeStatus |= STATUS_STATISTICS_ERRATIC;
+ } else if (this.statusStatisticUnstableRadioButton.getSelection()) {
+ writeStatus |= STATUS_STATISTICS_UNSTABLE;
+ }
+ writeStatus += Integer.parseInt(this.statusBuildsToConfirm.getText());
+ store.setValue(PRE_WRITE_STATUS, writeStatus);
+
// Set milestones
count = this.milestonesCombo.getItemCount();
for (i=0; i<count; i++) {
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformancesView.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformancesView.java
index 8b00dee..f9e8ca4 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformancesView.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformancesView.java
@@ -198,6 +198,10 @@
// Init milestones
Util.initMilestones(this.preferences);
+
+ // Init last build
+ String lastBuild = this.preferences.get(IPerformancesConstants.PRE_LAST_BUILD, null);
+ LAST_BUILD = lastBuild.length() == 0 ? null : lastBuild;
}
File changeDataDir() {
@@ -214,6 +218,14 @@
refresh = true;
}
if (refresh) {
+ // Confirm the read when there's a last build set
+ if (LAST_BUILD != null) {
+ if (!MessageDialog.openConfirm(PerformancesView.this.shell, getTitleToolTip(), "Only builds before "+LAST_BUILD+" will be taken into account!\nDo you want to continue?")) {
+ return null;
+ }
+ }
+
+ // Read local files
readLocalFiles();
// Refresh views
@@ -495,7 +507,7 @@
*/
public void preferenceChange(PreferenceChangeEvent event) {
String propertyName = event.getKey();
- String newValue = (String) event.getNewValue();
+// String newValue = (String) event.getNewValue();
// Eclipse version change
if (propertyName.equals(IPerformancesConstants.PRE_ECLIPSE_VERSION)) {
@@ -525,12 +537,14 @@
// Last build
if (propertyName.equals(IPerformancesConstants.PRE_LAST_BUILD)) {
- LAST_BUILD = newValue;
- if (newValue == null) {
- this.filterLastBuilds.setEnabled(false);
- } else {
- this.filterLastBuilds.setToolTipText("Filter last builds (i.e. after "+newValue+" build)");
- }
+// if (newValue == null || newValue.length() == 0) {
+// this.filterLastBuilds.setEnabled(false);
+// LAST_BUILD = null;
+// } else {
+// this.filterLastBuilds.setEnabled(true);
+// this.filterLastBuilds.setToolTipText("Filter last builds (i.e. after "+newValue+" build)");
+// LAST_BUILD = newValue;
+// }
}
}
@@ -544,7 +558,7 @@
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
monitor.beginTask("Read local files", 1000);
- PerformancesView.this.results.readLocal(PerformancesView.this.dataDir, monitor);
+ PerformancesView.this.results.readLocal(PerformancesView.this.dataDir, monitor, LAST_BUILD);
monitor.done();
} catch (Exception e) {
e.printStackTrace();
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/utils/IPerformancesConstants.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/utils/IPerformancesConstants.java
index c1b70f8..31f5a69 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/utils/IPerformancesConstants.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/utils/IPerformancesConstants.java
@@ -23,7 +23,7 @@
public static final String PRE_FULL_LINE_SELECTION = PREFIX + "full.line.selection"; //$NON-NLS-1$
public static final String PRE_WRITE_RESULTS_DIR = PREFIX + "write.results.dir"; //$NON-NLS-1$
- // Preference constants
+ // Preference constants
public static final String PRE_ECLIPSE_VERSION = PREFIX + "eclipse.version"; //$NON-NLS-1$
public static final String PRE_DATABASE_CONNECTION = PREFIX + "database.connection"; //$NON-NLS-1$
public static final String PRE_DATABASE_LOCAL = PREFIX + "local"; //$NON-NLS-1$
@@ -57,10 +57,33 @@
public static final boolean DEFAULT_DATABASE_CONNECTION = false;
public static final boolean DEFAULT_DATABASE_LOCAL = false;
+ // Status
+ public static final String PRE_WRITE_STATUS = PREFIX + "write.status"; //$NON-NLS-1$
+ public static final int STATUS_BUILDS_NUMBER_MASK= 0x00FF;
+ public static final int DEFAULT_BUILDS_NUMBER = 1;
+ public static final int STATUS_VALUES = 0x0100;
+ public static final int STATUS_ERROR_NONE = 0x0200;
+ public static final int STATUS_ERROR_NOTICEABLE = 0x0400;
+ public static final int STATUS_ERROR_SUSPICIOUS = 0x0600;
+ public static final int STATUS_ERROR_WEIRD = 0x0800;
+ public static final int STATUS_ERROR_INVALID = 0x0A00;
+ public static final int STATUS_ERROR_LEVEL_MASK = 0x0E00;
+ public static final int STATUS_SMALL_VALUE_BUILD = 0x1000;
+ public static final int STATUS_SMALL_VALUE_DELTA = 0x2000;
+ public static final int STATUS_SMALL_VALUE_MASK = 0x3000;
+ public static final int STATUS_STATISTICS_ERRATIC = 0x4000;
+ public static final int STATUS_STATISTICS_UNSTABLE = 0x8000;
+ public static final int STATUS_STATISTICS_MASK = 0xC000;
+ public static final int DEFAULT_WRITE_STATUS = STATUS_ERROR_NONE | DEFAULT_BUILDS_NUMBER;
+
// Default milestones nowadays
public static final String[] V36_MILESTONES = new String[] {
"M1-200908060100",
"M2-200909170100",
+ "M3-200910301201",
+ "M4-200912101301",
+ "M5-201001291300",
+ "M6-201003121448",
};
public static final String[] V35_MILESTONES = new String[] {
"M1-200808071402",