summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-workload/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-06-06 16:21:21 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-06-07 15:46:53 +0200
commit2358257c1080b7ce78270535f82f0b960d48261a (patch)
treebced69c02698e85f995aa9935ddcfb54df23a64f /opendc-compute/opendc-compute-workload/src
parent61b6550d7a476ab1aae45a5b9385dfd6ca4f6b6f (diff)
refactor(trace/api): Introduce type system for trace API
This change updates the trace API by introducing a limited type system for the table columns. Previously, the table columns could have any possible type representable by the JVM. With this change, we limit the available types to a small type system.
Diffstat (limited to 'opendc-compute/opendc-compute-workload/src')
-rw-r--r--opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt16
1 files changed, 7 insertions, 9 deletions
diff --git a/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt b/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt
index 720c7e58..12c2325a 100644
--- a/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt
+++ b/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt
@@ -29,8 +29,6 @@ import org.opendc.trace.*
import org.opendc.trace.conv.*
import java.io.File
import java.lang.ref.SoftReference
-import java.time.Duration
-import java.time.Instant
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.max
@@ -68,9 +66,9 @@ public class ComputeWorkloadLoader(private val baseDir: File) {
return try {
while (reader.nextRow()) {
- val id = reader.get(idCol) as String
- val time = reader.get(timestampCol) as Instant
- val duration = reader.get(durationCol) as Duration
+ val id = reader.getString(idCol)!!
+ val time = reader.getInstant(timestampCol)!!
+ val duration = reader.getDuration(durationCol)!!
val cores = reader.getInt(coresCol)
val cpuUsage = reader.getDouble(usageCol)
@@ -105,13 +103,13 @@ public class ComputeWorkloadLoader(private val baseDir: File) {
return try {
while (reader.nextRow()) {
- val id = reader.get(idCol) as String
+ val id = reader.getString(idCol)!!
if (!fragments.containsKey(id)) {
continue
}
- val submissionTime = reader.get(startTimeCol) as Instant
- val endTime = reader.get(stopTimeCol) as Instant
+ val submissionTime = reader.getInstant(startTimeCol)!!
+ val endTime = reader.getInstant(stopTimeCol)!!
val cpuCount = reader.getInt(cpuCountCol)
val cpuCapacity = reader.getDouble(cpuCapacityCol)
val memCapacity = reader.getDouble(memCol) / 1000.0 // Convert from KB to MB
@@ -162,7 +160,7 @@ public class ComputeWorkloadLoader(private val baseDir: File) {
while (reader.nextRow()) {
@Suppress("UNCHECKED_CAST")
- val members = reader.get(membersCol) as Set<String>
+ val members = reader.getSet(membersCol, String::class.java)!!
val target = reader.getDouble(targetCol)
val score = reader.getDouble(scoreCol)