Skip to content

Commit

Permalink
Random scheduler (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasumv authored Mar 25, 2024
1 parent c809871 commit 7274e60
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/main/kotlin/cmu/pasta/sfuzz/core/Configuration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class POS: ScheduleAlgorithm("pos") {
}
}

class Rand: ScheduleAlgorithm("random") {
override fun getScheduler(): Scheduler {
return RandomScheduler()
}
}

class PCT: ScheduleAlgorithm("pct") {
val numSwitchPoints by option().int().default(3)
}
Expand All @@ -52,7 +58,8 @@ class ConfigurationCommand: CliktCommand() {
val scheduler by option().groupChoice(
"replay" to Replay(),
"fifo" to Fifo(),
"pos" to POS()
"pos" to POS(),
"random" to Rand()
)
val fullSchedule by option("-f", "--full").boolean().default(false)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package cmu.pasta.sfuzz.core.scheduler

import cmu.pasta.sfuzz.core.ThreadContext
import cmu.pasta.sfuzz.core.ThreadState

class RandomScheduler: Scheduler {
override fun scheduleNextOperation(threads: List<ThreadContext>): ThreadContext {
return threads.random()
}
}

0 comments on commit 7274e60

Please sign in to comment.