diff options
Diffstat (limited to 'opendc-trace/opendc-trace-api')
4 files changed, 45 insertions, 2 deletions
diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/ResourceColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/ResourceColumns.kt index 8945823a..44dec95b 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/ResourceColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/ResourceColumns.kt @@ -28,24 +28,29 @@ import java.time.Instant /** * Identifier of the resource. */ +@JvmField public val RESOURCE_ID: TableColumn<String> = stringColumn("resource:id") /** * Start time for the resource. */ +@JvmField public val RESOURCE_START_TIME: TableColumn<Instant> = TableColumn("resource:start_time", Instant::class.java) /** * End time for the resource. */ +@JvmField public val RESOURCE_END_TIME: TableColumn<Instant> = TableColumn("resource:end_time", Instant::class.java) /** * Number of CPUs for the resource. */ +@JvmField public val RESOURCE_NCPUS: TableColumn<Int> = intColumn("resource:num_cpus") /** * Memory capacity for the resource. */ +@JvmField public val RESOURCE_MEM_CAPACITY: TableColumn<Double> = doubleColumn("resource:mem_capacity") diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/ResourceStateColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/ResourceStateColumns.kt index c2d896a8..1933967e 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/ResourceStateColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/ResourceStateColumns.kt @@ -29,84 +29,101 @@ import java.time.Instant /** * Identifier of the resource. */ +@JvmField public val RESOURCE_STATE_ID: TableColumn<String> = stringColumn("resource_state:id") /** * The cluster to which the resource belongs. */ +@JvmField public val RESOURCE_STATE_CLUSTER_ID: TableColumn<String> = stringColumn("resource_state:cluster_id") /** * Timestamp for the state. */ +@JvmField public val RESOURCE_STATE_TIMESTAMP: TableColumn<Instant> = TableColumn("resource_state:timestamp", Instant::class.java) /** * Duration for the state. */ +@JvmField public val RESOURCE_STATE_DURATION: TableColumn<Duration> = TableColumn("resource_state:duration", Duration::class.java) /** * A flag to indicate that the resource is powered on. */ +@JvmField public val RESOURCE_STATE_POWERED_ON: TableColumn<Boolean> = booleanColumn("resource_state:powered_on") /** * Number of CPUs for the resource. */ +@JvmField public val RESOURCE_STATE_NCPUS: TableColumn<Int> = intColumn("resource_state:ncpus") /** * Total CPU capacity of the resource in MHz. */ +@JvmField public val RESOURCE_STATE_CPU_CAPACITY: TableColumn<Double> = doubleColumn("resource_state:cpu_capacity") /** * Total CPU usage of the resource in MHz. */ +@JvmField public val RESOURCE_STATE_CPU_USAGE: TableColumn<Double> = doubleColumn("resource_state:cpu_usage") /** * Total CPU usage of the resource in percentage. */ +@JvmField public val RESOURCE_STATE_CPU_USAGE_PCT: TableColumn<Double> = doubleColumn("resource_state:cpu_usage_pct") /** * Total CPU demand of the resource in MHz. */ +@JvmField public val RESOURCE_STATE_CPU_DEMAND: TableColumn<Double> = doubleColumn("resource_state:cpu_demand") /** * CPU ready percentage. */ +@JvmField public val RESOURCE_STATE_CPU_READY_PCT: TableColumn<Double> = doubleColumn("resource_state:cpu_ready_pct") /** * Memory capacity of the resource in KB. */ +@JvmField public val RESOURCE_STATE_MEM_CAPACITY: TableColumn<Double> = doubleColumn("resource_state:mem_capacity") /** * Memory usage of the resource in KB. */ +@JvmField public val RESOURCE_STATE_MEM_USAGE: TableColumn<Double> = doubleColumn("resource_state:mem_usage") /** * Disk read throughput of the resource in KB/s. */ +@JvmField public val RESOURCE_STATE_DISK_READ: TableColumn<Double> = doubleColumn("resource_state:disk_read") /** * Disk write throughput of the resource in KB/s. */ +@JvmField public val RESOURCE_STATE_DISK_WRITE: TableColumn<Double> = doubleColumn("resource_state:disk_write") /** * Network receive throughput of the resource in KB/s. */ +@JvmField public val RESOURCE_STATE_NET_RX: TableColumn<Double> = doubleColumn("resource_state:net_rx") /** * Network transmit throughput of the resource in KB/s. */ +@JvmField public val RESOURCE_STATE_NET_TX: TableColumn<Double> = doubleColumn("resource_state:net_tx") diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableColumn.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableColumn.kt index 247e7312..776c40c0 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableColumn.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableColumn.kt @@ -39,7 +39,7 @@ public class TableColumn<out T>(public val name: String, type: Class<T>) { * Determine whether the type of the column is a subtype of [column]. */ public fun isAssignableTo(column: TableColumn<*>): Boolean { - return type.isAssignableFrom(column.type) + return name == column.name && type.isAssignableFrom(column.type) } /** @@ -50,7 +50,16 @@ public class TableColumn<out T>(public val name: String, type: Class<T>) { /** * Determine whether this column is equal to [other]. */ - public override fun equals(other: Any?): Boolean = other is TableColumn<*> && name == other.name && type == other.type + public override fun equals(other: Any?): Boolean { + // Fast-path: reference equality + if (this === other) { + return true + } else if (other == null || other !is TableColumn<*>) { + return false + } + + return name == other.name && type == other.type + } /** * Return a string representation of this column. diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TaskColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TaskColumns.kt index 5d3143ff..88bbc623 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TaskColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TaskColumns.kt @@ -26,61 +26,73 @@ package org.opendc.trace /** * A column containing the task identifier. */ +@JvmField public val TASK_ID: TableColumn<Long> = longColumn("task:id") /** * A column containing the identifier of the workflow. */ +@JvmField public val TASK_WORKFLOW_ID: TableColumn<Long> = longColumn("task:workflow_id") /** * A column containing the submit time of the task. */ +@JvmField public val TASK_SUBMIT_TIME: TableColumn<Long> = longColumn("task:submit_time") /** * A column containing the wait time of the task. */ +@JvmField public val TASK_WAIT_TIME: TableColumn<Long> = longColumn("task:wait_time") /** * A column containing the runtime time of the task. */ +@JvmField public val TASK_RUNTIME: TableColumn<Long> = longColumn("task:runtime") /** * A column containing the parents of a task. */ @Suppress("UNCHECKED_CAST") +@JvmField public val TASK_PARENTS: TableColumn<Set<Long>> = TableColumn("task:parents", type = Set::class.java as Class<Set<Long>>) /** * A column containing the children of a task. */ @Suppress("UNCHECKED_CAST") +@JvmField public val TASK_CHILDREN: TableColumn<Set<Long>> = TableColumn("task:children", type = Set::class.java as Class<Set<Long>>) /** * A column containing the requested CPUs of a task. */ +@JvmField public val TASK_REQ_NCPUS: TableColumn<Int> = intColumn("task:req_ncpus") /** * A column containing the allocated CPUs of a task. */ +@JvmField public val TASK_ALLOC_NCPUS: TableColumn<Int> = intColumn("task:alloc_ncpus") /** * A column containing the status of a task. */ +@JvmField public val TASK_STATUS: TableColumn<Int> = intColumn("task:status") /** * A column containing the group id of a task. */ +@JvmField public val TASK_GROUP_ID: TableColumn<Int> = intColumn("task:group_id") /** * A column containing the user id of a task. */ +@JvmField public val TASK_USER_ID: TableColumn<Int> = intColumn("task:user_id") |
