Skip to content
Snippets Groups Projects
Commit 5c33a0ab authored by Marcel Samir Becker's avatar Marcel Samir Becker
Browse files

Comments and clean up

parent 6435c0a9
No related branches found
No related tags found
1 merge request!215Redesign Strategy, Load, and Resources data types
...@@ -14,7 +14,6 @@ private val logger = KotlinLogging.logger {} ...@@ -14,7 +14,6 @@ private val logger = KotlinLogging.logger {}
*/ */
class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) { class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) {
override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? {
val result = binarySearch(load, resources, 0, resources.size - 1) val result = binarySearch(load, resources, 0, resources.size - 1)
if (result == -1) { if (result == -1) {
return null return null
......
...@@ -18,7 +18,6 @@ private val logger = KotlinLogging.logger {} ...@@ -18,7 +18,6 @@ private val logger = KotlinLogging.logger {}
class FullSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) { class FullSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) {
override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? {
var minimalSuitableResources: Resource? = null var minimalSuitableResources: Resource? = null
for (res in resources) { for (res in resources) {
logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" } logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" }
......
...@@ -2,7 +2,6 @@ package theodolite.strategies.searchstrategy ...@@ -2,7 +2,6 @@ package theodolite.strategies.searchstrategy
import io.quarkus.runtime.annotations.RegisterForReflection import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.util.Resource import theodolite.util.Resource
import theodolite.util.Results
/** /**
* Base class for the implementation of Guess strategies. Guess strategies are strategies to determine the resource * Base class for the implementation of Guess strategies. Guess strategies are strategies to determine the resource
......
...@@ -14,6 +14,7 @@ private val logger = KotlinLogging.logger {} ...@@ -14,6 +14,7 @@ private val logger = KotlinLogging.logger {}
* *
* @param benchmarkExecutor Benchmark executor which runs the individual benchmarks. * @param benchmarkExecutor Benchmark executor which runs the individual benchmarks.
* @param guessStrategy Strategy that provides us with a guess for the first resource amount. * @param guessStrategy Strategy that provides us with a guess for the first resource amount.
* @param results current results of all previously performed benchmarks.
*/ */
class InitialGuessSearchStrategy(benchmarkExecutor: BenchmarkExecutor, guessStrategy: GuessStrategy, results: Results) : class InitialGuessSearchStrategy(benchmarkExecutor: BenchmarkExecutor, guessStrategy: GuessStrategy, results: Results) :
SearchStrategy(benchmarkExecutor, guessStrategy, results) { SearchStrategy(benchmarkExecutor, guessStrategy, results) {
......
...@@ -15,13 +15,11 @@ private val logger = KotlinLogging.logger {} ...@@ -15,13 +15,11 @@ private val logger = KotlinLogging.logger {}
class LinearSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) { class LinearSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) {
override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? {
for (res in resources) { for (res in resources) {
logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" } logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" }
if (this.benchmarkExecutor.runExperiment(load, res)) return res if (this.benchmarkExecutor.runExperiment(load, res)) return res
} }
return null return null
} }
} }
...@@ -11,6 +11,7 @@ import theodolite.util.Results ...@@ -11,6 +11,7 @@ import theodolite.util.Results
* *
* @param benchmarkExecutor Benchmark executor which runs the individual benchmarks. * @param benchmarkExecutor Benchmark executor which runs the individual benchmarks.
* @param guessStrategy Guess strategy for the initial resource amount in case the InitialGuessStrategy is selected. * @param guessStrategy Guess strategy for the initial resource amount in case the InitialGuessStrategy is selected.
* @param results the [Results] object.
*/ */
@RegisterForReflection @RegisterForReflection
abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor, val guessStrategy: GuessStrategy? = null, abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor, val guessStrategy: GuessStrategy? = null,
...@@ -20,7 +21,6 @@ abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor, val gues ...@@ -20,7 +21,6 @@ abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor, val gues
* *
* @param load the [LoadDimension] to be tested. * @param load the [LoadDimension] to be tested.
* @param resources List of all possible [Resource]s. * @param resources List of all possible [Resource]s.
* @param lastLowestResource Previous resource demand needed for the given load.
* *
* @return suitable resource for the specified load, or null if no suitable resource exists. * @return suitable resource for the specified load, or null if no suitable resource exists.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment