Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
isochrone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Institut für Informatik
dbis
dbis-isochrone
isochrone
Commits
6f2bbaa6
Commit
6f2bbaa6
authored
11 years ago
by
Nikolaus Krismer
Browse files
Options
Downloads
Patches
Plain Diff
added csv file generation (for easy plotting of runtimes)
parent
57344019
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/it/unibz/inf/isochrone/network/AlgorithmRuntimeTest.java
+59
-6
59 additions, 6 deletions
.../it/unibz/inf/isochrone/network/AlgorithmRuntimeTest.java
with
59 additions
and
6 deletions
src/test/java/it/unibz/inf/isochrone/network/AlgorithmRuntimeTest.java
+
59
−
6
View file @
6f2bbaa6
package
it.unibz.inf.isochrone.network
;
package
it.unibz.inf.isochrone.network
;
import
com.google.common.base.Charsets
;
import
it.unibz.inf.isochrone.algorithm.Isochrone
;
import
it.unibz.inf.isochrone.algorithm.Isochrone
;
import
it.unibz.inf.isochrone.algorithm.MDijkstra
;
import
it.unibz.inf.isochrone.algorithm.MDijkstra
;
import
it.unibz.inf.isochrone.algorithm.MineX
;
import
it.unibz.inf.isochrone.algorithm.MineX
;
...
@@ -38,6 +40,8 @@ import org.testng.annotations.Test;
...
@@ -38,6 +40,8 @@ import org.testng.annotations.Test;
public
final
class
AlgorithmRuntimeTest
{
public
final
class
AlgorithmRuntimeTest
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AlgorithmRuntimeTest
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AlgorithmRuntimeTest
.
class
);
private
static
final
int
REPEAT_COUNT
=
5
;
private
static
final
int
REPEAT_COUNT
=
5
;
private
static
final
String
RESULTFILE_ENCODING
=
Charsets
.
UTF_8
.
toString
();
private
static
final
String
RESULTFILE_CSV_RUNTIME
=
"build/reports/tests/algorithm-runtimes.csv"
;
private
static
final
String
RESULTFILE_XML_RUNTIME
=
"build/reports/tests/algorithm-runtimes.xml"
;
private
static
final
String
RESULTFILE_XML_RUNTIME
=
"build/reports/tests/algorithm-runtimes.xml"
;
private
static
final
Direction
DIRECTION
=
Direction
.
INCOMING
;
private
static
final
Direction
DIRECTION
=
Direction
.
INCOMING
;
private
static
final
Mode
MODE
=
Mode
.
MULTIMODAL
;
private
static
final
Mode
MODE
=
Mode
.
MULTIMODAL
;
...
@@ -106,9 +110,9 @@ public final class AlgorithmRuntimeTest {
...
@@ -106,9 +110,9 @@ public final class AlgorithmRuntimeTest {
// Public static methods
// Public static methods
@AfterClass
@AfterClass
public
static
void
writeRuntime
XML
()
{
public
static
void
writeRuntime
s
()
{
final
Set
<
Entry
<
String
,
Map
<
String
,
Long
>>>
resultSet
=
runtimes
.
entrySet
();
writeRuntimeXML
();
write
MapToXML
(
new
File
(
RESULTFILE_XML_RUNTIME
),
resultSet
,
REPEAT_COUNT
);
write
RuntimeCSV
(
);
}
}
@BeforeClass
@BeforeClass
...
@@ -211,7 +215,7 @@ public final class AlgorithmRuntimeTest {
...
@@ -211,7 +215,7 @@ public final class AlgorithmRuntimeTest {
private
static
void
addRuntimeEntry
(
final
String
time
,
final
String
algorithm
,
final
long
runtime
)
{
private
static
void
addRuntimeEntry
(
final
String
time
,
final
String
algorithm
,
final
long
runtime
)
{
if
(!
runtimes
.
containsKey
(
time
))
{
if
(!
runtimes
.
containsKey
(
time
))
{
runtimes
.
put
(
time
,
new
HashMap
<
String
,
Long
>());
runtimes
.
put
(
time
,
new
Linked
HashMap
<
String
,
Long
>());
}
}
final
Map
<
String
,
Long
>
algorithmMap
=
runtimes
.
get
(
time
);
final
Map
<
String
,
Long
>
algorithmMap
=
runtimes
.
get
(
time
);
...
@@ -223,11 +227,50 @@ public final class AlgorithmRuntimeTest {
...
@@ -223,11 +227,50 @@ public final class AlgorithmRuntimeTest {
}
}
}
}
private
static
void
writeMapToCSV
(
final
File
file
,
final
Set
<
Entry
<
String
,
Map
<
String
,
Long
>>>
resultSet
,
final
int
repeatCount
)
{
BufferedWriter
fw
=
null
;
try
{
fw
=
new
BufferedWriter
(
new
PrintWriter
(
file
,
RESULTFILE_ENCODING
));
boolean
isFirstLine
=
true
;
for
(
Entry
<
String
,
Map
<
String
,
Long
>>
runtimeEntry
:
resultSet
)
{
final
String
time
=
runtimeEntry
.
getKey
();
final
Map
<
String
,
Long
>
results
=
runtimeEntry
.
getValue
();
if
(
isFirstLine
)
{
fw
.
write
(
"Runtime;"
);
final
Set
<
String
>
algorithms
=
results
.
keySet
();
for
(
String
algorithmName
:
algorithms
)
{
fw
.
write
(
algorithmName
+
";"
);
}
fw
.
newLine
();
isFirstLine
=
false
;
}
fw
.
write
(
time
+
";"
);
final
Set
<
Entry
<
String
,
Long
>>
timeSet
=
results
.
entrySet
();
for
(
Entry
<
String
,
Long
>
entry
:
timeSet
)
{
fw
.
write
((
entry
.
getValue
().
longValue
()
/
repeatCount
)
+
";"
);
}
fw
.
newLine
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
fw
!=
null
)
{
try
{
fw
.
flush
();
fw
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
private
static
void
writeMapToXML
(
final
File
file
,
final
Set
<
Entry
<
String
,
Map
<
String
,
Long
>>>
resultSet
,
final
int
repeatCount
)
{
private
static
void
writeMapToXML
(
final
File
file
,
final
Set
<
Entry
<
String
,
Map
<
String
,
Long
>>>
resultSet
,
final
int
repeatCount
)
{
BufferedWriter
fw
=
null
;
BufferedWriter
fw
=
null
;
try
{
try
{
fw
=
new
BufferedWriter
(
new
PrintWriter
(
file
,
"UTF-8"
));
fw
=
new
BufferedWriter
(
new
PrintWriter
(
file
,
RESULTFILE_ENCODING
));
fw
.
write
(
"<?xml version=\"1.0\" encoding=\"
UTF-8
\"?>"
);
fw
.
write
(
"<?xml version=\"1.0\" encoding=\"
"
+
RESULTFILE_ENCODING
+
"
\"?>"
);
fw
.
newLine
();
fw
.
newLine
();
fw
.
write
(
"<results numberOfRuns=\""
+
repeatCount
+
"\">"
);
fw
.
write
(
"<results numberOfRuns=\""
+
repeatCount
+
"\">"
);
fw
.
newLine
();
fw
.
newLine
();
...
@@ -262,4 +305,14 @@ public final class AlgorithmRuntimeTest {
...
@@ -262,4 +305,14 @@ public final class AlgorithmRuntimeTest {
}
}
}
}
private
static
void
writeRuntimeCSV
()
{
final
Set
<
Entry
<
String
,
Map
<
String
,
Long
>>>
resultSet
=
runtimes
.
entrySet
();
writeMapToCSV
(
new
File
(
RESULTFILE_CSV_RUNTIME
),
resultSet
,
REPEAT_COUNT
);
}
private
static
void
writeRuntimeXML
()
{
final
Set
<
Entry
<
String
,
Map
<
String
,
Long
>>>
resultSet
=
runtimes
.
entrySet
();
writeMapToXML
(
new
File
(
RESULTFILE_XML_RUNTIME
),
resultSet
,
REPEAT_COUNT
);
}
}
}
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