Get rid of org.eclipse.ui and ui.views deps.
Not used at all.
Change-Id: If98ace46da4418198c002de6c6cb2ad86d5bc1fd
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.test.performance.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.test.performance.ui/META-INF/MANIFEST.MF
index 2e40a62..c41b334 100644
--- a/bundles/org.eclipse.test.performance.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.test.performance.ui/META-INF/MANIFEST.MF
@@ -10,12 +10,10 @@
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.junit,
- org.eclipse.ui.views;bundle-version="3.4.0";resolution:=optional,
org.eclipse.test.performance;bundle-version="3.14.0",
- org.eclipse.ui;bundle-version="3.5.0";resolution:=optional
+ org.eclipse.swt;bundle-version="3.5.0";resolution:=optional
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.test.internal.performance.results.db;x-internal:=true,
- org.eclipse.test.internal.performance.results.model;x-internal:=true,
org.eclipse.test.internal.performance.results.ui;x-internal:=true,
org.eclipse.test.internal.performance.results.utils;x-internal:=true,
org.eclipse.test.performance.ui
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsElement.java
deleted file mode 100644
index a1a9a9f..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsElement.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2018 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.internal.performance.results.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.test.internal.performance.data.Dim;
-import org.eclipse.test.internal.performance.eval.StatisticsUtil;
-import org.eclipse.test.internal.performance.results.db.AbstractResults;
-import org.eclipse.test.internal.performance.results.db.BuildResults;
-import org.eclipse.test.internal.performance.results.db.ConfigResults;
-import org.eclipse.test.internal.performance.results.utils.Util;
-import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-public class BuildResultsElement extends ResultsElement {
-
- // Property descriptors
- static final String P_ID_BUILD_DATE = "BuildResultsElement.date"; //$NON-NLS-1$
- static final String P_ID_BUILD_BASELINE = "BuildResultsElement.baseline"; //$NON-NLS-1$
- static final String P_ID_BUILD_COMMENT = "BuildResultsElement.comment"; //$NON-NLS-1$
- static final String P_ID_BUILD_SUMMARY_KIND = "BuildResultsElement.summarykind"; //$NON-NLS-1$
- static final String P_ID_BUILD_IS_BASELINE = "BuildResultsElement.isbaseline"; //$NON-NLS-1$
- static final String P_ID_BUILD_FAILURE = "BuildResultsElement.failure"; //$NON-NLS-1$
- static final String P_ID_BUILD_DELTA = "BuildResultsElement.delta"; //$NON-NLS-1$
- static final String P_ID_BUILD_ERROR = "BuildResultsElement.error"; //$NON-NLS-1$
- static final String P_ID_BUILD_TTEST = "BuildResultsElement.ttest"; //$NON-NLS-1$
-
- static final String P_STR_BUILD_DATE = "date"; //$NON-NLS-1$
- static final String P_STR_BUILD_COMMENT = "comment"; //$NON-NLS-1$
- static final String P_STR_BUILD_SUMMARY_KIND = "summary kind"; //$NON-NLS-1$
- static final String P_STR_BUILD_IS_BASELINE = "is baseline"; //$NON-NLS-1$
- static final String P_STR_BUILD_BASELINE = "baseline"; //$NON-NLS-1$
- static final String P_STR_BUILD_FAILURE = "failure"; //$NON-NLS-1$
- static final String P_STR_BUILD_DELTA = "delta with baseline"; //$NON-NLS-1$
- static final String P_STR_BUILD_ERROR = "delta error"; //$NON-NLS-1$
- static final String P_STR_BUILD_TTEST = "student's ttest"; //$NON-NLS-1$
-
- private static final TextPropertyDescriptor BUILD_DATE_DESCRIPTOR = new TextPropertyDescriptor(P_ID_BUILD_DATE, P_STR_BUILD_DATE);
- private static final TextPropertyDescriptor BUILD_COMMENT_DESCRIPTOR = new TextPropertyDescriptor(P_ID_BUILD_COMMENT, P_STR_BUILD_COMMENT);
- private static final TextPropertyDescriptor BUILD_SUMMARY_DESCRIPTOR = new TextPropertyDescriptor(P_ID_BUILD_SUMMARY_KIND, P_STR_BUILD_SUMMARY_KIND);
- private static final PropertyDescriptor BUILD_IS_BASELINE_DESCRIPTOR = new PropertyDescriptor(P_ID_BUILD_IS_BASELINE, P_STR_BUILD_IS_BASELINE);
- private static final PropertyDescriptor BUILD_BASELINE_DESCRIPTOR = new PropertyDescriptor(P_ID_BUILD_BASELINE, P_STR_BUILD_BASELINE);
- private static final TextPropertyDescriptor BUILD_TEST_FAILURE_DESCRIPTOR = new TextPropertyDescriptor(P_ID_BUILD_FAILURE, P_STR_BUILD_FAILURE);
- private static final PropertyDescriptor BUILD_TEST_DELTA_DESCRIPTOR = new PropertyDescriptor(P_ID_BUILD_DELTA, P_STR_BUILD_DELTA);
- private static final PropertyDescriptor BUILD_TEST_ERROR_DESCRIPTOR = new PropertyDescriptor(P_ID_BUILD_ERROR, P_STR_BUILD_ERROR);
- private static final PropertyDescriptor BUILD_STUDENTS_TTEST_DESCRIPTOR = new PropertyDescriptor(P_ID_BUILD_TTEST, P_STR_BUILD_TTEST);
-
- private static Vector<IPropertyDescriptor> DESCRIPTORS;
- static Vector<IPropertyDescriptor> initDescriptors(int status) {
- DESCRIPTORS = new Vector<>();
- // Status category
- DESCRIPTORS.add(getInfosDescriptor(status));
- DESCRIPTORS.add(getWarningsDescriptor(status));
- DESCRIPTORS.add(ERROR_DESCRIPTOR);
- ERROR_DESCRIPTOR.setCategory("Status");
- // Results category
- DESCRIPTORS.add(BUILD_DATE_DESCRIPTOR);
- BUILD_DATE_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.add(BUILD_BASELINE_DESCRIPTOR);
- BUILD_BASELINE_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.add(BUILD_COMMENT_DESCRIPTOR);
- BUILD_COMMENT_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.add(BUILD_SUMMARY_DESCRIPTOR);
- BUILD_SUMMARY_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.add(BUILD_IS_BASELINE_DESCRIPTOR);
- BUILD_IS_BASELINE_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.add(BUILD_TEST_FAILURE_DESCRIPTOR);
- BUILD_TEST_FAILURE_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.add(BUILD_TEST_DELTA_DESCRIPTOR);
- BUILD_TEST_DELTA_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.add(BUILD_TEST_ERROR_DESCRIPTOR);
- BUILD_TEST_ERROR_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.add(BUILD_STUDENTS_TTEST_DESCRIPTOR);
- BUILD_STUDENTS_TTEST_DESCRIPTOR.setCategory("Results");
- // Survey category
- DESCRIPTORS.add(COMMENT_DESCRIPTOR);
- COMMENT_DESCRIPTOR.setCategory("Survey");
- return DESCRIPTORS;
- }
- static ComboBoxPropertyDescriptor getInfosDescriptor(int status) {
- List<String> list = new ArrayList<>();
- if ((status & SMALL_VALUE) != 0) {
- list.add("This test and/or its variation has a small value, hence it may not be necessary to spend time on fixing it if a regression occurs");
- }
- if ((status & STUDENT_TTEST) != 0) {
- list.add("The student-t test error on this test is over the threshold");
- }
- String[] infos = new String[list.size()];
- if (list.size() > 0) {
- list.toArray(infos);
- }
- ComboBoxPropertyDescriptor infoDescriptor = new ComboBoxPropertyDescriptor(P_ID_STATUS_INFO, P_STR_STATUS_INFO, infos);
- infoDescriptor.setCategory("Status");
- return infoDescriptor;
- }
- static PropertyDescriptor getWarningsDescriptor(int status) {
- List<String> list = new ArrayList<>();
- if ((status & BIG_ERROR) != 0) {
- list.add("The error on this test is over the 3% threshold, hence its result may not be really reliable");
- }
- if ((status & NOT_RELIABLE) != 0) {
- list.add("The results history shows that the variation of its delta is over 20%, hence its result is surely not reliable");
- }
- if ((status & NOT_STABLE) != 0) {
- list.add("The results history shows that the variation of its delta is between 10% and 20%, hence its result may not be really reliable");
- }
- if ((status & NO_BASELINE) != 0) {
- list.add("There's no baseline to compare with");
- }
- if ((status & SINGLE_RUN) != 0) {
- list.add("This test has only one run, hence no error can be computed to verify if it's stable enough to be reliable");
- }
- String[] warnings = new String[list.size()];
- if (list.size() > 0) {
- list.toArray(warnings);
- }
- ComboBoxPropertyDescriptor warningDescriptor = new ComboBoxPropertyDescriptor(P_ID_STATUS_WARNING, P_STR_STATUS_WARNING, warnings);
- warningDescriptor.setCategory("Status");
- return warningDescriptor;
- }
- static Vector<IPropertyDescriptor> getDescriptors() {
- return DESCRIPTORS;
- }
-
- // Model info
- boolean important;
- boolean milestone;
-
-public BuildResultsElement(AbstractResults results, ResultsElement parent) {
- super(results, parent);
-}
-
-public BuildResultsElement(String name, ResultsElement parent) {
- super(name, parent);
-}
-
-@Override
-public int compareTo(ResultsElement o) {
- if (o instanceof BuildResultsElement && getName() != null) {
- BuildResultsElement element = (BuildResultsElement) o;
- if (element.getName() != null) {
- String buildDate = Util.getBuildDate(element.name);
- return Util.getBuildDate(this.name).compareTo(buildDate);
- }
- }
- return super.compareTo(o);
-}
-
-@Override
-ResultsElement createChild(AbstractResults testResults) {
- return null;
-}
-
-BuildResults getBuildResults() {
- return (BuildResults) this.results;
-}
-
-@Override
-public Object[] getChildren(Object o) {
- if (this.results == null) {
- return new Object[0];
- }
- if (this.children == null) {
- initChildren();
- }
- return this.children;
-}
-
-@Override
-public Object getEditableValue() {
- if (this.results == null) {
- return "Build "+this.name;
- }
- return this.results.toString();
-}
-
-@Override
-public IPropertyDescriptor[] getPropertyDescriptors() {
- Vector<IPropertyDescriptor> descriptors = getDescriptors();
- if (descriptors == null) {
- descriptors = initDescriptors(getStatus());
- }
- int size = descriptors.size();
- IPropertyDescriptor[] descriptorsArray = new IPropertyDescriptor[size];
- descriptorsArray[0] = getInfosDescriptor(getStatus());
- descriptorsArray[1] = getWarningsDescriptor(getStatus());
- for (int i=2; i<size; i++) {
- descriptorsArray[i] = descriptors.get(i);
- }
- return descriptorsArray;
-}
-
-@Override
-public Object getPropertyValue(Object propKey) {
- BuildResults buildResults = getBuildResults();
- if (buildResults != null) {
- ConfigResults configResults = (ConfigResults) buildResults.getParent();
- BuildResults baselineResults = configResults.getBaselineBuildResults(buildResults.getName());
- if (propKey.equals(P_ID_BUILD_DATE))
- return buildResults.getDate();
- if (propKey.equals(P_ID_BUILD_COMMENT))
- return buildResults.getComment();
- if (propKey.equals(P_ID_BUILD_SUMMARY_KIND)) {
- int summaryKind = buildResults.getSummaryKind();
- if (summaryKind == 1) {
- return "global";
- }
- if (summaryKind >= 0) {
- return "component";
- }
- return "none";
- }
- if (propKey.equals(P_ID_BUILD_IS_BASELINE))
- return Boolean.valueOf(buildResults.isBaseline());
- if (propKey.equals(P_ID_BUILD_FAILURE))
- return buildResults.getFailure();
- if (baselineResults != null) {
- if (propKey.equals(P_ID_BUILD_BASELINE)) {
- return baselineResults.getName();
- }
- double buildValue = buildResults.getValue();
- double baselineValue = baselineResults.getValue();
- double delta = (baselineValue - buildValue) / baselineValue;
- if (Double.isNaN(delta)) {
- if (propKey.equals(P_ID_BUILD_DELTA) || propKey.equals(P_ID_BUILD_ERROR)) {
- return Double.valueOf(Double.NaN);
- }
- } else if (propKey.equals(P_ID_BUILD_DELTA)) {
- return Double.valueOf(delta);
- } else {
- long baselineCount = baselineResults.getCount();
- long currentCount = buildResults.getCount();
- if (baselineCount > 1 && currentCount > 1) {
- if (propKey.equals(P_ID_BUILD_TTEST)) {
- double ttestValue = Util.computeTTest(baselineResults, buildResults);
- int degreeOfFreedom = (int) (baselineResults.getCount()+buildResults.getCount()-2);
- if (ttestValue >= 0 && StatisticsUtil.getStudentsT(degreeOfFreedom, StatisticsUtil.T90) >= ttestValue) {
- return Double.valueOf(ttestValue);
- }
- }
- if (propKey.equals(P_ID_BUILD_ERROR)) {
- double baselineError = baselineResults.getError();
- double currentError = buildResults.getError();
- double error = Double.isNaN(baselineError)
- ? currentError / baselineValue
- : Math.sqrt(baselineError*baselineError + currentError*currentError) / baselineValue;
- return Double.valueOf(error);
- }
- } else {
- if (propKey.equals(P_ID_BUILD_ERROR))
- return Double.valueOf(-1);
- }
- }
- }
- }
- if (propKey.equals(P_ID_STATUS_ERROR)) {
- if ((getStatus() & BIG_DELTA) != 0) {
- return "The delta on this test is over the 10% threshold, hence may indicate a possible regression.";
- }
- }
- return super.getPropertyValue(propKey);
-}
-
-/**
- * Return the statistics of the build along its history.
- *
- * @return An array of double built as follows:
- * <ul>
- * <li>0: numbers of values</li>
- * <li>1: mean of values</li>
- * <li>2: standard deviation of these values</li>
- * <li>3: coefficient of variation of these values</li>
- * </ul>
- */
-@Override
-double[] getStatistics() {
- if (this.statistics == null) {
- this.statistics = ((ConfigResults)getBuildResults().getParent()).getStatistics(Util.BASELINE_BUILD_PREFIXES);
- }
- return this.statistics;
-}
-
-@Override
-void initChildren() {
- BuildResults buildResults = (BuildResults) this.results;
- Dim[] dimensions = buildResults.getDimensions();
- int length = dimensions.length;
- this.children = new DimResultsElement[length];
- for (int i=0; i<length; i++) {
- this.children[i] = new DimResultsElement(this.results, this, dimensions[i]);
- }
-}
-
-@Override
-void initStatus() {
- if (this.results == null) {
- if (this.parent.isInitialized()) {
- if (((PerformanceResultsElement) this.parent).hasRead(this)) {
- this.status = READ;
- } else {
- this.status = UNREAD;
- }
- } else {
- this.status = UNKNOWN;
- }
- } else if (getBuildResults().isBaseline()) {
- // TODO (frederic) report high variation in baseline results along history
- this.status = READ;
- } else {
- initStatus(getBuildResults());
- }
-}
-
-/**
- * Returns whether the build is important to be shown.
- * This is the case for milestone builds or for the last builds.
- *
- * @return <code>true</code> or <code>false</code> .
- */
-public boolean isImportant() {
- return this.important;
-}
-
-public boolean isRead() {
- return (getStatus() & STATE_MASK) == READ;
-}
-
-public boolean isUnknown() {
- return (getStatus() & STATE_MASK) == UNKNOWN;
-}
-
-@Override
-public String toString() {
- return getName();
-}
-public boolean isBefore(String build) {
- if (this.results != null) {
- return Util.getBuildDate(this.name).compareTo(Util.getBuildDate(build)) <= 0;
- }
- return true;
-}
-
-}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsProperties.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsProperties.java
deleted file mode 100644
index c694b04..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsProperties.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.test.internal.performance.results.model;
-
-import java.util.Vector;
-
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-public class BuildResultsProperties {
-
- // Property descriptors
- static final String P_ID_SMALL_VALUE = "BuildResultsProperties.small_value"; //$NON-NLS-1$
- static final String P_ID_NO_BASELINE = "BuildResultsProperties.no_baseline"; //$NON-NLS-1$
- static final String P_ID_SINGLE_RUN = "BuildResultsProperties.single_run"; //$NON-NLS-1$
- static final String P_ID_BIG_ERROR = "BuildResultsProperties.big_error"; //$NON-NLS-1$
- static final String P_ID_STUDENT_TTEST = "BuildResultsProperties.ttest"; //$NON-NLS-1$
- static final String P_ID_NOT_STABLE = "BuildResultsProperties.not_stable"; //$NON-NLS-1$
- static final String P_ID_NOT_RELIABLE = "BuildResultsProperties.not_reliable"; //$NON-NLS-1$
- static final String P_ID_BIG_DELTA = "BuildResultsProperties.big_delta"; //$NON-NLS-1$
- static final String P_STR_SMALL_VALUE = "small value"; //$NON-NLS-1$
- static final String P_STR_NO_BASELINE = "no baseline"; //$NON-NLS-1$
- static final String P_STR_SINGLE_RUN = "single run"; //$NON-NLS-1$
- static final String P_STR_BIG_ERROR = "big error"; //$NON-NLS-1$
- static final String P_STR_STUDENT_TTEST = "student ttest"; //$NON-NLS-1$
- static final String P_STR_NOT_STABLE = "not stable"; //$NON-NLS-1$
- static final String P_STR_NOT_RELIABLE = "not reliable"; //$NON-NLS-1$
- static final String P_STR_BIG_DELTA = "delta error"; //$NON-NLS-1$
- private static Vector<IPropertyDescriptor> descriptors;
- static {
- descriptors = new Vector<>();
- descriptors.addElement(new TextPropertyDescriptor(P_ID_SMALL_VALUE, P_STR_SMALL_VALUE));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_NO_BASELINE, P_STR_NO_BASELINE));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_SINGLE_RUN, P_STR_SINGLE_RUN));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_BIG_ERROR, P_STR_BIG_ERROR));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_STUDENT_TTEST, P_STR_STUDENT_TTEST));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_NOT_STABLE, P_STR_NOT_STABLE));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_NOT_RELIABLE, P_STR_NOT_RELIABLE));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_BIG_DELTA, P_STR_BIG_DELTA));
- }
- static Vector<IPropertyDescriptor> getDescriptors() {
- return descriptors;
- }
-
- private int status;
-
-public BuildResultsProperties() {
-}
-
-void setStatus(int status) {
- this.status = status;
-}
-
-public Object getEditableValue() {
- return null;
-}
-
-public IPropertyDescriptor[] getPropertyDescriptors() {
- return getDescriptors().toArray(
- new IPropertyDescriptor[getDescriptors().size()]);
-}
-
-public Object getPropertyValue(Object propKey) {
- if (propKey.equals(P_ID_SMALL_VALUE)) {
- if ((this.status & ResultsElement.SMALL_VALUE) != 0) {
- return "This test and/or its variation has a small value, hence it may not be necessary to spend time on fixing it if a regression occurs.";
- }
- }
- if (propKey.equals(P_ID_NO_BASELINE)) {
- if ((this.status & ResultsElement.NO_BASELINE) != 0) {
- return "There's no baseline to compare with.";
- }
- }
- if (propKey.equals(P_ID_SINGLE_RUN)) {
- if ((this.status & ResultsElement.SINGLE_RUN) != 0) {
- return "This test has only one run, hence no error can be computed to verify if it's stable enough to be reliable.";
- }
- }
- if (propKey.equals(P_ID_BIG_ERROR)) {
- if ((this.status & ResultsElement.BIG_ERROR) != 0) {
- return "The error on this test is over the 3% threshold, hence its result may not be really reliable.";
- }
- }
- if (propKey.equals(P_ID_STUDENT_TTEST)) {
- if ((this.status & ResultsElement.STUDENT_TTEST) != 0) {
- return "The student-t on this test is over the threshold";
- }
- }
- if (propKey.equals(P_ID_NOT_STABLE)) {
- if ((this.status & ResultsElement.NOT_STABLE) != 0) {
- return "The results history shows that the variation of its delta is between 10% and 20%, hence its result may not be really reliable.";
- }
- }
- if (propKey.equals(P_ID_NOT_RELIABLE)) {
- if ((this.status & ResultsElement.NOT_RELIABLE) != 0) {
- return "The results history shows that the variation of its delta is over 20%, hence its result is surely not reliable.";
- }
- }
- if (propKey.equals(P_ID_BIG_DELTA)) {
- if ((this.status & ResultsElement.BIG_DELTA) != 0) {
- return "The delta on this test is over the 10% threshold, hence may indicate a possible regression.";
- }
- }
- return null;
-}
-
-}
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
deleted file mode 100644
index 3c61515..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ComponentResultsElement.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2017 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.internal.performance.results.model;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-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.AbstractResults;
-import org.eclipse.test.internal.performance.results.db.ComponentResults;
-import org.eclipse.test.internal.performance.results.db.PerformanceResults;
-import org.eclipse.test.internal.performance.results.db.ScenarioResults;
-import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
-import org.eclipse.test.internal.performance.results.utils.Util;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-public class ComponentResultsElement extends ResultsElement {
-
- // Property descriptors
- static final String P_ID_NAME = "ComponentResultsElement.name"; //$NON-NLS-1$
- static final String P_ID_CURRENT_BUILD = "ComponentResultsElement.currentbuild"; //$NON-NLS-1$
- static final String P_ID_BASELINE_BUILD = "ComponentResultsElement.baselinebuild"; //$NON-NLS-1$
-
- static final String P_STR_NAME = "name"; //$NON-NLS-1$
- static final String P_STR_CURRENT_BUILD = "current build"; //$NON-NLS-1$
- static final String P_STR_BASELINE_BUILD = "baseline build"; //$NON-NLS-1$
-
- private static final TextPropertyDescriptor NAME_DESCRIPTOR = new TextPropertyDescriptor(P_ID_NAME, P_STR_NAME);
- private static final PropertyDescriptor CURRENT_BUILD_DESCRIPTOR = new PropertyDescriptor(P_ID_CURRENT_BUILD, P_STR_CURRENT_BUILD);
- private static final PropertyDescriptor BASELINE_BUILD_DESCRIPTOR = new PropertyDescriptor(P_ID_BASELINE_BUILD, P_STR_BASELINE_BUILD);
-
- private static Vector<IPropertyDescriptor> DESCRIPTORS;
- static Vector<IPropertyDescriptor> initDescriptors(int status) {
- DESCRIPTORS = new Vector<>();
- // Status category
- DESCRIPTORS.add(getInfosDescriptor(status));
- DESCRIPTORS.add(getWarningsDescriptor(status));
- DESCRIPTORS.add(ERROR_DESCRIPTOR);
- ERROR_DESCRIPTOR.setCategory("Status");
- // Results category
- DESCRIPTORS.addElement(NAME_DESCRIPTOR);
- NAME_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(CURRENT_BUILD_DESCRIPTOR);
- CURRENT_BUILD_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(BASELINE_BUILD_DESCRIPTOR);
- BASELINE_BUILD_DESCRIPTOR.setCategory("Results");
- // Survey category
- DESCRIPTORS.add(COMMENT_DESCRIPTOR);
- COMMENT_DESCRIPTOR.setCategory("Survey");
- return DESCRIPTORS;
- }
- static Vector<IPropertyDescriptor> getDescriptors() {
- return DESCRIPTORS;
- }
-
-public ComponentResultsElement(String name, ResultsElement parent) {
- super(name, parent);
-}
-
-public ComponentResultsElement(AbstractResults results, ResultsElement parent) {
- super(results, parent);
-}
-
-/*
- * Do not create non-fingerprint child when only fingerprint is specified.
- *
- * @see org.eclipse.test.internal.performance.results.model.ResultsElement#createChild(org.eclipse.test.internal.performance.results.db.AbstractResults)
- */
-@Override
-ResultsElement createChild(AbstractResults testResults) {
-// if (onlyFingerprints()) {
-// ScenarioResults scenarioResults = (ScenarioResults) testResults;
-// if (!scenarioResults.hasSummary()) {
-// return null;
-// }
-// }
- return new ScenarioResultsElement(testResults, this);
-}
-
-/**
- * Get all results numbers for a given machine of the current component.
- *
- * @param configName The name of the configuration to get numbers
- * @param fingerprints Set whether only fingerprints scenario should be taken into account
- * @return A list of lines. Each line represent a build and is a list of either strings or values.
- */
-public List<List<Object>> getConfigNumbers(String configName, boolean fingerprints) {
- if (this.results == null) return null;
- return ((ComponentResults)this.results).getConfigNumbers(configName, fingerprints, new ArrayList<>());
-}
-
-@Override
-public IPropertyDescriptor[] getPropertyDescriptors() {
- Vector<IPropertyDescriptor> descriptors = getDescriptors();
- if (descriptors == null) {
- descriptors = initDescriptors(getStatus());
- }
- int size = descriptors.size();
- IPropertyDescriptor[] descriptorsArray = new IPropertyDescriptor[size];
- descriptorsArray[0] = getInfosDescriptor(getStatus());
- descriptorsArray[1] = getWarningsDescriptor(getStatus());
- for (int i=2; i<size; i++) {
- descriptorsArray[i] = descriptors.get(i);
- }
- return descriptorsArray;
-}
-
-@Override
-public Object getPropertyValue(Object propKey) {
- if (propKey.equals(P_ID_NAME)) {
- return getName();
- }
- if (propKey.equals(P_ID_CURRENT_BUILD)) {
- if (this.results == null) {
- PerformanceResultsElement performanceResultsElement = (PerformanceResultsElement) getParent(null);
- return performanceResultsElement.getName();
- }
- PerformanceResults performanceResults = (PerformanceResults) this.results.getParent();
- return performanceResults.getName();
- }
- if (propKey.equals(P_ID_BASELINE_BUILD)) {
- if (this.results == null) {
- return "?";
- }
- PerformanceResults performanceResults = (PerformanceResults) this.results.getParent();
- return performanceResults.getBaselineName();
- }
- return super.getPropertyValue(propKey);
-}
-
-/**
- * Get the list of the scenarios results from the model. Put only fingerprint ones if specified.
- *
- * @param fingerprint Tell whether only fingerprint scenarios are expected or not.
- * @return A list of {@link ScenarioResults}.
- */
-public List<AbstractResults> getScenarios(boolean fingerprint) {
- if (!fingerprint) {
- return Arrays.asList(this.results.getChildren());
- }
- List<AbstractResults> scenarios = new ArrayList<>();
- if (this.results != null) {
- Iterator<AbstractResults> iterator = this.results.getResults();
- while (iterator.hasNext()) {
- ScenarioResults scenarioResults = (ScenarioResults) iterator.next();
- if (scenarioResults.hasSummary()) {
- scenarios.add(scenarioResults);
- }
- }
- }
- return scenarios;
-}
-
-/**
- * Get the list of the scenarios names. Put only fingerprint ones if specified.
- *
- * @param fingerprint Tell whether only fingerprint scenarios are expected or not.
- * @return A list of {@link String}.
- */
-public List<String> getScenariosLabels(boolean fingerprint) {
- List<String> labels = new ArrayList<>();
- if (this.results != null) {
- AbstractResults[] scenarios = this.results.getChildren();
- int length = scenarios.length;
- for (int i=0; i<length; i++) {
- ScenarioResults scenarioResults = (ScenarioResults) scenarios[i];
- if (!fingerprint || scenarioResults.hasSummary()) {
- labels.add(scenarioResults.getLabel());
- }
- }
- }
- return labels;
-}
-
-@Override
-void initStatus() {
- if (this.results == null) {
- this.status = UNREAD;
- } else {
- super.initStatus();
- }
-}
-
-@Override
-StringBuilder getFailures(StringBuilder buffer, int kind, StringBuilder excluded) {
- // Write status for scenarios having error
- if ((getStatus() & ERROR_MASK) != 0) {
-
- // Get children status
- StringBuilder childrenBuffer = super.getFailures(new StringBuilder(), kind, excluded);
-
- // Write status on file if not excluded
- if (childrenBuffer.length() > 0) {
- buffer.append(getName());
- IEclipsePreferences preferences = InstanceScope.INSTANCE.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(Util.LINE_SEPARATOR);
- buffer.append(childrenBuffer);
- buffer.append(Util.LINE_SEPARATOR);
- }
- }
- 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
deleted file mode 100644
index 89f3d4f..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ConfigResultsElement.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2018 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.internal.performance.results.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.test.internal.performance.results.db.AbstractResults;
-import org.eclipse.test.internal.performance.results.db.ConfigResults;
-import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
-import org.eclipse.test.internal.performance.results.utils.Util;
-import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-public class ConfigResultsElement extends ResultsElement {
-
- // Elements
- BuildResultsElement currentBuild, baselineBuild;
-
- // Property descriptors
- static final String P_ID_CONFIG_NAME = "ConfigResultsElement.name"; //$NON-NLS-1$
- static final String P_ID_CONFIG_DESCRIPTION = "ConfigResultsElement.description"; //$NON-NLS-1$
- static final String P_ID_CONFIG_CURRENT_BUILD = "ConfigResultsElement.currentbuild"; //$NON-NLS-1$
- static final String P_ID_CONFIG_BASELINE_BUILD = "ConfigResultsElement.baselinebuild"; //$NON-NLS-1$
- static final String P_ID_CONFIG_BASELINED = "ConfigResultsElement.baselined"; //$NON-NLS-1$
- static final String P_ID_CONFIG_VALID = "ConfigResultsElement.valid"; //$NON-NLS-1$
- static final String P_ID_CONFIG_DELTA = "ConfigResultsElement.delta"; //$NON-NLS-1$
- static final String P_ID_CONFIG_ERROR = "ConfigResultsElement.error"; //$NON-NLS-1$
-
- static final String P_STR_CONFIG_NAME = "internal name"; //$NON-NLS-1$
- static final String P_STR_CONFIG_DESCRIPTION = "description"; //$NON-NLS-1$
- static final String P_STR_CONFIG_CURRENT_BUILD = "current build"; //$NON-NLS-1$
- static final String P_STR_CONFIG_BASELINE_BUILD = "baseline build"; //$NON-NLS-1$
- static final String P_STR_CONFIG_BASELINED = "has baseline"; //$NON-NLS-1$
- static final String P_STR_CONFIG_VALID = "is valid"; //$NON-NLS-1$
- static final String P_STR_CONFIG_DELTA = "delta with baseline"; //$NON-NLS-1$
- static final String P_STR_CONFIG_ERROR = "delta error"; //$NON-NLS-1$
-
- private static final TextPropertyDescriptor CONFIG_NAME_DESCRIPTOR = new TextPropertyDescriptor(P_ID_CONFIG_NAME, P_STR_CONFIG_NAME);
- private static final TextPropertyDescriptor CONFIG_DESCRIPTION_DESCRIPTOR = new TextPropertyDescriptor(P_ID_CONFIG_DESCRIPTION, P_STR_CONFIG_DESCRIPTION);
- private static final PropertyDescriptor CONFIG_CURRENT_BUILD_DESCRIPTOR = new PropertyDescriptor(P_ID_CONFIG_CURRENT_BUILD, P_STR_CONFIG_CURRENT_BUILD);
- private static final PropertyDescriptor CONFIG_BASELINE_BUILD_DESCRIPTOR = new PropertyDescriptor(P_ID_CONFIG_BASELINE_BUILD, P_STR_CONFIG_BASELINE_BUILD);
- private static final PropertyDescriptor CONFIG_BASELINED_DESCRIPTOR = new PropertyDescriptor(P_ID_CONFIG_BASELINED, P_STR_CONFIG_BASELINED);
- private static final PropertyDescriptor CONFIG_VALID_DESCRIPTOR = new PropertyDescriptor(P_ID_CONFIG_VALID, P_STR_CONFIG_VALID);
- private static final PropertyDescriptor CONFIG_DELTA_DESCRIPTOR = new PropertyDescriptor(P_ID_CONFIG_DELTA, P_STR_CONFIG_DELTA);
- private static final PropertyDescriptor CONFIG_ERROR_DESCRIPTOR = new PropertyDescriptor(P_ID_CONFIG_ERROR, P_STR_CONFIG_ERROR);
-
- private static Vector<IPropertyDescriptor> DESCRIPTORS;
- static Vector<IPropertyDescriptor> initDescriptors(int status) {
- DESCRIPTORS = new Vector<>();
- // Status category
- DESCRIPTORS.add(getInfosDescriptor(status));
- DESCRIPTORS.add(getWarningsDescriptor(status));
- DESCRIPTORS.add(ERROR_DESCRIPTOR);
- ERROR_DESCRIPTOR.setCategory("Status");
- // Results category
- DESCRIPTORS.addElement(CONFIG_NAME_DESCRIPTOR);
- CONFIG_NAME_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(CONFIG_DESCRIPTION_DESCRIPTOR);
- CONFIG_DESCRIPTION_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(CONFIG_CURRENT_BUILD_DESCRIPTOR);
- CONFIG_CURRENT_BUILD_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(CONFIG_BASELINE_BUILD_DESCRIPTOR);
- CONFIG_BASELINE_BUILD_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(CONFIG_BASELINED_DESCRIPTOR);
- CONFIG_BASELINED_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(CONFIG_VALID_DESCRIPTOR);
- CONFIG_VALID_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(CONFIG_DELTA_DESCRIPTOR);
- CONFIG_DELTA_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(CONFIG_ERROR_DESCRIPTOR);
- CONFIG_ERROR_DESCRIPTOR.setCategory("Results");
- // Survey category
- DESCRIPTORS.add(COMMENT_DESCRIPTOR);
- COMMENT_DESCRIPTOR.setCategory("Survey");
- return DESCRIPTORS;
- }
- static ComboBoxPropertyDescriptor getInfosDescriptor(int status) {
- List<String> list = new ArrayList<>();
- if ((status & SMALL_VALUE) != 0) {
- list.add("This test and/or its variation has a small value on this machine, hence it may not be necessary to spend time on fixing it if a regression occurs");
- }
- if ((status & STUDENT_TTEST) != 0) {
- list.add("The student-t test error on this machine is over the threshold");
- }
- String[] infos = new String[list.size()];
- if (list.size() > 0) {
- list.toArray(infos);
- }
- ComboBoxPropertyDescriptor infoDescriptor = new ComboBoxPropertyDescriptor(P_ID_STATUS_INFO, P_STR_STATUS_INFO, infos);
- infoDescriptor.setCategory("Status");
- return infoDescriptor;
- }
- static PropertyDescriptor getWarningsDescriptor(int status) {
- List<String> list = new ArrayList<>();
- if ((status & BIG_ERROR) != 0) {
- list.add("The error on this machine is over the 3% threshold, hence its result may not be really reliable");
- }
- if ((status & NOT_RELIABLE) != 0) {
- list.add("The results history for this machine shows that the variation of its delta is over 20%, hence its result is surely not reliable");
- }
- if ((status & NOT_STABLE) != 0) {
- list.add("The results history for this machine shows that the variation of its delta is between 10% and 20%, hence its result may not be really reliable");
- }
- if ((status & NO_BASELINE) != 0) {
- list.add("There's no baseline for this machine to compare with");
- }
- if ((status & SINGLE_RUN) != 0) {
- list.add("This test has only one run on this machine, hence no error can be computed to verify if it's stable enough to be reliable");
- }
- if ((status & STUDENT_TTEST) != 0) {
- list.add("The student-t test error on this machine is over the threshold");
- }
- String[] warnings = new String[list.size()];
- if (list.size() > 0) {
- list.toArray(warnings);
- }
- ComboBoxPropertyDescriptor warningDescriptor = new ComboBoxPropertyDescriptor(P_ID_STATUS_WARNING, P_STR_STATUS_WARNING, warnings);
- warningDescriptor.setCategory("Status");
- return warningDescriptor;
- }
- static Vector<IPropertyDescriptor> getDescriptors() {
- return DESCRIPTORS;
- }
-
-public ConfigResultsElement(AbstractResults results, ResultsElement parent) {
- super(results, parent);
-}
-
-@Override
-ResultsElement createChild(AbstractResults testResults) {
- return new BuildResultsElement(testResults, this);
-}
-
-BuildResultsElement getBaselineBuild() {
- if (this.baselineBuild == null) {
- this.baselineBuild = new BuildResultsElement(getConfigResults().getBaselineBuildResults(), this);
- }
- return this.baselineBuild;
-}
-
-/**
- * Get the baseline build used for this configuration.
- *
- * @param buildName The name of the build to have the baseline
- * @return The baseline build as {@link BuildResultsElement}.
- */
-public String getBaselineBuildName(String buildName) {
- return getConfigResults().getBaselineBuildResults(buildName).getName();
-}
-
-private ConfigResults getConfigResults() {
- return (ConfigResults) this.results;
-}
-
-BuildResultsElement getCurrentBuild() {
- if (this.currentBuild == null) {
- this.currentBuild = new BuildResultsElement(getConfigResults().getCurrentBuildResults(), this);
- }
- return this.currentBuild;
-}
-
-@Override
-public String getLabel(Object o) {
- String description = getConfigResults().getDescription();
- int index = description.indexOf(" (");
- if (index <= 0) {
- return description;
- }
- return description.substring(0, index);
-}
-
-@Override
-public IPropertyDescriptor[] getPropertyDescriptors() {
- Vector<IPropertyDescriptor> descriptors = getDescriptors();
- if (descriptors == null) {
- descriptors = initDescriptors(getStatus());
- }
- int size = descriptors.size();
- IPropertyDescriptor[] descriptorsArray = new IPropertyDescriptor[size];
- descriptorsArray[0] = getInfosDescriptor(getStatus());
- descriptorsArray[1] = getWarningsDescriptor(getStatus());
- for (int i=2; i<size; i++) {
- descriptorsArray[i] = descriptors.get(i);
- }
- return descriptorsArray;
-}
-
-@Override
-public Object getPropertyValue(Object propKey) {
- ConfigResults configResults = getConfigResults();
- if (propKey.equals(P_ID_CONFIG_NAME)) {
- return configResults.getName();
- }
- if (propKey.equals(P_ID_CONFIG_DESCRIPTION)) {
- return configResults.getDescription();
- }
- if (propKey.equals(P_ID_CONFIG_CURRENT_BUILD)) {
- return getCurrentBuild();
- }
- if (propKey.equals(P_ID_CONFIG_BASELINE_BUILD)) {
- return getBaselineBuild();
- }
- if (propKey.equals(P_ID_CONFIG_BASELINED)) {
- return Boolean.valueOf(configResults.isBaselined());
- }
- if (propKey.equals(P_ID_CONFIG_VALID)) {
- return Boolean.valueOf(configResults.isValid());
- }
- if (propKey.equals(P_ID_CONFIG_DELTA)) {
- return Double.valueOf(configResults.getDelta());
- }
- if (propKey.equals(P_ID_CONFIG_ERROR)) {
- return Double.valueOf(configResults.getError());
- }
- if (propKey.equals(P_ID_STATUS_ERROR)) {
- if (getStatus() == MISSING) {
- PerformanceResultsElement performanceResultsElement = (PerformanceResultsElement) ((ResultsElement)((ResultsElement)getParent(null)).getParent(null)).getParent(null);
- return "No result for build "+performanceResultsElement.getName()+" on this machine!";
- }
- if ((getStatus() & BIG_DELTA) != 0) {
- return "The delta on this machine is over the 10% threshold, hence may indicate a possible regression";
- }
- }
- return super.getPropertyValue(propKey);
-}
-
-/**
- * Return the statistics of the build along its history.
- *
- * @return An array of double built as follows:
- * <ul>
- * <li>0: numbers of values</li>
- * <li>1: mean of values</li>
- * <li>2: standard deviation of these values</li>
- * <li>3: coefficient of variation of these values</li>
- * </ul>
- */
-@Override
-public double[] getStatistics() {
- if (this.statistics == null) {
- this.statistics = getConfigResults().getStatistics(Util.BASELINE_BUILD_PREFIXES);
- }
- return this.statistics;
-}
-
-@Override
-void initStatus() {
- ConfigResults configResults = getConfigResults();
- if (configResults.isValid()) {
- initStatus(configResults.getCurrentBuildResults());
- } else {
- this.status = MISSING;
- }
-}
-
-/*
- * Write the element status in the given stream
- */
-@Override
-StringBuilder getFailures(StringBuilder buffer, int kind, StringBuilder excluded) {
- if ((this.status & BIG_DELTA) != 0) { // there's a failure on this config
-
- // Get numbers
- int buildsNumber = kind & IPerformancesConstants.STATUS_BUILDS_NUMBER_MASK;
- ConfigResults configResults = getConfigResults();
- double[][] numbers = configResults.getLastNumbers(buildsNumber);
- int numbersLength = numbers.length;
-
- // if there are several builds to confirm the regression, then verify all deltas
- if (numbersLength > 1) {
- if (numbersLength < buildsNumber) {
- // there's not enough builds to wee whether there's a real regression, hence skip result
- if (excluded != null) {
- excluded.append(configResults+" excluded from status because there's only "+numbersLength+" builds available although "+buildsNumber+" is required to decide a regression is confirmed or not!");
- excluded.append(Util.LINE_SEPARATOR);
- }
- return buffer;
- }
- int confirmed = 1;
- for (int i=1; i<numbersLength; i++) {
- if (numbers[i] != null && numbers[i][AbstractResults.DELTA_VALUE_INDEX] < -0.1) {
- confirmed++;
- }
- }
- float ratio = ((float) confirmed) / numbersLength;
- 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];
- StringBuilder localBuffer = new StringBuilder(" ");
- 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 && 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) {
- switch (kind & IPerformancesConstants.STATUS_STATISTICS_MASK) {
- case IPerformancesConstants.STATUS_STATISTICS_UNSTABLE:
- case IPerformancesConstants.STATUS_STATISTICS_ERRATIC:
- // 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);
- }
- return buffer;
-}
-
-}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/DimResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/DimResultsElement.java
deleted file mode 100644
index e517d28..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/DimResultsElement.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2018 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.internal.performance.results.model;
-
-import java.util.Vector;
-
-import org.eclipse.test.internal.performance.data.Dim;
-import org.eclipse.test.internal.performance.results.db.AbstractResults;
-import org.eclipse.test.internal.performance.results.db.BuildResults;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-public class DimResultsElement extends ResultsElement {
-
- Dim dim;
-
- // Property descriptors
- static final String P_ID_DIMENSION = "DimResultsElement.dim"; //$NON-NLS-1$
- static final String P_ID_COUNT = "DimResultsElement.count"; //$NON-NLS-1$
- static final String P_ID_AVERAGE = "DimResultsElement.average"; //$NON-NLS-1$
- static final String P_ID_STDDEV = "DimResultsElement.stddev"; //$NON-NLS-1$
- static final String P_ID_ERROR= "DimResultsElement.error"; //$NON-NLS-1$
- static final String P_ID_HAD_VALUES = "DimResultsElement.hadvalues"; //$NON-NLS-1$
-
- static final String P_STR_DIMENSION = "dimension"; //$NON-NLS-1$
- static final String P_STR_COUNT= "count"; //$NON-NLS-1$
- static final String P_STR_AVERAGE = "average"; //$NON-NLS-1$
- static final String P_STR_STDDEV = "std dev"; //$NON-NLS-1$
- static final String P_STR_ERROR = "error"; //$NON-NLS-1$
- static final String P_STR_HAD_VALUES = "had values"; //$NON-NLS-1$
-
- private static final TextPropertyDescriptor DIMENSION_DESCRIPTOR = new TextPropertyDescriptor(P_ID_DIMENSION, P_STR_DIMENSION);
- private static final PropertyDescriptor DIM_COUNT_DESCRIPTOR = new PropertyDescriptor(P_ID_COUNT, P_STR_COUNT);
- private static final PropertyDescriptor DIM_AVERAGE_DESCRIPTOR = new PropertyDescriptor(P_ID_AVERAGE, P_STR_AVERAGE);
- private static final PropertyDescriptor DIM_STDDEV_DESCRIPTOR = new PropertyDescriptor(P_ID_STDDEV, P_STR_STDDEV);
- private static final PropertyDescriptor DIM_ERROR_DESCRIPTOR = new PropertyDescriptor(P_ID_ERROR, P_STR_ERROR);
- private static final PropertyDescriptor DIM_HAD_VALUES_DESCRIPTOR = new PropertyDescriptor(P_ID_HAD_VALUES, P_STR_HAD_VALUES);
-
- private static Vector<IPropertyDescriptor> DESCRIPTORS;
- static Vector<IPropertyDescriptor> initDescriptors(int status) {
- DESCRIPTORS = new Vector<>();
- // Status category
- DESCRIPTORS.add(getInfosDescriptor(status));
- DESCRIPTORS.add(getWarningsDescriptor(status));
- DESCRIPTORS.add(ERROR_DESCRIPTOR);
- ERROR_DESCRIPTOR.setCategory("Status");
- // Results category
- DESCRIPTORS.addElement(DIMENSION_DESCRIPTOR);
- DIMENSION_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(DIM_COUNT_DESCRIPTOR);
- DIM_COUNT_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(DIM_AVERAGE_DESCRIPTOR);
- DIM_AVERAGE_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(DIM_STDDEV_DESCRIPTOR);
- DIM_STDDEV_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(DIM_ERROR_DESCRIPTOR);
- DIM_ERROR_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(DIM_HAD_VALUES_DESCRIPTOR);
- DIM_HAD_VALUES_DESCRIPTOR.setCategory("Results");
- // Survey category
- DESCRIPTORS.add(COMMENT_DESCRIPTOR);
- COMMENT_DESCRIPTOR.setCategory("Survey");
- return DESCRIPTORS;
- }
- static Vector<IPropertyDescriptor> getDescriptors() {
- return DESCRIPTORS;
- }
-
-public DimResultsElement(AbstractResults results, ResultsElement parent, Dim d) {
- super(results, parent);
- this.dim = d;
-}
-
-@Override
-ResultsElement createChild(AbstractResults testResults) {
- return null;
-}
-
-private BuildResults getBuildResults() {
- return (BuildResults) this.results;
-}
-
-@Override
-public String getLabel(Object o) {
- return this.dim.getName();
-}
-
-@Override
-public IPropertyDescriptor[] getPropertyDescriptors() {
- Vector<IPropertyDescriptor> descriptors = getDescriptors();
- if (descriptors == null) {
- descriptors = initDescriptors(getStatus());
- }
- int size = descriptors.size();
- IPropertyDescriptor[] descriptorsArray = new IPropertyDescriptor[size];
- descriptorsArray[0] = getInfosDescriptor(getStatus());
- descriptorsArray[1] = getWarningsDescriptor(getStatus());
- for (int i=2; i<size; i++) {
- descriptorsArray[i] = descriptors.get(i);
- }
- return descriptorsArray;
-}
-
-@Override
-public Object getPropertyValue(Object propKey) {
- BuildResults buildResults = getBuildResults();
- if (propKey.equals(P_ID_DIMENSION)) {
- return this.dim.getDescription();
- }
- if (propKey.equals(P_ID_COUNT)) {
- long count = buildResults.getCount(this.dim.getId());
- return Double.valueOf(count);
- }
- if (propKey.equals(P_ID_AVERAGE))
- return Double.valueOf(buildResults.getValue(this.dim.getId()));
- if (propKey.equals(P_ID_STDDEV))
- return Double.valueOf(buildResults.getDeviation(this.dim.getId()));
- if (propKey.equals(P_ID_ERROR))
- return Double.valueOf(buildResults.getError(this.dim.getId()));
- if (propKey.equals(P_ID_HAD_VALUES))
- return Boolean.valueOf(buildResults.hadValues());
- return super.getPropertyValue(propKey);
-}
-
-}
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
deleted file mode 100644
index fd76187..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2017 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.internal.performance.results.model;
-
-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.io.PrintStream;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.test.internal.performance.results.db.AbstractResults;
-import org.eclipse.test.internal.performance.results.db.DB_Results;
-import org.eclipse.test.internal.performance.results.db.PerformanceResults;
-import org.eclipse.test.internal.performance.results.ui.BuildsComparisonTable;
-import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
-import org.eclipse.test.internal.performance.results.utils.Util;
-import org.eclipse.test.performance.ui.Utils;
-
-public class PerformanceResultsElement extends ResultsElement {
-
-// Singleton pattern
-public static PerformanceResultsElement PERF_RESULTS_MODEL = new PerformanceResultsElement();
-
- String[] buildNames;
- String lastBuildName;
- boolean fingerprints = true;
-
-public PerformanceResultsElement() {
-}
-
-@Override
-ResultsElement createChild(AbstractResults testResults) {
- return new ComponentResultsElement(testResults, this);
-}
-
-public String[] getBaselines() {
- getBuildNames();
- if (this.buildNames == null) {
- return new String[0];
- }
- int length = this.buildNames.length;
- String[] baselines = new String[length];
- int count = 0;
- for (int i=0; i<length; i++) {
- if (this.buildNames[i].startsWith("R-")) {
- baselines[count++] = this.buildNames[i];
- }
- }
- if (count < length) {
- System.arraycopy(baselines, 0, baselines = new String [count], 0, count);
- }
- return baselines;
-}
-
-public String[] getBuildNames() {
- if (this.buildNames == null) {
- this.buildNames = DB_Results.DB_CONNECTION
- ? DB_Results.getBuilds()
- : this.results == null
- ? new String[0]
- : getPerformanceResults().getAllBuildNames();
- }
- return this.buildNames;
-}
-
-public Object[] getBuilds() {
- getBuildNames();
- int length = this.buildNames == null ? 0 : this.buildNames.length;
- BuildResultsElement[] elements = new BuildResultsElement[length];
- for (int i=0; i<length; i++) {
- elements[i] = new BuildResultsElement(this.buildNames[i], this);
- }
- return elements;
-}
-
-public String[] getComponents() {
- if (!isInitialized()) {
- String[] components = DB_Results.getComponents();
- int length = components.length;
- if (length == 0) {
- DB_Results.queryAllScenarios();
- components = DB_Results.getComponents();
- }
- return components;
- }
- return getPerformanceResults().getComponents();
-}
-
-/**
- * Returns the names of the configurations.
- *
- * @return An array of String
- */
-public String[] getConfigs() {
- if (!isInitialized()) {
- String[] configs = DB_Results.getConfigs();
- int length = configs.length;
- if (length == 0) {
- DB_Results.queryAllScenarios();
- configs = DB_Results.getConfigs();
- }
- return configs;
- }
- return getPerformanceResults().getConfigNames(false);
-}
-
-/**
- * Returns the descriptions of the configurations.
- *
- * @return An array of String
- */
-public String[] getConfigDescriptions() {
- if (!isInitialized()) {
- String[] descriptions = DB_Results.getConfigDescriptions();
- int length = descriptions.length;
- if (length == 0) {
- DB_Results.queryAllScenarios();
- descriptions = DB_Results.getConfigDescriptions();
- }
- return descriptions;
- }
- return getPerformanceResults().getConfigBoxes(false);
-}
-
-public Object[] getElements() {
- if (!isInitialized()) {
- String[] components = getComponents();
- int length = components.length;
- ComponentResultsElement[] elements = new ComponentResultsElement[length];
- for (int i=0; i<length; i++) {
- elements[i] = new ComponentResultsElement(components[i], this);
- }
- return elements;
- }
- return getChildren(null);
-}
-
-public PerformanceResults getPerformanceResults() {
- return (PerformanceResults) this.results;
-}
-
-boolean hasRead(BuildResultsElement buildResultsElement) {
- String[] builds = this.results == null ? getBuildNames() : getPerformanceResults().getAllBuildNames();
- if (Arrays.binarySearch(builds, buildResultsElement.getName(), Util.BUILD_DATE_COMPARATOR) < 0) {
- return false;
- }
- return true;
-}
-
-@Override
-public boolean isInitialized() {
- return super.isInitialized() && this.results.size() > 0;
-}
-
-public void readLocal(File dataDir, IProgressMonitor monitor, String lastBuild) {
- reset(lastBuild);
- PerformanceResults performanceResults = getPerformanceResults();
- performanceResults.setLastBuildName(lastBuild);
- performanceResults.readLocal(dataDir, monitor);
-}
-
-public void reset(String buildName) {
- if (buildName == null) {
- this.results = new PerformanceResults(this.lastBuildName, null, null, System.out);
- } else {
- this.results = new PerformanceResults(buildName, null, null, System.out);
- }
- this.children = null;
- this.buildNames = null;
-}
-
-public void resetBuildNames() {
- this.buildNames = null;
-}
-
-public void updateBuild(String buildName, boolean force, File dataDir, IProgressMonitor monitor) {
- if (this.results == null) {
- reset(buildName);
- }
- getPerformanceResults().updateBuild(buildName, force, dataDir, monitor);
-}
-
-public void updateBuilds(String[] builds, boolean force, File dataDir, IProgressMonitor monitor) {
- if (this.results == null) {
- reset(null);
- }
- getPerformanceResults().updateBuilds(builds, force, dataDir, monitor);
-}
-
-/**
- * Set whether only fingerprints should be taken into account or not.
- *
- * @param fingerprints
- */
-public void setFingerprints(boolean fingerprints) {
- this.fingerprints = fingerprints;
- resetStatus();
-}
-
-public void setLastBuildName(String lastBuildName) {
- this.lastBuildName = lastBuildName;
- this.name = null;
-}
-
-/*
- * Write the component status in the given file
- */
-public StringBuilder writeFailures(File resultsFile, int kind) {
- if (this.results == null) {
- return null;
- }
- boolean values = (kind & IPerformancesConstants.STATUS_VALUES) != 0;
- // Write status only for component with error
- StringBuilder excluded = new StringBuilder();
- try (DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(resultsFile)))) {
- StringBuilder buffer = new StringBuilder();
- // 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 (values) {
- buffer.append(" Build ");
- buffer.append(" History ");
- }
- buffer.append(" Comment");
- buffer.append(Util.LINE_SEPARATOR);
- if (values) {
- buffer.append(" value");
- buffer.append(" baseline");
- buffer.append(" variation");
- buffer.append(" delta");
- buffer.append(" error");
- buffer.append(" n");
- buffer.append(" mean");
- buffer.append(" deviation");
- buffer.append(" coeff");
- buffer.append(Util.LINE_SEPARATOR);
- }
- stream.write(buffer.toString().getBytes());
- StringBuilder componentBuffer = getFailures(new StringBuilder(), kind, excluded);
- if (componentBuffer.length() > 0) {
- stream.write(componentBuffer.toString().getBytes());
- }
- } catch (FileNotFoundException e) {
- System.err.println("Can't create output file" + resultsFile); //$NON-NLS-1$
- } catch (IOException e) {
- e.printStackTrace();
- }
- return excluded;
-}
-
-/*
- * Write the comparison between two builds in the given file
- */
-public void writeComparison(File resultsFile, String build, String reference) {
- if (this.results == null) {
- return;
- }
- // Create the stream
- try (PrintStream stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(resultsFile)))) {
- // Print main title
- stream.print("<link href=\""+Utils.TOOLTIP_STYLE+"\" rel=\"stylesheet\" type=\"text/css\">\n");
- stream.print("<script src=\""+Utils.TOOLTIP_SCRIPT+"\"></script>\n");
- stream.print("<script src=\""+Utils.FINGERPRINT_SCRIPT+"\"></script>\n");
- stream.print(Utils.HTML_DEFAULT_CSS);
- stream.print("<body>");
- stream.print("<h2>Performance comparison of ");
- stream.print(build);
- stream.print(" relative to ");
- int index = reference.indexOf('-');
- if (index > 0) {
- stream.print(reference.substring(0, index));
- stream.print(" (");
- index = reference.lastIndexOf('-');
- stream.print(reference.substring(index+1, reference.length()));
- stream.print(')');
- } else {
- stream.print(reference);
- }
- stream.print("</h2>\n");
-
- // Print a comparison table for each component
- try {
- int length = this.children.length;
- for (int i=0; i<length; i++) {
- BuildsComparisonTable table = new BuildsComparisonTable(this.children[i].getName(), stream, build, reference);
- table.print(getPerformanceResults());
- }
- } finally {
- stream.print("</body>");
- }
- } catch (FileNotFoundException e) {
- System.err.println("Can't create output file"+resultsFile); //$NON-NLS-1$
- }
-}
-
-}
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
deleted file mode 100644
index ecf90b8..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ResultsElement.java
+++ /dev/null
@@ -1,577 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2018 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.internal.performance.results.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.test.internal.performance.eval.StatisticsUtil;
-import org.eclipse.test.internal.performance.results.db.AbstractResults;
-import org.eclipse.test.internal.performance.results.db.BuildResults;
-import org.eclipse.test.internal.performance.results.db.ConfigResults;
-import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
-import org.eclipse.test.internal.performance.results.utils.Util;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * An Organization Element
- */
-public abstract class ResultsElement implements IAdaptable, IPropertySource, IWorkbenchAdapter, Comparable<ResultsElement> {
-
- // Image descriptors
- private static final ISharedImages WORKBENCH_SHARED_IMAGES = PlatformUI.getWorkbench().getSharedImages();
- public static final Image ERROR_IMAGE = WORKBENCH_SHARED_IMAGES.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
- public static final ImageDescriptor ERROR_IMAGE_DESCRIPTOR = WORKBENCH_SHARED_IMAGES.getImageDescriptor(ISharedImages.IMG_OBJS_ERROR_TSK);
- public static final Image WARN_IMAGE = WORKBENCH_SHARED_IMAGES.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
- public static final ImageDescriptor WARN_IMAGE_DESCRIPTOR = WORKBENCH_SHARED_IMAGES.getImageDescriptor(ISharedImages.IMG_OBJS_WARN_TSK);
- public static final Image INFO_IMAGE = WORKBENCH_SHARED_IMAGES.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
- public static final ImageDescriptor INFO_IMAGE_DESCRIPTOR = WORKBENCH_SHARED_IMAGES.getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK);
- public static final Image HELP_IMAGE = WORKBENCH_SHARED_IMAGES.getImage(ISharedImages.IMG_LCL_LINKTO_HELP);
- public static final ImageDescriptor HELP_IMAGE_DESCRIPTOR = WORKBENCH_SHARED_IMAGES.getImageDescriptor(ISharedImages.IMG_LCL_LINKTO_HELP);
- public static final ImageDescriptor FOLDER_IMAGE_DESCRIPTOR = WORKBENCH_SHARED_IMAGES.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- public static final ImageDescriptor CONNECT_IMAGE_DESCRIPTOR = WORKBENCH_SHARED_IMAGES.getImageDescriptor(ISharedImages.IMG_ELCL_SYNCED);
-
- // Model
- ResultsElement parent;
- AbstractResults results;
- ResultsElement[] children;
- String name;
- int status = -1;
-
- // Stats
- double[] statistics;
-
- // Status constants
- // state
- static final int UNKNOWN = 0x01;
- static final int UNREAD = 0x02;
- static final int READ = 0x04;
- static final int MISSING = 0x08;
- public static final int STATE_MASK = 0x0F;
- // info
- static final int SMALL_VALUE = 0x0010;
- static final int STUDENT_TTEST = 0x0020;
- public static final int INFO_MASK = 0x0030;
- // warning
- static final int NO_BASELINE = 0x0040;
- static final int SINGLE_RUN = 0x0080;
- static final int BIG_ERROR = 0x0100;
- static final int NOT_STABLE = 0x0200;
- static final int NOT_RELIABLE = 0x0400;
- public static final int WARNING_MASK = 0x0FC0;
- // error
- static final int BIG_DELTA = 0x1000;
- public static final int ERROR_MASK = 0xF000;
-
- // Property descriptors
- static final String P_ID_STATUS_INFO = "ResultsElement.status_info"; //$NON-NLS-1$
- static final String P_ID_STATUS_WARNING = "ResultsElement.status_warning"; //$NON-NLS-1$
- static final String P_ID_STATUS_ERROR = "ResultsElement.status_error"; //$NON-NLS-1$
- static final String P_ID_STATUS_COMMENT = "ResultsElement.status_comment"; //$NON-NLS-1$
-
- static final String P_STR_STATUS_INFO = " info"; //$NON-NLS-1$
- static final String P_STR_STATUS_WARNING = "warning"; //$NON-NLS-1$
- static final String P_STR_STATUS_ERROR = "error"; //$NON-NLS-1$
- static final String P_STR_STATUS_COMMENT = "comment"; //$NON-NLS-1$
- static final String[] NO_VALUES = new String[0];
-
- private static Vector<IPropertyDescriptor> DESCRIPTORS;
- static final TextPropertyDescriptor COMMENT_DESCRIPTOR = new TextPropertyDescriptor(P_ID_STATUS_COMMENT, P_STR_STATUS_COMMENT);
- static final TextPropertyDescriptor ERROR_DESCRIPTOR = new TextPropertyDescriptor(P_ID_STATUS_ERROR, P_STR_STATUS_ERROR);
- static Vector<IPropertyDescriptor> initDescriptors(int status) {
- DESCRIPTORS = new Vector<>();
- // Status category
- DESCRIPTORS.add(getInfosDescriptor(status));
- DESCRIPTORS.add(getWarningsDescriptor(status));
- DESCRIPTORS.add(ERROR_DESCRIPTOR);
- ERROR_DESCRIPTOR.setCategory("Status");
- // Survey category
- DESCRIPTORS.add(COMMENT_DESCRIPTOR);
- COMMENT_DESCRIPTOR.setCategory("Survey");
- return DESCRIPTORS;
- }
- static Vector<IPropertyDescriptor> getDescriptors() {
- return DESCRIPTORS;
- }
- static ComboBoxPropertyDescriptor getInfosDescriptor(int status) {
- List<String> list = new ArrayList<>();
- if ((status & SMALL_VALUE) != 0) {
- list.add("Some builds have tests with small values");
- }
- if ((status & STUDENT_TTEST) != 0) {
- list.add("Some builds have student-t test error over the threshold");
- }
- String[] infos = new String[list.size()];
- if (list.size() > 0) {
- list.toArray(infos);
- }
- ComboBoxPropertyDescriptor infoDescriptor = new ComboBoxPropertyDescriptor(P_ID_STATUS_INFO, P_STR_STATUS_INFO, infos);
- infoDescriptor.setCategory("Status");
- return infoDescriptor;
- }
- static PropertyDescriptor getWarningsDescriptor(int status) {
- List<String> list = new ArrayList<>();
- if ((status & BIG_ERROR) != 0) {
- list.add("Some builds have tests with error over 3%");
- }
- if ((status & NOT_RELIABLE) != 0) {
- list.add("Some builds have no reliable tests");
- }
- if ((status & NOT_STABLE) != 0) {
- list.add("Some builds have no stable tests");
- }
- if ((status & NO_BASELINE) != 0) {
- list.add("Some builds have no baseline to compare with");
- }
- if ((status & SINGLE_RUN) != 0) {
- list.add("Some builds have single run tests");
- }
- String[] warnings = new String[list.size()];
- if (list.size() > 0) {
- list.toArray(warnings);
- }
- ComboBoxPropertyDescriptor warningDescriptor = new ComboBoxPropertyDescriptor(P_ID_STATUS_WARNING, P_STR_STATUS_WARNING, warnings);
- warningDescriptor.setCategory("Status");
- return warningDescriptor;
- }
-
-ResultsElement() {
-}
-
-ResultsElement(AbstractResults results, ResultsElement parent) {
- this.parent = parent;
- this.results = results;
-}
-
-ResultsElement(String name, ResultsElement parent) {
- this.parent = parent;
- this.name = name;
-}
-
-@Override
-public int compareTo(ResultsElement o) {
- if (this.results == null) {
- if (o != null && this.name != null) {
- ResultsElement element = o;
- return this.name.compareTo(element.getName());
- }
- return -1;
- }
- if (o != null) {
- return this.results.compareTo(o.results);
- }
- return -1;
-}
-
-abstract ResultsElement createChild(AbstractResults testResults);
-
-@Override
-public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IPropertySource.class) {
- return adapter.cast(this);
- }
- if (adapter == IWorkbenchAdapter.class) {
- return adapter.cast(this);
- }
- return null;
-}
-
-/**
- * Iterate the element children.
- */
-public ResultsElement[] getChildren() {
- if (this.results == null) {
- return new ResultsElement[0];
- }
- if (this.children == null) {
- initChildren();
- }
- return this.children;
-}
-
-@Override
-public Object[] getChildren(Object o) {
- if (this.results == null) {
- return new Object[0];
- }
- if (this.children == null) {
- initChildren();
- }
- return this.children;
-}
-
-@Override
-public Object getEditableValue() {
- return this;
-}
-
-final String getId() {
- return getId(new StringBuilder()).toString();
-}
-
-private StringBuilder getId(StringBuilder buffer) {
- if (this.parent != null) {
- return this.parent.getId(buffer).append('/').append(getName());
- }
- return buffer;
-}
-
-@Override
-public ImageDescriptor getImageDescriptor(Object object) {
- if (object instanceof ResultsElement) {
- ResultsElement resultsElement = (ResultsElement) object;
-// DEBUG
-// if (resultsElement.getName().equals("I20090806-0100")) {
-// if (resultsElement.results != null) {
-// String toString = resultsElement.results.getParent().toString();
-// String toString = resultsElement.results.toString();
-// if (toString.indexOf("testStoreExists")>0 && toString.indexOf("eplnx2")>0) {
-// System.out.println("stop");
-// }
-// }
-// }
- int elementStatus = resultsElement.getStatus();
- if (elementStatus == MISSING) {
- return HELP_IMAGE_DESCRIPTOR;
- }
- if ((elementStatus & ResultsElement.ERROR_MASK) != 0) {
- return ERROR_IMAGE_DESCRIPTOR;
- }
- if ((elementStatus & ResultsElement.WARNING_MASK) != 0) {
- return WARN_IMAGE_DESCRIPTOR;
- }
- if ((elementStatus & ResultsElement.INFO_MASK) != 0) {
- return INFO_IMAGE_DESCRIPTOR;
- }
- }
- return null;
-}
-
-@Override
-public String getLabel(Object o) {
- return getName();
-}
-
-/**
- * Returns the name
- */
-public String getName() {
- if (this.name == null && this.results != null) {
- this.name = this.results.getName();
- }
- return this.name;
-}
-
-/**
- * Returns the parent
- */
-@Override
-public Object getParent(Object o) {
- return this.parent;
-}
-
-@Override
-public IPropertyDescriptor[] getPropertyDescriptors() {
- Vector<IPropertyDescriptor> descriptors = getDescriptors();
- if (descriptors == null) {
- descriptors = initDescriptors(getStatus());
- }
- int size = descriptors.size();
- IPropertyDescriptor[] descriptorsArray = new IPropertyDescriptor[size];
- descriptorsArray[0] = getInfosDescriptor(getStatus());
- descriptorsArray[1] = getWarningsDescriptor(getStatus());
- for (int i=2; i<size; i++) {
- descriptorsArray[i] = descriptors.get(i);
- }
- return descriptorsArray;
-}
-
-@Override
-public Object getPropertyValue(Object propKey) {
- if (propKey.equals(P_ID_STATUS_INFO)) {
- if ((getStatus() & INFO_MASK) != 0) {
- return Integer.valueOf(0);
- }
- }
- if (propKey.equals(P_ID_STATUS_WARNING)) {
- if ((getStatus() & WARNING_MASK) != 0) {
- return Integer.valueOf(0);
- }
- }
- if (propKey.equals(P_ID_STATUS_ERROR)) {
- if ((getStatus() & BIG_DELTA) != 0) {
- return "Some builds have tests with regression";
- }
- }
- if (propKey.equals(P_ID_STATUS_COMMENT)) {
- IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(IPerformancesConstants.PLUGIN_ID);
- return preferences.get(getId(), "");
- }
- return null;
-}
-
-public ResultsElement getResultsElement(String resultName) {
- int length = getChildren(null).length;
- for (int i=0; i<length; i++) {
- ResultsElement searchedResults = this.children[i];
- if (searchedResults.getName().equals(resultName)) {
- return searchedResults;
- }
- }
- return null;
-}
-
-/**
- * Return the status of the element.
- *
- * The status is a bit mask pattern where digits are
- * allowed as follow:
- * <ul>
- * <li>0-3: bits for state showing whether the element is
- * <ul>
- * <li>{@link #UNKNOWN} : not connected to a db</li>
- * <li>{@link #UNREAD} : is not valid (e.g. NaN results)</li>
- * <li>{@link #MISSING} : no results (e.g. the perf machine crashed and didn't store any results)</li>
- * <li>{@link #READ} : has valid results</li>
- * </ul>
- * </li>
- * <li>4-5: bits for information. Current possible information are
- * <ul>
- * <li>{@link #SMALL_VALUE} : build results or delta with baseline value is under 100ms</li>
- * <li>{@link #STUDENT_TTEST} : the Student T-test is over the threshold (old yellow color for test results)</li>
- * </ul>
- * </li>
- * <li>6-11: bits for warnings. Current possible warnings are
- * <ul>
- * <li>{@link #NO_BASELINE} : no baseline for the current build</li>
- * <li>{@link #SINGLE_RUN} : the test has only one run (i.e. no error could be computed), hence its reliability cannot be evaluated</li>
- * <li>{@link #BIG_ERROR} : the test result is over the 3% threshold</li>
- * <li>{@link #NOT_STABLE} : the test history shows a deviation between 10% and 20% (may mean that this test is not so reliable)</li>
- * <li>{@link #NOT_RELIABLE} : the test history shows a deviation over 20% (surely means that this test is too erratic to be reliable)</li>
- * </ul>
- * </li>
- * <li>12-15: bits for errors. Current possible errors are
- * <ul>
- * <li>{@link #BIG_DELTA} : the delta for the test is over the 10% threshold</li>
- * </ul>
- * </li>
- * </ul>
- *
- * Note that these explanation applied to {@link BuildResultsElement}, and {@link DimResultsElement}.
- * For {@link ComponentResultsElement}, and {@link ScenarioResultsElement}, it's the merge of all the children status
- * and means "Some tests have..." instead of "The test has...". For {@link ConfigResultsElement}, it means the status
- * of the most recent build compared to its most recent baseline.
- *
- * @return An int with each bit set when the corresponding symptom applies.
- */
-public final int getStatus() {
- if (this.status < 0) {
- initStatus();
- }
- return this.status;
-}
-
-/**
- * Return the statistics of the build along its history.
- *
- * @return An array of double built as follows:
- * <ul>
- * <li>0: numbers of values</li>
- * <li>1: mean of values</li>
- * <li>2: standard deviation of these values</li>
- * <li>3: coefficient of variation of these values</li>
- * </ul>
- */
-double[] getStatistics() {
- return this.statistics;
-}
-
-/**
- * Returns whether the element (or one in its hierarchy) has an error.
- *
- * @return <code> true</code> if the element or one in its hierarchy has an error,
- * <code> false</code> otherwise
- */
-public final boolean hasError() {
- return (getStatus() & ERROR_MASK) != 0;
-}
-
-void initChildren() {
- AbstractResults[] resultsChildren = this.results.getChildren();
- int length = resultsChildren.length;
- this.children = new ResultsElement[length];
- int count = 0;
- for (int i=0; i<length; i++) {
- ResultsElement childElement = createChild(resultsChildren[i]);
- if (childElement != null) {
- this.children[count++] = childElement;
- }
- }
- if (count < length) {
- System.arraycopy(this.children, 0, this.children = new ResultsElement[count], 0, count);
- }
-}
-void initStatus() {
- this.status = READ;
- if (this.results != null) {
- if (this.children == null) initChildren();
- int length = this.children.length;
- for (int i=0; i<length; i++) {
- this.status |= this.children[i].getStatus();
- }
- }
-}
-
-int initStatus(BuildResults buildResults) {
- this.status = READ;
-
- // Get values
- double buildValue = buildResults.getValue();
- ConfigResults configResults = (ConfigResults) buildResults.getParent();
- BuildResults baselineResults = configResults.getBaselineBuildResults(buildResults.getName());
- double baselineValue = baselineResults.getValue();
- double delta = (baselineValue - buildValue) / baselineValue;
-
- // Store if there's no baseline
- if (Double.isNaN(delta)) {
- this.status |= NO_BASELINE;
- }
-
- // Store if there's only one run
- long baselineCount = baselineResults.getCount();
- long currentCount = buildResults.getCount();
- double error = Double.NaN;
- if (baselineCount == 1 || currentCount == 1) {
- this.status |= SINGLE_RUN;
- }
-
- // Store if the T-test is not good
- double ttestValue = Util.computeTTest(baselineResults, buildResults);
- int degreeOfFreedom = (int) (baselineResults.getCount()+buildResults.getCount()-2);
- if (ttestValue >= 0 && StatisticsUtil.getStudentsT(degreeOfFreedom, StatisticsUtil.T90) >= ttestValue) {
- this.status |= STUDENT_TTEST;
- }
-
- // Store if there's a big error (over 3%)
- double baselineError = baselineResults.getError();
- double currentError = buildResults.getError();
- error = Double.isNaN(baselineError)
- ? currentError / baselineValue
- : Math.sqrt(baselineError*baselineError + currentError*currentError) / baselineValue;
- if (error > 0.03) {
- this.status |= BIG_ERROR;
- }
-
- // Store if there's a big delta (over 10%)
- if (delta <= -0.1) {
- this.status |= BIG_DELTA;
- double currentBuildValue = buildResults.getValue();
- double diff = Math.abs(baselineValue - currentBuildValue);
- if (currentBuildValue < 100 || diff < 100) { // moderate the status when
- // diff is less than 100ms
- this.status |= SMALL_VALUE;
- } else {
- double[] stats = getStatistics();
- if (stats != null) {
- if (stats[3] > 0.2) { // invalidate the status when the test
- // historical deviation is over 20%
- this.status |= NOT_RELIABLE;
- } else if (stats[3] > 0.1) { // moderate the status when the test
- // historical deviation is between 10%
- // and 20%
- this.status |= NOT_STABLE;
- }
- }
- }
- }
-
- return this.status;
-}
-
-public boolean isInitialized() {
- return this.results != null;
-}
-
-@Override
-public boolean isPropertySet(Object property) {
- return false;
-}
-
-boolean onlyFingerprints() {
- if (this.parent != null) {
- return this.parent.onlyFingerprints();
- }
- return ((PerformanceResultsElement)this).fingerprints;
-}
-
-@Override
-public void resetPropertyValue(Object property) {
-}
-
-void resetStatus() {
- this.status = -1;
- if (this.results != null) {
- if (this.children == null) initChildren();
- int length = this.children.length;
- for (int i=0; i<length; i++) {
- this.children[i].resetStatus();
- }
- }
-}
-
-@Override
-public void setPropertyValue(Object name, Object value) {
- if (name.equals(P_ID_STATUS_COMMENT)) {
- IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(IPerformancesConstants.PLUGIN_ID);
- preferences.put(getId(), (String) value);
- try {
- preferences.flush();
- } catch (BackingStoreException e) {
- // skip
- }
- }
-}
-
-@Override
-public String toString() {
- if (this.results == null) {
- return getName();
- }
- return this.results.toString();
-}
-
-/*
- * Write the failures of the element in the given buffer
- */
-StringBuilder getFailures(StringBuilder buffer, int kind, StringBuilder excluded) {
- int length = getChildren().length;
- for (int i=0; i<length; i++) {
- this.children[i].getFailures(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
deleted file mode 100644
index 717257e..0000000
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/ScenarioResultsElement.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2017 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.internal.performance.results.model;
-
-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.AbstractResults;
-import org.eclipse.test.internal.performance.results.db.ScenarioResults;
-import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
-import org.eclipse.test.internal.performance.results.utils.Util;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-public class ScenarioResultsElement extends ResultsElement {
-
- // Property descriptors
- static final String P_ID_SCENARIO_LABEL = "ScenarioResultsElement.label"; //$NON-NLS-1$
- static final String P_ID_SCENARIO_FILE_NAME = "ScenarioResultsElement.filename"; //$NON-NLS-1$
- static final String P_ID_SCENARIO_SHORT_NAME = "ScenarioResultsElement.shortname"; //$NON-NLS-1$
-
- static final String P_STR_SCENARIO_LABEL = "label"; //$NON-NLS-1$
- static final String P_STR_SCENARIO_FILE_NAME = "file name"; //$NON-NLS-1$
- static final String P_STR_SCENARIO_SHORT_NAME = "short name"; //$NON-NLS-1$
-
- private static final TextPropertyDescriptor SCENARIO_LABEL_DESCRIPTOR = new TextPropertyDescriptor(P_ID_SCENARIO_LABEL, P_STR_SCENARIO_LABEL);
- private static final TextPropertyDescriptor SCENARIO_FILE_NAME_DESCRIPTOR = new TextPropertyDescriptor(P_ID_SCENARIO_FILE_NAME, P_STR_SCENARIO_FILE_NAME);
- private static final TextPropertyDescriptor SCENARIO_SHORT_NAME_DESCRIPTOR = new TextPropertyDescriptor(P_ID_SCENARIO_SHORT_NAME, P_STR_SCENARIO_SHORT_NAME);
-
- private static Vector<IPropertyDescriptor> DESCRIPTORS;
- static Vector<IPropertyDescriptor> initDescriptors(int status) {
- DESCRIPTORS = new Vector<>();
- // Status category
- DESCRIPTORS.add(getInfosDescriptor(status));
- DESCRIPTORS.add(getWarningsDescriptor(status));
- DESCRIPTORS.add(ERROR_DESCRIPTOR);
- ERROR_DESCRIPTOR.setCategory("Status");
- // Results category
- DESCRIPTORS.addElement(SCENARIO_LABEL_DESCRIPTOR);
- SCENARIO_LABEL_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(SCENARIO_FILE_NAME_DESCRIPTOR);
- SCENARIO_FILE_NAME_DESCRIPTOR.setCategory("Results");
- DESCRIPTORS.addElement(SCENARIO_SHORT_NAME_DESCRIPTOR);
- SCENARIO_SHORT_NAME_DESCRIPTOR.setCategory("Results");
- // Survey category
- DESCRIPTORS.add(COMMENT_DESCRIPTOR);
- COMMENT_DESCRIPTOR.setCategory("Survey");
- return DESCRIPTORS;
- }
- static Vector<IPropertyDescriptor> getDescriptors() {
- return DESCRIPTORS;
- }
-
-ScenarioResultsElement(AbstractResults results, ResultsElement parent) {
- super(results, parent);
-}
-
-@Override
-ResultsElement createChild(AbstractResults testResults) {
- return new ConfigResultsElement(testResults, this);
-}
-
-@Override
-public String getLabel(Object o) {
- return ((ScenarioResults) this.results).getShortName();
-}
-
-@Override
-public IPropertyDescriptor[] getPropertyDescriptors() {
- Vector<IPropertyDescriptor> descriptors = getDescriptors();
- if (descriptors == null) {
- descriptors = initDescriptors(getStatus());
- }
- int size = descriptors.size();
- IPropertyDescriptor[] descriptorsArray = new IPropertyDescriptor[size];
- descriptorsArray[0] = getInfosDescriptor(getStatus());
- descriptorsArray[1] = getWarningsDescriptor(getStatus());
- for (int i=2; i<size; i++) {
- descriptorsArray[i] = descriptors.get(i);
- }
- return descriptorsArray;
-}
-
-@Override
-public Object getPropertyValue(Object propKey) {
- ScenarioResults scenarioResults = (ScenarioResults) this.results;
- if (propKey.equals(P_ID_SCENARIO_LABEL))
- return scenarioResults.getLabel();
- if (propKey.equals(P_ID_SCENARIO_FILE_NAME))
- return scenarioResults.getFileName();
- if (propKey.equals(P_ID_SCENARIO_SHORT_NAME))
- return scenarioResults.getShortName();
- return super.getPropertyValue(propKey);
-}
-
-/**
- * Returns whether one of the scenario's config has a summary or not.
- *
- * @return <code>true</code> if one of the scenario's config has a summary
- * <code>false</code> otherwise.
- */
-public boolean hasSummary() {
- if (this.results == null) return false;
- return ((ScenarioResults)this.results).hasSummary();
-}
-
-@Override
-void initStatus() {
- if (onlyFingerprints()) {
- if (hasSummary()) {
- super.initStatus();
- } else {
- this.status = READ;
- }
- } else {
- super.initStatus();
- }
-}
-
-@Override
-StringBuilder getFailures(StringBuilder buffer, int kind, StringBuilder excluded) {
- // Write status for scenarios having error
- if ((getStatus() & ERROR_MASK) != 0) {
-
- // Get children status
- StringBuilder childrenBuffer = super.getFailures(new StringBuilder(), kind, excluded);
-
- // Write status on file if not excluded
- if (childrenBuffer.length() > 0) {
- buffer.append(" ");
- buffer.append(getLabel(null));
- IEclipsePreferences preferences = InstanceScope.INSTANCE.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(Util.LINE_SEPARATOR);
- buffer.append(childrenBuffer);
- buffer.append(Util.LINE_SEPARATOR);
- }
- }
- return buffer;
-}
-
-}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/UiPlugin.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/UiPlugin.java
index 872eaaa..2f35a7e 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/UiPlugin.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/UiPlugin.java
@@ -11,9 +11,6 @@
package org.eclipse.test.performance.ui;
import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;
/**
@@ -22,7 +19,6 @@
public class UiPlugin extends Plugin {
//The shared instance.
private static UiPlugin plugin;
- private IPreferenceStore preferenceStore;
/**
* The constructor.
@@ -57,12 +53,5 @@
return plugin;
}
- public IPreferenceStore getPreferenceStore() {
- if (this.preferenceStore == null) {
- this.preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, getBundle().getSymbolicName());
-
- }
- return this.preferenceStore;
- }
}