Skip to content

Commit 342fa25

Browse files
committed
lint
1 parent 44f036a commit 342fa25

File tree

5 files changed

+38
-29
lines changed

5 files changed

+38
-29
lines changed

tests/benchmarks/service-benchmarks/jvm/src/aws/sdk/kotlin/benchmarks/service/Common.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ object Common {
2323

2424
fun random(prefix: String = "") = "$prefix${Uuid.random()}"
2525

26-
fun randomStringPayload(scale: Int): String {
27-
return (1..scale)
28-
.map { Random.nextInt(32, 127).toChar() }
29-
.joinToString("")
30-
}
26+
fun randomStringPayload(scale: Int): String = (1..scale)
27+
.map { Random.nextInt(32, 127).toChar() }
28+
.joinToString("")
3129

3230
fun randomBytesPayload(scale: Int): ByteArray {
3331
val bytes = ByteArray(scale)

tests/benchmarks/service-benchmarks/jvm/src/aws/sdk/kotlin/benchmarks/service/ProtocolBenchmarkHarness.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
package aws.sdk.kotlin.benchmarks.service
26

37
import aws.sdk.kotlin.benchmarks.service.definitions.*
@@ -49,15 +53,14 @@ class ProtocolBenchmarkHarness {
4953
operation.setup(client)
5054

5155
try {
52-
if(operation.requireScaling){
53-
for(scale in scales){
54-
println(" Warming up for ${operation.warmupMode.explanation} (scale: ${scale})...")
56+
if (operation.requireScaling) {
57+
for (scale in scales) {
58+
println(" Warming up for ${operation.warmupMode.explanation} (scale: $scale)...")
5559
forAtLeast(operation.warmupMode) { iteration ->
5660
operation.transact(client, scale, iteration)
5761
}
5862
}
59-
}
60-
else{
63+
} else {
6164
println(" Warming up for ${operation.warmupMode.explanation}...")
6265
forAtLeast(operation.warmupMode) { iteration ->
6366
operation.transact(client, 0, iteration)
@@ -66,15 +69,14 @@ class ProtocolBenchmarkHarness {
6669

6770
Common.metricAggregator.clear()
6871

69-
if(operation.requireScaling) {
72+
if (operation.requireScaling) {
7073
for (scale in scales) {
71-
println(" Measuring for ${operation.iterationMode.explanation} (scale: ${scale})...")
74+
println(" Measuring for ${operation.iterationMode.explanation} (scale: $scale)...")
7275
forAtLeast(operation.iterationMode) { iteration ->
7376
operation.transact(client, scale, iteration)
7477
}
7578
}
76-
}
77-
else{
79+
} else {
7880
println(" Measuring for ${operation.iterationMode.explanation}...")
7981
forAtLeast(operation.iterationMode) { iteration ->
8082
operation.transact(client, 0, iteration)

tests/benchmarks/service-benchmarks/jvm/src/aws/sdk/kotlin/benchmarks/service/definitions/CloudwatchProtocolBenchmark.kt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
package aws.sdk.kotlin.benchmarks.service.definitions
26

37
import aws.sdk.kotlin.benchmarks.service.Common
@@ -7,8 +11,8 @@ import aws.smithy.kotlin.runtime.ExperimentalApi
711
import aws.smithy.kotlin.runtime.time.Instant
812
import aws.smithy.kotlin.runtime.time.fromEpochMilliseconds
913
import java.util.*
10-
import kotlin.time.Duration.Companion.seconds
1114
import kotlin.random.Random
15+
import kotlin.time.Duration.Companion.seconds
1216

1317
class CloudwatchProtocolBenchmark : ServiceProtocolBenchmark<CloudWatchClient> {
1418
companion object {
@@ -32,7 +36,7 @@ class CloudwatchProtocolBenchmark : ServiceProtocolBenchmark<CloudWatchClient> {
3236
override val operations get() = listOf(
3337
putMetricDataBenchmark,
3438
getMetricDataBenchmark,
35-
listMetricsBenchmark
39+
listMetricsBenchmark,
3640
)
3741

3842
private val putMetricDataBenchmark = object : AbstractOperationProtocolBenchmark<CloudWatchClient>("Put metric data") {
@@ -47,8 +51,8 @@ class CloudwatchProtocolBenchmark : ServiceProtocolBenchmark<CloudWatchClient> {
4751
dimensions = listOf(
4852
Dimension {
4953
name = "TestDimension"
50-
value = "$suiteId-${scale}"
51-
}
54+
value = "$suiteId-$scale"
55+
},
5256
)
5357
value = Random.nextDouble()
5458
unit = null
@@ -83,13 +87,13 @@ class CloudwatchProtocolBenchmark : ServiceProtocolBenchmark<CloudWatchClient> {
8387
dimensions = listOf(
8488
Dimension {
8589
name = "TestDimension"
86-
value = "$suiteId-${scale}"
87-
}
90+
value = "$suiteId-$scale"
91+
},
8892
)
8993
}
9094
period = 60
9195
}
92-
}
96+
},
9397
)
9498
}
9599

@@ -103,13 +107,13 @@ class CloudwatchProtocolBenchmark : ServiceProtocolBenchmark<CloudWatchClient> {
103107
override val requireScaling = true
104108

105109
override suspend fun transact(client: CloudWatchClient, scale: Int, iteration: Int) {
106-
client.listMetrics (
110+
client.listMetrics(
107111
ListMetricsRequest {
108112
namespace = "TestNamespace"
109-
}
113+
},
110114
)
111115

112116
if ((iteration % 50) == 0) Thread.sleep(2000)
113117
}
114118
}
115-
}
119+
}

tests/benchmarks/service-benchmarks/jvm/src/aws/sdk/kotlin/benchmarks/service/definitions/SecretsManagerProtocolBenchmark.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SecretsManagerProtocolBenchmark : ServiceProtocolBenchmark<SecretsManagerC
3737
Tag {
3838
key = "Iteration"
3939
value = "${iteration.padded()}"
40-
}
40+
},
4141
)
4242

4343
client.createSecret {
@@ -157,7 +157,7 @@ class SecretsManagerProtocolBenchmark : ServiceProtocolBenchmark<SecretsManagerC
157157
Filter {
158158
key = FilterNameStringType.fromValue("tag-value")
159159
values = listOf("${iteration.padded()}")
160-
}
160+
},
161161
)
162162

163163
client.listSecrets {

tests/benchmarks/service-benchmarks/jvm/src/aws/sdk/kotlin/benchmarks/service/definitions/ServiceProtocolBenchmark.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
package aws.sdk.kotlin.benchmarks.service.definitions
26

3-
import aws.sdk.kotlin.benchmarks.service.DEFAULT_WARMUP_ITERATIONS
47
import aws.sdk.kotlin.benchmarks.service.DEFAULT_ITERATIONS
8+
import aws.sdk.kotlin.benchmarks.service.DEFAULT_WARMUP_ITERATIONS
59
import aws.smithy.kotlin.runtime.client.SdkClient
610

711
/**
@@ -39,6 +43,7 @@ interface OperationProtocolBenchmark<C : SdkClient> : OperationBenchmark<C> {
3943
* `RunMode.Iterations(DEFAULT_ITERATIONS)`.
4044
*/
4145
override val iterationMode: RunMode get() = RunMode.Iterations(DEFAULT_ITERATIONS)
46+
4247
/**
4348
* Extended transact method with scale and iteration parameters.
4449
* @param client The service client to use
@@ -59,5 +64,5 @@ interface OperationProtocolBenchmark<C : SdkClient> : OperationBenchmark<C> {
5964
*/
6065
abstract class AbstractOperationProtocolBenchmark<C : SdkClient>(
6166
override val name: String,
62-
override val requireScaling: Boolean = false
63-
) : OperationProtocolBenchmark<C>
67+
override val requireScaling: Boolean = false,
68+
) : OperationProtocolBenchmark<C>

0 commit comments

Comments
 (0)