From 79a2f31c800c23539c413771a3f893c423275372 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 28 Oct 2021 15:18:38 +0200 Subject: refactor(trace): Support gaps in trace data This change updates the implementation of the trace converter and SimTrace implementation to support cases where there is a gap between samples in the trace data. This change allows users to specify what to do in case samples are missing in the trace. The available options are specified in `SimTrace.FillMode`. Currently, we support either carrying the previous value forward or set the usage to zero. --- .../main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'opendc-compute') 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 f23becda..36a76f68 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 @@ -71,8 +71,8 @@ public class ComputeWorkloadLoader(private val baseDir: File) { val cores = reader.getInt(coresCol) val cpuUsage = reader.getDouble(usageCol) - val timeMs = time.toEpochMilli() - val deadlineMs = timeMs + duration.toMillis() + val deadlineMs = time.toEpochMilli() + val timeMs = (time - duration).toEpochMilli() val builder = fragments.computeIfAbsent(id) { Builder() } builder.add(timeMs, deadlineMs, cpuUsage, cores) } -- cgit v1.2.3