From 3536386080db1794b8e74c79a221e7b6e214b37c Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Wed, 13 May 2020 17:08:07 +0200 Subject: Add filtering option --- .../kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReader.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReader.kt index 7a2c704b..2f6ce238 100644 --- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReader.kt +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/swf/SwfTraceReader.kt @@ -43,7 +43,8 @@ import java.util.UUID * @param file The trace file. */ class SwfTraceReader( - file: File + file: File, + maxNumCores: Int = -1 ) : TraceReader { /** * The internal iterator to use for this reader. @@ -93,6 +94,11 @@ class SwfTraceReader( cores = values[numAllocatedCoresCol].trim().toInt() memory = values[requestedMemoryCol].trim().toLong() + if (maxNumCores != -1 && cores > maxNumCores) { + println("Skipped a task due to processor count ($cores > $maxNumCores).") + return@forEach + } + if (memory == -1L) { memory = 1000L * cores // assume 1GB of memory per processor if not specified } else { -- cgit v1.2.3