Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MooBench
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kieker
MooBench
Commits
df17e6dd
Commit
df17e6dd
authored
4 years ago
by
Reiner Jung
Browse files
Options
Downloads
Patches
Plain Diff
Improved compile results with time and build numbers.
parent
fd27dac1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/compile-results/src/main/java/moobench/tools/compile/results/CompileResultsMain.java
+27
-2
27 additions, 2 deletions
...va/moobench/tools/compile/results/CompileResultsMain.java
with
27 additions
and
2 deletions
tools/compile-results/src/main/java/moobench/tools/compile/results/CompileResultsMain.java
+
27
−
2
View file @
df17e6dd
...
@@ -7,6 +7,7 @@ import java.io.File;
...
@@ -7,6 +7,7 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -21,13 +22,14 @@ import com.fasterxml.jackson.databind.JsonNode;
...
@@ -21,13 +22,14 @@ import com.fasterxml.jackson.databind.JsonNode;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.DoubleNode
;
import
com.fasterxml.jackson.databind.node.DoubleNode
;
import
com.fasterxml.jackson.databind.node.JsonNodeFactory
;
import
com.fasterxml.jackson.databind.node.JsonNodeFactory
;
import
com.fasterxml.jackson.databind.node.LongNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
/**
/**
* Read the CSV output of the R script and the existing JSON file and append a
* Read the CSV output of the R script and the existing JSON file and append a
* record to the JSON file based on the CSV dataset.
* record to the JSON file based on the CSV dataset.
*
*
* @author Reiner Jung
* @author Reiner Jung
*
*
*/
*/
...
@@ -51,6 +53,24 @@ public class CompileResultsMain {
...
@@ -51,6 +53,24 @@ public class CompileResultsMain {
ArrayNode
arrayResultsNode
=
(
ArrayNode
)
resultsNode
;
ArrayNode
arrayResultsNode
=
(
ArrayNode
)
resultsNode
;
long
build
=
arrayResultsNode
.
size
();
/** Fix old data in necessary. */
for
(
int
i
=
0
;
i
<
arrayResultsNode
.
size
();
i
++)
{
JsonNode
node
=
arrayResultsNode
.
get
(
i
);
if
(
node
instanceof
ObjectNode
)
{
ObjectNode
objectNode
=
(
ObjectNode
)
node
;
JsonNode
timeValue
=
objectNode
.
get
(
"time"
);
if
(
timeValue
==
null
)
{
objectNode
.
put
(
"time"
,
new
Date
().
getTime
());
}
JsonNode
buildValue
=
objectNode
.
get
(
"build"
);
if
(
buildValue
==
null
)
{
objectNode
.
put
(
"build"
,
i
);
}
}
}
/** Read CSV file. */
/** Read CSV file. */
final
CSVParser
csvParser
=
new
CSVParser
(
Files
.
newBufferedReader
(
Paths
.
get
(
args
[
0
])),
final
CSVParser
csvParser
=
new
CSVParser
(
Files
.
newBufferedReader
(
Paths
.
get
(
args
[
0
])),
CSVFormat
.
DEFAULT
.
withHeader
());
CSVFormat
.
DEFAULT
.
withHeader
());
...
@@ -59,13 +79,18 @@ public class CompileResultsMain {
...
@@ -59,13 +79,18 @@ public class CompileResultsMain {
JsonNodeFactory
factory
=
JsonNodeFactory
.
instance
;
JsonNodeFactory
factory
=
JsonNodeFactory
.
instance
;
/** Put CSV in JSON. */
/** Put CSV in JSON. */
for
(
CSVRecord
record
:
csvParser
.
getRecords
())
{
for
(
CSVRecord
record
:
csvParser
.
getRecords
())
{
Map
<
String
,
JsonNode
>
recordMap
=
new
HashMap
<>();
Map
<
String
,
JsonNode
>
recordMap
=
new
HashMap
<>();
recordMap
.
put
(
"time"
,
new
LongNode
(
new
Date
().
getTime
()));
recordMap
.
put
(
"build"
,
new
LongNode
(
build
++));
for
(
int
i
=
0
;
i
<
record
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
record
.
size
();
i
++)
{
recordMap
.
put
(
header
.
get
(
i
),
new
DoubleNode
(
Double
.
parseDouble
(
record
.
get
(
i
))));
recordMap
.
put
(
header
.
get
(
i
),
new
DoubleNode
(
Double
.
parseDouble
(
record
.
get
(
i
))));
}
}
arrayResultsNode
.
add
(
new
ObjectNode
(
factory
,
recordMap
));
arrayResultsNode
.
add
(
new
ObjectNode
(
factory
,
recordMap
));
}
}
/** Check consistency. */
/** Write JSON file. */
/** Write JSON file. */
ObjectMapper
mapper
=
new
ObjectMapper
();
ObjectMapper
mapper
=
new
ObjectMapper
();
...
...
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