summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-compute/opendc-compute-simulator')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java2
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java16
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/ComputeSchedulers.kt6
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltHostExportColumns.kt9
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt17
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReader.kt11
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReaderImpl.kt29
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt13
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt33
9 files changed, 50 insertions, 86 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java
index 0538a951..657e7f1e 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java
+++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java
@@ -413,7 +413,7 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
long now = clock.millis();
SchedulingRequest request = new SchedulingRequest(task, now);
- task.launchedAt = Instant.ofEpochMilli(now);
+ task.scheduledAt = Instant.ofEpochMilli(now);
taskQueue.add(request);
tasksPending++;
requestSchedulingCycle();
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java
index 4d5611a8..9fb9b5f0 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java
+++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java
@@ -56,12 +56,12 @@ public class ServiceTask {
private ServiceFlavor flavor;
public Workload workload;
- private Map<String, ?> meta; // TODO: remove this
+ private final Map<String, ?> meta; // TODO: remove this
private final List<TaskWatcher> watchers = new ArrayList<>();
private TaskState state = TaskState.CREATED;
- Instant launchedAt = null;
- Instant createdAt;
+ Instant scheduledAt = null;
+ Instant submittedAt;
Instant finishedAt;
SimHost host = null;
private SchedulingRequest request = null;
@@ -88,7 +88,7 @@ public class ServiceTask {
this.workload = workload;
this.meta = meta;
- this.createdAt = this.service.getClock().instant();
+ this.submittedAt = this.service.getClock().instant();
}
@NotNull
@@ -136,13 +136,13 @@ public class ServiceTask {
}
@Nullable
- public Instant getLaunchedAt() {
- return launchedAt;
+ public Instant getScheduledAt() {
+ return scheduledAt;
}
@Nullable
- public Instant getCreatedAt() {
- return createdAt;
+ public Instant getSubmittedAt() {
+ return submittedAt;
}
@Nullable
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/ComputeSchedulers.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/ComputeSchedulers.kt
index 2e4a5bf1..ecf4804a 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/ComputeSchedulers.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/ComputeSchedulers.kt
@@ -50,18 +50,18 @@ public enum class ComputeSchedulerEnum {
TimeshiftNoPeak,
}
-public fun createComputeScheduler(
+public fun createPrefabComputeScheduler(
name: String,
seeder: RandomGenerator,
clock: InstantSource,
): ComputeScheduler {
- return createComputeScheduler(ComputeSchedulerEnum.valueOf(name.uppercase()), seeder, clock)
+ return createPrefabComputeScheduler(ComputeSchedulerEnum.valueOf(name.uppercase()), seeder, clock)
}
/**
* Create a [ComputeScheduler] for the experiment.
*/
-public fun createComputeScheduler(
+public fun createPrefabComputeScheduler(
name: ComputeSchedulerEnum,
seeder: RandomGenerator,
clock: InstantSource,
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltHostExportColumns.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltHostExportColumns.kt
index 13304b47..f43f4b31 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltHostExportColumns.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltHostExportColumns.kt
@@ -87,12 +87,12 @@ public object DfltHostExportColumns {
public val GUESTS_TERMINATED: ExportColumn<HostTableReader> =
ExportColumn(
field = Types.required(INT32).named("guests_terminated"),
- ) { it.guestsTerminated }
+ ) { it.tasksTerminated }
public val GUESTS_RUNNING: ExportColumn<HostTableReader> =
ExportColumn(
field = Types.required(INT32).named("guests_running"),
- ) { it.guestsRunning }
+ ) { it.tasksActive }
public val GUESTS_ERROR: ExportColumn<HostTableReader> =
ExportColumn(
@@ -169,11 +169,6 @@ public object DfltHostExportColumns {
field = Types.optional(INT64).named("boot_time"),
) { it.bootTime?.toEpochMilli() }
- public val BOOT_TIME_ABS: ExportColumn<HostTableReader> =
- ExportColumn(
- field = Types.optional(INT64).named("boot_time_absolute"),
- ) { it.bootTimeAbsolute?.toEpochMilli() }
-
/**
* The columns that are always included in the output file.
*/
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt
index 52a84236..8603f669 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt
@@ -142,26 +142,21 @@ public object DfltTaskExportColumns {
field = Types.optional(INT64).named("provision_time"),
) { it.provisionTime?.toEpochMilli() }
- public val BOOT_TIME: ExportColumn<TaskTableReader> =
+ public val SCHEDULE_TIME: ExportColumn<TaskTableReader> =
ExportColumn(
- field = Types.optional(INT64).named("boot_time"),
- ) { it.bootTime?.toEpochMilli() }
+ field = Types.optional(INT64).named("schedule_time"),
+ ) { it.scheduleTime?.toEpochMilli() }
- public val CREATION_TIME: ExportColumn<TaskTableReader> =
+ public val SUBMISSION_TIME: ExportColumn<TaskTableReader> =
ExportColumn(
- field = Types.optional(INT64).named("creation_time"),
- ) { it.creationTime?.toEpochMilli() }
+ field = Types.optional(INT64).named("submission_time"),
+ ) { it.submissionTime?.toEpochMilli() }
public val FINISH_TIME: ExportColumn<TaskTableReader> =
ExportColumn(
field = Types.optional(INT64).named("finish_time"),
) { it.finishTime?.toEpochMilli() }
- public val BOOT_TIME_ABS: ExportColumn<TaskTableReader> =
- ExportColumn(
- field = Types.optional(INT64).named("boot_time_absolute"),
- ) { it.bootTimeAbsolute?.toEpochMilli() }
-
public val TASK_STATE: ExportColumn<TaskTableReader> =
ExportColumn(
field =
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReader.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReader.kt
index 1d3d46d9..53282b9f 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReader.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReader.kt
@@ -55,12 +55,12 @@ public interface HostTableReader : Exportable {
/**
* The number of guests that are in a terminated state.
*/
- public val guestsTerminated: Int
+ public val tasksTerminated: Int
/**
- * The number of guests that are in a running state.
+ * The number of guests that are active on the Host state.
*/
- public val guestsRunning: Int
+ public val tasksActive: Int
/**
* The number of guests that are in an error state.
@@ -136,9 +136,4 @@ public interface HostTableReader : Exportable {
* The [Instant] at which the host booted relative to the start of the workload.
*/
public val bootTime: Instant?
-
- /**
- * The [Instant] at which the host booted.
- */
- public val bootTimeAbsolute: Instant?
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReaderImpl.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReaderImpl.kt
index 5babb864..4990f0a3 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReaderImpl.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/host/HostTableReaderImpl.kt
@@ -45,8 +45,8 @@ public class HostTableReaderImpl(
_timestamp = table.timestamp
_timestampAbsolute = table.timestampAbsolute
- _guestsTerminated = table.guestsTerminated
- _guestsRunning = table.guestsRunning
+ _tasksTerminated = table.tasksTerminated
+ _tasksActive = table.tasksActive
_guestsError = table.guestsError
_guestsInvalid = table.guestsInvalid
_cpuLimit = table.cpuLimit
@@ -62,7 +62,6 @@ public class HostTableReaderImpl(
_uptime = table.uptime
_downtime = table.downtime
_bootTime = table.bootTime
- _bootTimeAbsolute = table.bootTimeAbsolute
}
override val hostInfo: HostInfo =
@@ -83,13 +82,13 @@ public class HostTableReaderImpl(
get() = _timestampAbsolute
private var _timestampAbsolute = Instant.MIN
- override val guestsTerminated: Int
- get() = _guestsTerminated
- private var _guestsTerminated = 0
+ override val tasksTerminated: Int
+ get() = _tasksTerminated
+ private var _tasksTerminated = 0
- override val guestsRunning: Int
- get() = _guestsRunning
- private var _guestsRunning = 0
+ override val tasksActive: Int
+ get() = _tasksActive
+ private var _tasksActive = 0
override val guestsError: Int
get() = _guestsError
@@ -158,10 +157,6 @@ public class HostTableReaderImpl(
get() = _bootTime
private var _bootTime: Instant? = null
- override val bootTimeAbsolute: Instant?
- get() = _bootTimeAbsolute
- private var _bootTimeAbsolute: Instant? = null
-
/**
* Record the next cycle.
*/
@@ -172,8 +167,8 @@ public class HostTableReaderImpl(
_timestamp = now
_timestampAbsolute = now + startTime
- _guestsTerminated = hostSysStats.guestsTerminated
- _guestsRunning = hostSysStats.guestsRunning
+ _tasksTerminated = hostSysStats.guestsTerminated
+ _tasksActive = hostSysStats.guestsRunning
_guestsError = hostSysStats.guestsError
_guestsInvalid = hostSysStats.guestsInvalid
_cpuLimit = hostCpuStats.capacity
@@ -205,8 +200,8 @@ public class HostTableReaderImpl(
previousUptime = _uptime
previousDowntime = _downtime
- _guestsTerminated = 0
- _guestsRunning = 0
+ _tasksTerminated = 0
+ _tasksActive = 0
_guestsError = 0
_guestsInvalid = 0
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt
index 97d8ca88..85e030aa 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt
@@ -76,19 +76,14 @@ public interface TaskTableReader : Exportable {
public val provisionTime: Instant?
/**
- * The [Instant] at which the task booted relative to the start of the workload.
+ * The [Instant] at which the task was scheduled relative to the start of the workload.
*/
- public val bootTime: Instant?
+ public val scheduleTime: Instant?
/**
- * The [Instant] at which the task booted.
- */
- public val bootTimeAbsolute: Instant?
-
- /**
- * The [Instant] at which the task booted relative to the start of the workload.
+ * The [Instant] at which the task was submitted relative to the start of the workload.
*/
- public val creationTime: Instant?
+ public val submissionTime: Instant?
/**
* The [Instant] at which the task booted relative to the start of the workload.
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt
index 07462b14..d8c6a06e 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt
@@ -65,10 +65,9 @@ public class TaskTableReaderImpl(
_uptime = table.uptime
_downtime = table.downtime
_provisionTime = table.provisionTime
- _bootTime = table.bootTime
- _bootTimeAbsolute = table.bootTimeAbsolute
+ _scheduleTime = table.scheduleTime
- _creationTime = table.creationTime
+ _submissionTime = table.submissionTime
_finishTime = table.finishTime
_taskState = table.taskState
@@ -115,13 +114,13 @@ public class TaskTableReaderImpl(
get() = _provisionTime
private var _provisionTime: Instant? = null
- override val bootTime: Instant?
- get() = _bootTime
- private var _bootTime: Instant? = null
+ override val scheduleTime: Instant?
+ get() = _scheduleTime
+ private var _scheduleTime: Instant? = null
- override val creationTime: Instant?
- get() = _creationTime
- private var _creationTime: Instant? = null
+ override val submissionTime: Instant?
+ get() = _submissionTime
+ private var _submissionTime: Instant? = null
override val finishTime: Instant?
get() = _finishTime
@@ -159,10 +158,6 @@ public class TaskTableReaderImpl(
private var _cpuLostTime = 0L
private var previousCpuLostTime = 0L
- override val bootTimeAbsolute: Instant?
- get() = _bootTimeAbsolute
- private var _bootTimeAbsolute: Instant? = null
-
override val taskState: TaskState?
get() = _taskState
private var _taskState: TaskState? = null
@@ -200,18 +195,12 @@ public class TaskTableReaderImpl(
_cpuLostTime = cpuStats?.lostTime ?: _cpuLostTime
_uptime = sysStats?.uptime?.toMillis() ?: _uptime
_downtime = sysStats?.downtime?.toMillis() ?: _downtime
- _provisionTime = task.launchedAt
- _bootTime = sysStats?.bootTime ?: _bootTime
- _creationTime = task.createdAt
+ _provisionTime = task.scheduledAt
+ _scheduleTime = sysStats?.bootTime ?: _scheduleTime
+ _submissionTime = task.submittedAt
_finishTime = task.finishedAt
_taskState = task.state
-
- if (sysStats != null) {
- _bootTimeAbsolute = sysStats.bootTime + startTime
- } else {
- _bootTimeAbsolute = null
- }
}
/**