From af745282fcbd2bfc2039b90c05bfaab3479fd2b1 Mon Sep 17 00:00:00 2001 From: Simon Ehrenstein <simon.ehrenstein@gmail.com> Date: Fri, 16 Apr 2021 16:48:38 +0200 Subject: [PATCH] Add debug logs to strategies --- .../theodolite/strategies/searchstrategy/BinarySearch.kt | 7 +++++++ .../theodolite/strategies/searchstrategy/LinearSearch.kt | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt index 027444fe3..eea3dceae 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt @@ -1,9 +1,12 @@ package theodolite.strategies.searchstrategy +import mu.KotlinLogging import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension import theodolite.util.Resource +private val logger = KotlinLogging.logger {} + /** * Binary-search-like implementation for determining the smallest suitable number of instances. * @@ -32,6 +35,8 @@ class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm } // special case: length == 1 or 2 if (lower == upper) { + val res = resources[lower] + logger.debug { "Running experiment with load $load and resources $res" } if (this.benchmarkExecutor.runExperiment(load, resources[lower])) return lower else { if (lower + 1 == resources.size) return -1 @@ -41,6 +46,8 @@ class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm // apply binary search for a list with // length > 2 and adjust upper and lower depending on the result for `resources[mid]` val mid = (upper + lower) / 2 + val res = resources[mid] + logger.debug { "Running experiment with load $load and resources $res" } if (this.benchmarkExecutor.runExperiment(load, resources[mid])) { if (mid == lower) { return lower diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt index 08daa082d..84ac327f1 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt @@ -1,9 +1,12 @@ package theodolite.strategies.searchstrategy +import mu.KotlinLogging import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension import theodolite.util.Resource +private val logger = KotlinLogging.logger {} + /** * Linear-search-like implementation for determining the smallest suitable number of instances. * @@ -13,6 +16,8 @@ class LinearSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { for (res in resources) { + + logger.debug { "Running experiment with load $load and resources $res" } if (this.benchmarkExecutor.runExperiment(load, res)) return res } return null -- GitLab