Skip to content
Snippets Groups Projects
Commit 51c1256b authored by Johannes Mey's avatar Johannes Mey
Browse files

fix lookup size computation

parent dcc387ff
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,6 @@ import de.tudresden.inf.st.mquat.jastadd.model.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
......@@ -16,7 +15,6 @@ public class ErisMQuATBuilder {
static Root createModel(ErisModel erisModel) {
Root root = new Root();
// set the objective property runtime
......@@ -142,7 +140,7 @@ public class ErisMQuATBuilder {
// create a new top-level software component
Component component = new Component();
component.setName(new Name("Component" + createName(erisContainer, erisLivingPartition, attribute)));
component.setName(new Name(createName(erisContainer, erisLivingPartition, attribute)));
Implementation implementation = new Implementation();
......@@ -189,7 +187,16 @@ public class ErisMQuATBuilder {
int att_count = attStats.getCount();
// get the correct size
int lookupsize = (int)Math.ceil(Math.pow(2,Math.ceil(Math.log(att_count))));
int lookupsize = 0;
int dist = Integer.MAX_VALUE;
for (Integer i: lookupProperties.keySet()) {
logger.info(i);
if (Math.abs(att_count-i) < dist) {
dist = Math.abs(att_count-i);
lookupsize = i;
}
}
MultExpression loopups = new MultExpression(new LiteralExpression(num_lookups), new PropertyResourceDesignator(accessPathInstance.createRef(), lookupProperties.get(lookupsize).createRef()));
MultExpression inserts = new MultExpression(new LiteralExpression(num_inserts), new PropertyResourceDesignator(accessPathInstance.createRef(), insertProperties.get(lookupsize).createRef()));
MultExpression scans = new MultExpression(new LiteralExpression(num_scans), new PropertyResourceDesignator(accessPathInstance.createRef(), scanProperties.get(lookupsize).createRef()));
......@@ -226,7 +233,7 @@ public class ErisMQuATBuilder {
private static String createName(ERISContainer container, ERISLivingPartition partition, ERISAttribute attribute) {
// TODO use ID instead of name for attribute if possible
return "_Container" + container.getId() + "_Node" + partition.getNodeId() + "_LP" + partition.getLocalId() + "_Attribute" + attribute.getId();
return "Container" + container.getId() + "_Node" + partition.getNodeId() + "_LP" + partition.getLocalId() + "_Attribute" + attribute.getId() + "_" + attribute.getName();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment