Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ttc18
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stgroup
ttc18
Commits
51c1256b
Commit
51c1256b
authored
6 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
fix lookup size computation
parent
dcc387ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jastadd-mquat-eris/src/main/java/de/tudresden/inf/st/mquat/eris/ErisMQuATBuilder.java
+23
-16
23 additions, 16 deletions
...java/de/tudresden/inf/st/mquat/eris/ErisMQuATBuilder.java
with
23 additions
and
16 deletions
jastadd-mquat-eris/src/main/java/de/tudresden/inf/st/mquat/eris/ErisMQuATBuilder.java
+
23
−
16
View file @
51c1256b
...
...
@@ -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
...
...
@@ -46,10 +44,10 @@ public class ErisMQuATBuilder {
accessPath
.
addProperty
(
indexOrderPreserving
);
// add energy benchmark properties
Map
<
Integer
,
Property
>
insertProperties
=
new
HashMap
<>();
Map
<
Integer
,
Property
>
linkProperties
=
new
HashMap
<>();
Map
<
Integer
,
Property
>
lookupProperties
=
new
HashMap
<>();
Map
<
Integer
,
Property
>
scanProperties
=
new
HashMap
<>();
Map
<
Integer
,
Property
>
insertProperties
=
new
HashMap
<>();
Map
<
Integer
,
Property
>
linkProperties
=
new
HashMap
<>();
Map
<
Integer
,
Property
>
lookupProperties
=
new
HashMap
<>();
Map
<
Integer
,
Property
>
scanProperties
=
new
HashMap
<>();
for
(
ERISBenchmarkResult
result
:
erisModel
.
getErisAccessPaths
().
get
(
0
).
getResultList
())
{
int
size
=
result
.
getDataSize
();
insertProperties
.
put
(
size
,
new
Property
(
new
Name
(
"insertTime"
+
size
),
"ms"
));
...
...
@@ -100,7 +98,7 @@ public class ErisMQuATBuilder {
);
// add all the attribute stat values
for
(
ERISBenchmarkResult
benchmarkResult:
erisAccessPath
.
getResultList
())
{
for
(
ERISBenchmarkResult
benchmarkResult
:
erisAccessPath
.
getResultList
())
{
Property
insertProperty
=
insertProperties
.
get
(
benchmarkResult
.
getDataSize
());
multiResource
.
addCurrentResourceValue
(
new
CurrentResourceValue
(
insertProperty
.
createRef
(),
new
LiteralExpression
(
benchmarkResult
.
getInsert
()))
...
...
@@ -142,13 +140,13 @@ 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
();
implementation
.
setName
(
new
Name
(
"accessPathSelector"
));
Instance
accessPathInstance
=
new
Instance
(
new
Name
(
"accessPath"
));
Instance
accessPathInstance
=
new
Instance
(
new
Name
(
"accessPath"
));
ResourceRequirement
resourceRequirement
=
new
ResourceRequirement
();
resourceRequirement
.
addInstance
(
accessPathInstance
);
...
...
@@ -184,16 +182,25 @@ public class ErisMQuATBuilder {
int
num_lookups
=
attStats
.
getLookups
();
int
num_inserts
=
attStats
.
getInserts
();
int
num_scans
=
attStats
.
getScans
();
int
num_links
=
attStats
.
getLinks
();
int
att_count
=
attStats
.
getCount
();
int
num_scans
=
attStats
.
getScans
();
int
num_links
=
attStats
.
getLinks
();
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
()));
MultExpression
links
=
new
MultExpression
(
new
LiteralExpression
(
num_links
),
new
PropertyResourceDesignator
(
accessPathInstance
.
createRef
(),
linkProperties
.
get
(
lookupsize
).
createRef
()));
MultExpression
scans
=
new
MultExpression
(
new
LiteralExpression
(
num_scans
),
new
PropertyResourceDesignator
(
accessPathInstance
.
createRef
(),
scanProperties
.
get
(
lookupsize
).
createRef
()));
MultExpression
links
=
new
MultExpression
(
new
LiteralExpression
(
num_links
),
new
PropertyResourceDesignator
(
accessPathInstance
.
createRef
(),
linkProperties
.
get
(
lookupsize
).
createRef
()));
AddExpression
expression
=
new
AddExpression
(
loopups
,
new
AddExpression
(
inserts
,
new
AddExpression
(
scans
,
links
)));
...
...
@@ -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
()
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment