Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2014-02-13 10:24:53 -0500
committerAxel Richard2014-02-13 11:13:13 -0500
commitaba2363aacab521dbc4692ddec2125ebb3ae7ae8 (patch)
tree4512e353464b9013701952e9c00a47e713f0125c /performance
parent0eb82678a7ce2b2b8098a0d9266e08a7ee97b3d0 (diff)
downloadorg.eclipse.emf.compare-aba2363aacab521dbc4692ddec2125ebb3ae7ae8.tar.gz
org.eclipse.emf.compare-aba2363aacab521dbc4692ddec2125ebb3ae7ae8.tar.xz
org.eclipse.emf.compare-aba2363aacab521dbc4692ddec2125ebb3ae7ae8.zip
Update Logical model test, update measures computing
Diffstat (limited to 'performance')
-rw-r--r--performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java25
-rw-r--r--performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/TestLogicalModel.java24
2 files changed, 43 insertions, 6 deletions
diff --git a/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java b/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java
index c381d8297..4cf71eb92 100644
--- a/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java
+++ b/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java
@@ -43,6 +43,8 @@ import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Ordering;
import com.google.common.io.Closeables;
@@ -88,11 +90,25 @@ public abstract class AbstractEMFComparePerformanceTest {
return point.getMeasures();
}
};
+
private static final Function<TestResult, List<DataPoint>> TEST_RESULT__DATA_POINTS = new Function<TestResult, List<DataPoint>>() {
public List<DataPoint> apply(TestResult testResult) {
return testResult.getDataPoints();
}
};
+
+ private static final Function<Iterable<Double>, Double> AVERAGE = new Function<Iterable<Double>, Double>() {
+ public Double apply(Iterable<Double> it) {
+ Double sum = 0.0;
+ if(!Iterables.isEmpty(it)) {
+ for (Double d : it) {
+ sum += d;
+ }
+ return sum.doubleValue() / Iterables.size(it);
+ }
+ return sum;
+ }
+ };
private static final int DEFAULT_STEPS_NUMBER = 5;
@@ -162,8 +178,13 @@ public abstract class AbstractEMFComparePerformanceTest {
public String apply(Entry<Scenario, Collection<Measure>> entry) {
final Dimension dimension = getFirst(entry.getValue(), null).getDimension();
Iterable<Double> transform = transform(entry.getValue(), MEASURE__VALUE);
- List<Double> sortedCopy = Ordering.natural().sortedCopy(transform);
- Iterable<String> transform2 = transform(sortedCopy,
+
+ List<Double> minAvMax = Lists.newArrayList();
+ minAvMax.add(Ordering.natural().min(transform));
+ minAvMax.add(AVERAGE.apply(transform));
+ minAvMax.add(Ordering.natural().max(transform));
+
+ Iterable<String> transform2 = transform(minAvMax,
new Function<Double, String>() {
public String apply(Double d) {
switch (dimension) {
diff --git a/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/TestLogicalModel.java b/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/TestLogicalModel.java
index ad6ae7a4a..5b7910115 100644
--- a/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/TestLogicalModel.java
+++ b/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/TestLogicalModel.java
@@ -10,16 +10,22 @@
*******************************************************************************/
package org.eclipse.emf.compare.tests.performance;
+import java.net.URL;
+
import org.eclipse.compare.ITypedElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
+import org.osgi.framework.Bundle;
import data.models.Data;
import data.models.SmallInputData;
@@ -47,8 +53,12 @@ public class TestLogicalModel extends AbstractEMFComparePerformanceTest {
try {
PerformanceMonitor monitor = getPerformance().createMonitor("logicalModelUMLSmall");
final Data data = new SmallInputData();
- String baseDir = "D:/git/compare2/org.eclipse.emf.compare/performance/org.eclipse.emf.compare.tests.performance/src/data/models/model_size_small";// location of files to import
- IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription(new Path(baseDir + "/.project"));
+
+ Bundle bundle = Platform.getBundle("org.eclipse.emf.compare.tests.performance");
+ URL entry = bundle.getEntry("src/data/models/model_size_small/.project");
+ URL fileURL = FileLocator.toFileURL(entry);
+ IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription(new Path(fileURL.getPath()));
+
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
project.create(description, new NullProgressMonitor());
project.open(new NullProgressMonitor());
@@ -66,6 +76,7 @@ public class TestLogicalModel extends AbstractEMFComparePerformanceTest {
data.dispose();
} catch (Exception e) {
e.printStackTrace();
+ Assert.fail();
}
}
@@ -74,8 +85,12 @@ public class TestLogicalModel extends AbstractEMFComparePerformanceTest {
try {
PerformanceMonitor monitor = getPerformance().createMonitor("logicalModelUMLNominal");
final Data data = new SmallInputData();
- String baseDir = "D:/git/compare2/org.eclipse.emf.compare/performance/org.eclipse.emf.compare.tests.performance/src/data/models/model_size_nominal";// location of files to import
- IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription(new Path(baseDir + "/.project"));
+
+ Bundle bundle = Platform.getBundle("org.eclipse.emf.compare.tests.performance");
+ URL entry = bundle.getEntry("src/data/models/model_size_nominal/.project");
+ URL fileURL = FileLocator.toFileURL(entry);
+ IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription(new Path(fileURL.getPath()));
+
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
project.create(description, new NullProgressMonitor());
project.open(new NullProgressMonitor());
@@ -93,6 +108,7 @@ public class TestLogicalModel extends AbstractEMFComparePerformanceTest {
data.dispose();
} catch (Exception e) {
e.printStackTrace();
+ Assert.fail();
}
}
}

Back to the top