Skip to content

Commit 08c1eb8

Browse files
committed
Add parameters for benchmark workflow
1 parent ae45114 commit 08c1eb8

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

.github/workflows/benchmark.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@ name: "Running benchmark"
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
warmups:
7+
description: 'number of warmups run before the actual benchmark'
8+
type: number
9+
required: false
10+
iterations:
11+
description: 'number of iterations in the benchmark'
12+
type: number
13+
required: false
14+
iteration-time:
15+
description: 'duraition of individual interation in benchmark'
16+
type: number
17+
required: false
18+
iteration-time-unit:
19+
description: 'timeunit for iteration-time parameter'
20+
default: 's'
21+
type: string
22+
required: false
523
schedule:
624
- cron: "0 2 * * 1"
725

.github/workflows/platform-benchmark.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ on:
1212
description: additional task to add to gradle call
1313
required: false
1414
default: ""
15+
warmups:
16+
description: 'number of warmups run before the actual benchmark'
17+
type: number
18+
required: false
19+
iterations:
20+
description: 'number of iterations in the benchmark'
21+
type: number
22+
required: false
23+
iteration-time:
24+
description: 'duraition of individual interation in benchmark'
25+
type: number
26+
required: false
27+
iteration-time-unit:
28+
description: 'timeunit for iteration-time parameter'
29+
default: 's'
30+
type: string
31+
required: false
1532

1633
jobs:
1734
benchmark:
@@ -39,4 +56,9 @@ jobs:
3956
with:
4057
gradle-version: wrapper
4158
- name: Run benchmarks
42-
run: ./gradlew --no-daemon --info :benchmark:benchmark ${{ inputs.additional-task }}
59+
run: |
60+
./gradlew --no-daemon --info :benchmark:benchmark ${{ inputs.additional-task }} \
61+
-Pbenchmark.warmups=${{ inputs.warmups }} \
62+
-Pbenchmark.iterations=${{ inputs.iterations }} \
63+
-Pbenchmark.iteration_time=${{ inputs.iteration-time }} \
64+
-Pbenchmark.iteration_time_unit=${{ inputs.iteration-time-unit }}

benchmark/build.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ kotlin {
5151
}
5252
}
5353

54+
fun Any?.takeIfNotBlank(): String? = this?.toString()?.takeUnless(String::isBlank)
55+
5456
benchmark {
5557
configurations {
5658
getByName("main") {
57-
warmups = 5
58-
iterations = 3
59-
iterationTime = 1
60-
iterationTimeUnit = "s"
59+
warmups = properties["benchmark.warmups"]?.takeIfNotBlank()?.toInt() ?: 5
60+
iterations = properties["benchmark.iterations"]?.takeIfNotBlank()?.toInt() ?: 10
61+
iterationTime = properties["benchmark.iteration_time"]?.takeIfNotBlank()?.toLong() ?: 1L
62+
iterationTimeUnit = properties["benchmark.iteration_time_unit"]?.takeIfNotBlank() ?: "s"
6163
param("objectPath", "$projectDir/data/openapi.json")
6264
param("schemaPath", "$projectDir/data/schemas/openapi_schema.json")
6365
}

0 commit comments

Comments
 (0)