Commit c563f882 authored by Erwan Bousse's avatar Erwan Bousse
Browse files

Brutal commit of windows adaptations

parent 8b0e385f
......@@ -2,15 +2,19 @@
DIR=`dirname $0`
BENCHTOOL="$DIR/../fr.inria.diverse.cloning.benchmark.tool.product/target/products/fr.inria.diverse.cloning.benchmark.tool.product/linux/gtk/x86_64/cloning-benchmark"
MMGENERATOR="$BENCHTOOL mmgen"
MATERIALGENERATOR="$BENCHTOOL matgen"
############### Must point to the folder of the evaluation tool
BENCHTOOLDIR="$DIR/../x86_64/"
###############
BENCHTOOL="$BENCHTOOLDIR/cloning-benchmark"
MMGENERATOR="$BENCHTOOL mmgen nopause"
MATERIALGENERATOR="$BENCHTOOL matgen nopause"
OUTPUTFOLDER=./benchmarktool-workingdir
for i in {1..10}
# We generate 10 bundles, each with 10 metamodels
# We have to proceed this way because unfortunately some memory leak issue forbids us to generate a bundle with 100 metamodels in a single row
for i in `seq 1 1 $1`
do
$MMGENERATOR --maxClasses 50 --maxProp 250 --maxMutProp 50 --nbMetamodels 10 --outputFolder=$OUTPUTFOLDER/$i
$MMGENERATOR --maxClasses 5 --maxProp 250 --maxMutProp 50 --nbMetamodels 10 --outputFolder=$OUTPUTFOLDER/$i
$MATERIALGENERATOR --metamodelsFolder=$OUTPUTFOLDER/$i --outputFile=$OUTPUTFOLDER/bundle$i.jar # --outputProjectFolder=./$i/generated-project
done
#!/bin/bash
RARGS=""
for i in "$@"
do
RARGS="$RARGS $i"
done
R --no-save --args $RARGS < ./process-data.R
ls *.pdf | xargs -I '{}' pdfcrop '{}' '{}'
mv *.pdf benchmarktool-workingdir
#!/bin/bash
RARGS=""
for i in "$@"
do
RARGS="$RARGS $i"
done
R --no-save --args $RARGS < ./process-data.R
ls *.pdf | xargs -I '{}' pdfcrop '{}' '{}'
mv *.pdf benchmarktool-workingdir
#!/bin/bash
DIR=`dirname $0`
BENCHTOOLDIR="$DIR/../fr.inria.diverse.cloning.benchmark.tool.product/target/products/fr.inria.diverse.cloning.benchmark.tool.product/linux/gtk/x86_64/"
BENCHTOOL="$BENCHTOOLDIR/cloning-benchmark"
TOOL="$BENCHTOOL run"
OUTPUTFOLDER=./benchmarktool-workingdir
# Parsing arguments
BUNDLES=""
for arg in "$@"
do
BUNDLES="$BUNDLES$arg,"
done
# To reset registered OSGi bundles
rm -rf "$BENCHTOOLDIR/configuration/org.eclipse.osgi"
$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 1 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal1.csv --dumpsFolder=/tmp2/cloningDumpsAll
#$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 10 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal10.csv --dumpsFolder=/tmp2/cloningDumpsAll
#$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 100 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal100.csv --dumpsFolder=/tmp2/cloningDumpsAll
$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 1000 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal1000.csv --dumpsFolder=/tmp2/cloningDumpsAll --keepDumps
#$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 10000 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal10000.csv --dumpsFolder=/tmp2/cloningDumpsAll
#!/bin/bash
DIR=`dirname $0`
############### Must point to the folder of the evaluation tool
BENCHTOOLDIR="$DIR/../x86_64/"
###############
BENCHTOOL="$BENCHTOOLDIR/cloning-benchmark"
TOOL="$BENCHTOOL run nopause"
OUTPUTFOLDER=./benchmarktool-workingdir
# Parsing arguments (osgi bundles) in order to generate an argument for the evaluation tool
BUNDLES=""
for arg in "$@"
do
BUNDLES="$BUNDLES$arg,"
done
# To reset registered OSGi bundles
rm -rf "$BENCHTOOLDIR/configuration/org.eclipse.osgi"
$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 1 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal1.csv --dumpsFolder=/tmp2/cloningDumpsAll
#$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 10 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal10.csv --dumpsFolder=/tmp2/cloningDumpsAll
#$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 100 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal100.csv --dumpsFolder=/tmp2/cloningDumpsAll
$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 1000 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal1000.csv --dumpsFolder=/tmp2/cloningDumpsAll
#$TOOL --benchmarkMetamodels=$BUNDLES --nbClones 10000 --nbtries 5 --outputFile $OUTPUTFOLDER/resultsFinal10000.csv --dumpsFolder=/tmp2/cloningDumpsAll
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fr.inria.diverse.cloning.benchmark.materialgenerator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fr.inria.diverse.cloning.benchmark.materialgenerator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding//testdata/shareAttributes.ecore=UTF-8
encoding//testdata/shareAttributes.ecorediag=UTF-8
encoding//testdata/simple1.ecore=UTF-8
encoding//testdata/simple1.ecorediag=UTF-8
encoding//testdata/simple2.ecore=UTF-8
encoding//testdata/simple2.ecorediag=UTF-8
encoding//testdata/welldesigned.ecore=UTF-8
encoding//testdata/welldesigned.ecorediag=UTF-8
encoding//testdata/welldesigned2roots.ecorediag=UTF-8
eclipse.preferences.version=1
encoding//testdata/shareAttributes.ecore=UTF-8
encoding//testdata/shareAttributes.ecorediag=UTF-8
encoding//testdata/simple1.ecore=UTF-8
encoding//testdata/simple1.ecorediag=UTF-8
encoding//testdata/simple2.ecore=UTF-8
encoding//testdata/simple2.ecorediag=UTF-8
encoding//testdata/welldesigned.ecore=UTF-8
encoding//testdata/welldesigned.ecorediag=UTF-8
encoding//testdata/welldesigned2roots.ecorediag=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: BenchmarkGenerator
Bundle-SymbolicName: fr.inria.diverse.cloning.benchmark.materialgenerator;singleton:=true
Bundle-Version: 0.1.0.qualifier
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0",
org.eclipse.core.resources;bundle-version="3.8.101",
org.eclipse.emf.codegen.ecore;bundle-version="2.9.1",
org.eclipse.emf.ecore.xmi;bundle-version="2.9.1",
org.eclipse.jdt.core;bundle-version="3.9.1",
fr.inria.diverse.cloning.runtime;bundle-version="0.1.0",
fr.inria.diverse.cloning.materialgenerator;bundle-version="0.1.0",
fr.inria.diverse.cloning.benchmark.common;bundle-version="0.1.0",
fr.inria.diverse.cloning.external-libs;bundle-version="0.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: fr.inria.diverse.cloning.benchmark.materialgenerator.generator,
fr.inria.diverse.cloning.benchmark.materialgenerator.main
Bundle-ClassPath: .
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: BenchmarkGenerator
Bundle-SymbolicName: fr.inria.diverse.cloning.benchmark.materialgenerator;singleton:=true
Bundle-Version: 0.1.0.qualifier
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0",
org.eclipse.core.resources;bundle-version="3.8.101",
org.eclipse.emf.codegen.ecore;bundle-version="2.9.1",
org.eclipse.emf.ecore.xmi;bundle-version="2.9.1",
org.eclipse.jdt.core;bundle-version="3.9.1",
fr.inria.diverse.cloning.runtime;bundle-version="0.1.0",
fr.inria.diverse.cloning.materialgenerator;bundle-version="0.1.0",
fr.inria.diverse.cloning.benchmark.common;bundle-version="0.1.0",
fr.inria.diverse.cloning.external-libs;bundle-version="0.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: fr.inria.diverse.cloning.benchmark.materialgenerator.generator,
fr.inria.diverse.cloning.benchmark.materialgenerator.main
Bundle-ClassPath: .
source.. = src/
output.. = target/classes
bin.includes = plugin.xml,\
META-INF/,\
.
jars.compile.order = .
source.. = src/
output.. = target/classes
bin.includes = plugin.xml,\
META-INF/,\
.
jars.compile.order = .
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="fr.inria.diverse.cloning.benchmark.materialgenerator.main.Application">
</run>
</application>
</extension>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
application="fr.inria.diverse.cloning.benchmark.materialgenerator.application"
name="fr.inria.diverse.cloning.benchmark.materialgenerator">
<property
name="appName"
value="fr.inria.diverse.cloning.benchmark.materialgenerator">
</property>
</product>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="fr.inria.diverse.cloning.benchmark.materialgenerator.main.Application">
</run>
</application>
</extension>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
application="fr.inria.diverse.cloning.benchmark.materialgenerator.application"
name="fr.inria.diverse.cloning.benchmark.materialgenerator">
<property
name="appName"
value="fr.inria.diverse.cloning.benchmark.materialgenerator">
</property>
</product>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014 Université de Rennes 1.
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:
Erwan Bousse - initial API and implementation
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.inria.diverse.cloning.benchmark</groupId>
<artifactId>fr.inria.diverse.cloning.benchmark.materialgenerator</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>fr.inria.diverse.cloning</groupId>
<artifactId>moclodash-evaluation</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014 Université de Rennes 1.
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:
Erwan Bousse - initial API and implementation
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.inria.diverse.cloning.benchmark</groupId>
<artifactId>fr.inria.diverse.cloning.benchmark.materialgenerator</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>fr.inria.diverse.cloning</groupId>
<artifactId>moclodash-evaluation</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
</project>
/*******************************************************************************
* Copyright (c) 2014 Université de Rennes 1.
* 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:
* Erwan Bousse - initial API and implementation
******************************************************************************/
package fr.inria.diverse.cloning.benchmark.materialgenerator.generator;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.ResourceSet;
import fr.inria.diverse.cloning.benchmark.common.BenchmarkMaterial;
import fr.inria.diverse.cloning.benchmark.common.MetamodelMetrics;
import fr.inria.diverse.cloning.benchmark.common.ModelCreator;
import fr.inria.diverse.cloning.materialgenerator.util.CodeGeneration;
import fr.inria.diverse.cloning.runtime.common.CloningMaterial;
import fr.inria.diverse.cloning.runtime.util.EcoreHelper;
public class BenchmarkMaterialGenerator {
private static final String[] cloningNames = { "DeepCloning", "ShareAll","ShareFieldsOnly", "ShareObjOnly" };
public static MetamodelMetrics computeMetrics(ResourceSet metamodel) {
int mutableProperties = 0;
int mutableAttributes = 0;
int mutableReferences = 0;
int totalProperties = 0;
int totalAttributes = 0;
int totalReferences = 0;
int numberOfClasses = 0;
for (EClass c : EcoreHelper.findEClasses(metamodel)) {
numberOfClasses++;
for (EStructuralFeature f : c.getEAllStructuralFeatures()) {
totalProperties++;
if (f.getName().endsWith("_m"))
mutableProperties++;
if (f instanceof EReference) {
totalReferences++;
if (f.getName().endsWith("_m"))
mutableReferences++;
}
if (f instanceof EAttribute) {
totalAttributes++;
if (f.getName().endsWith("_m"))
mutableAttributes++;
}
}
}
return new MetamodelMetrics(totalProperties, totalReferences, totalAttributes, mutableProperties,
mutableReferences, mutableAttributes, numberOfClasses);
}
public static void generate(List<String> metamodelsnames, List<ResourceSet> metamodels, File outputFolder) {
// Computing the class name
String className = "BenchmarkMaterialImpl";
String packageFullName = "cloningbenchmark";
try {
// Preparing the output file and the printer
File outputDir = new File(outputFolder, packageFullName);
outputDir.mkdirs();
File outputFile = new File(outputDir, className + ".java");
outputFile.createNewFile();
PrintStream printer = new PrintStream(outputFile);
String header = "package " + packageFullName + ";\n";
String imports = "";
String classbody = "";
// ModelCreator Interface and EObject imports
imports += "import " + ModelCreator.class.getCanonicalName() + ";\n";
imports += "import " + BenchmarkMaterial.class.getCanonicalName() + ";\n";
imports += "import " + CloningMaterial.class.getCanonicalName() + ";\n";
imports += "import " + List.class.getCanonicalName() + ";\n";
imports += "import " + ArrayList.class.getCanonicalName() + ";\n";
imports += "import " + MetamodelMetrics.class.getCanonicalName() + ";\n";
// Class declaration
classbody += "public class " + className + " implements " + BenchmarkMaterial.class.getSimpleName()
+ " {\n";
// getMetamodelsNames
classbody += "public List<String> getMetamodelsName() {\n";
classbody += "List<String> result = new ArrayList<String>();\n";
for (String mmname : metamodelsnames) {
classbody += "result.add(\"" + mmname + "\");\n";
}
classbody += "return result;\n";
classbody += "}\n";
// getCloningNames
classbody += "public List<String> getCloningNames() {\n";
classbody += "List<String> result = new ArrayList<String>();\n";
for (String c : cloningNames) {
classbody += "result.add(\"" + c + "\");\n";
}
classbody += "return result;\n";
classbody += "}\n";
// getModelCreator
classbody += "public ModelCreator getModelCreator(String metamodelName) {\n";
classbody += "switch (metamodelName.toLowerCase()) {\n";
for (String mmname : metamodelsnames) {
imports += "import " + mmname.toLowerCase() + "modelcreator." + CodeGeneration.firstCharUp(mmname)
+ "ModelCreator;\n";
classbody += "case \"" + mmname.toLowerCase() + "\":\n";
classbody += "return " + CodeGeneration.firstCharUp(mmname) + "ModelCreator.getInstance();\n";
}
classbody += "default: return null;";
classbody += "}\n";
classbody += "}\n";
// getCloningMaterial
classbody += "public CloningMaterial getCloningMaterial(String metamodelName, String cloningName) {\n";
classbody += "switch (metamodelName.toLowerCase()) {\n";
for (String mmname : metamodelsnames) {
classbody += "case \"" + mmname.toLowerCase() + "\":\n";
classbody += "switch (cloningName.toLowerCase()) {\n";
for (String cloningName : cloningNames) {
imports += "import " + mmname.toLowerCase() + cloningName.toLowerCase() + "."
+ CodeGeneration.firstCharUp(mmname) + cloningName + "CloningMaterial;\n";
classbody += "case \"" + cloningName.toLowerCase() + "\":\n";
classbody += "return " + CodeGeneration.firstCharUp(mmname) + cloningName
+ "CloningMaterial.getInstance();\n";