Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2015-01-23 10:08:16 +0000
committerAxel Richard2015-01-23 10:08:16 +0000
commit886cb9f3484680ddbda9cdf6983ec37fc4b42b30 (patch)
treebf8e483ae4d2961ed032ef17df50a301f7ac0072 /performance
parentb002023f5c26c1690e1e20e655472ee6aa03da6a (diff)
downloadorg.eclipse.emf.compare-886cb9f3484680ddbda9cdf6983ec37fc4b42b30.tar.gz
org.eclipse.emf.compare-886cb9f3484680ddbda9cdf6983ec37fc4b42b30.tar.xz
org.eclipse.emf.compare-886cb9f3484680ddbda9cdf6983ec37fc4b42b30.zip
Fix csv files for performances tests (dirty temporary commit)
Change-Id: I80a9b3ec6cf433dc13edc49064d344fe8ec9ef1c Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Diffstat (limited to 'performance')
-rw-r--r--performance/org.eclipse.emf.compare.tests.performance/pom.xml2
-rw-r--r--performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/FixCSV.java83
2 files changed, 84 insertions, 1 deletions
diff --git a/performance/org.eclipse.emf.compare.tests.performance/pom.xml b/performance/org.eclipse.emf.compare.tests.performance/pom.xml
index 82f82e8e0..f82231760 100644
--- a/performance/org.eclipse.emf.compare.tests.performance/pom.xml
+++ b/performance/org.eclipse.emf.compare.tests.performance/pom.xml
@@ -20,7 +20,7 @@
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<includes>
- <include>org/eclipse/emf/compare/tests/performance/${performance-suite}Suite.class</include>
+ <include>org/eclipse/emf/compare/tests/performance/FixCSV.class</include>
</includes>
<argLine>-Xmx2048m -XX:MaxPermSize=256m</argLine>
</configuration>
diff --git a/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/FixCSV.java b/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/FixCSV.java
new file mode 100644
index 000000000..f6364549e
--- /dev/null
+++ b/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/FixCSV.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.performance;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.junit.Test;
+
+/**
+ * Temporary file: reorganize csv files of performances tests.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ *
+ */
+public class FixCSV {
+
+ @Test
+ public void test() throws IOException {
+ Collection<String> scenarios = new ArrayList<String>();
+ scenarios.add("TestCompare");
+ scenarios.add("TestConflict");
+ scenarios.add("TestDiff");
+ scenarios.add("TestEqui");
+ scenarios.add("TestLogicalModel");
+ scenarios.add("TestMatchContent");
+ scenarios.add("TestMatchId");
+ scenarios.add("TestPostComparisonGMF");
+ scenarios.add("TestPostComparisonUML");
+ scenarios.add("TestPostMatchUML");
+ scenarios.add("TestReq");
+
+ Collection<String> tests = new ArrayList<String>();
+ tests.add("-system_time.csv");
+ tests.add("-heap_delta.csv");
+ tests.add("-heap_peek.csv");
+
+ for (String scenario : scenarios) {
+ for (String test : tests) {
+ File output = new File(scenario + test);
+ if (output.exists()) {
+ Path path = Paths.get(output.toURI());
+ Charset charset = StandardCharsets.UTF_8;
+ List<String> content = Files.readAllLines(path, charset);
+ String newContent = content.get(0) + "\n";
+ // Filled lines with extra ',' if needed
+ // Exclude the first line (titles)
+ for (int i = 1; i < content.size(); i++) {
+ String string = content.get(i);
+ if (string != null && !string.isEmpty()) {
+ newContent += fillEmptyColumns(string, 5) + "\n";
+ }
+ }
+ Files.write(path, newContent.getBytes(charset));
+ }
+ }
+ }
+ }
+
+ private static String fillEmptyColumns(String joinedMeasure, int columns) {
+ final int filled = joinedMeasure.split(",").length;
+ for (int i = 0; i < columns - filled; i++) {
+ joinedMeasure += ",";
+ }
+ return joinedMeasure;
+ }
+}

Back to the top