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

Brutal commit of windows adaptations

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