Skip to content

Commit 78456f0

Browse files
committed
Merge branch '1.12.x' into 1.13.x
2 parents 37b2499 + 7fc4121 commit 78456f0

File tree

3 files changed

+13
-36
lines changed

3 files changed

+13
-36
lines changed

benchmarks/benchmarks-core/src/jmh/java/io/micrometer/benchmark/core/CounterBenchmark.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ public static void main(String[] args) throws RunnerException {
4242
new Runner(opt).run();
4343
}
4444

45-
private int x = 923;
46-
47-
private int y = 123;
48-
4945
private MeterRegistry registry;
5046

5147
private Counter counter;
@@ -57,20 +53,9 @@ public void setup() {
5753
}
5854

5955
@Benchmark
60-
public int countSum() {
56+
public double countSum() {
6157
counter.increment();
62-
return sum();
63-
}
64-
65-
@Benchmark
66-
public int countSumWithRegistryLookup() {
67-
registry.counter("counter").increment();
68-
return sum();
69-
}
70-
71-
@Benchmark
72-
public int sum() {
73-
return x + y;
58+
return counter.count();
7459
}
7560

7661
}

benchmarks/benchmarks-core/src/jmh/java/io/micrometer/benchmark/core/TagsBenchmark.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@
3131
@OutputTimeUnit(TimeUnit.NANOSECONDS)
3232
public class TagsBenchmark {
3333

34-
@Threads(16)
3534
@Benchmark
36-
public void of() {
37-
Tags.of("key", "value", "key2", "value2", "key3", "value3", "key4", "value4", "key5", "value5");
35+
public Tags of() {
36+
return Tags.of("key", "value", "key2", "value2", "key3", "value3", "key4", "value4", "key5", "value5");
3837
}
3938

40-
@Threads(16)
4139
@Benchmark
42-
public void dotAnd() {
43-
Tags.of("key", "value").and("key2", "value2", "key3", "value3", "key4", "value4", "key5", "value5");
40+
public Tags dotAnd() {
41+
return Tags.of("key", "value").and("key2", "value2", "key3", "value3", "key4", "value4", "key5", "value5");
4442
}
4543

4644
public static void main(String[] args) throws RunnerException {

benchmarks/benchmarks-core/src/jmh/java/io/micrometer/benchmark/core/TimerBenchmark.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ public static void main(String[] args) throws RunnerException {
4646

4747
private Timer timer;
4848

49-
int x = 923;
50-
51-
int y = 123;
52-
5349
@Setup
5450
public void setup() {
5551
registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
@@ -58,25 +54,23 @@ public void setup() {
5854

5955
@Benchmark
6056
public int sumTimedWithSupplier() {
61-
return timer.record(this::sum);
57+
return timer.record(this::doSomething);
6258
}
6359

6460
@Benchmark
65-
public int sumTimedWithSample() {
61+
public long sumTimedWithSample() {
6662
Timer.Sample sample = Timer.start(registry);
67-
int sum = sum();
68-
sample.stop(timer);
69-
return sum;
63+
doSomething();
64+
return sample.stop(timer);
7065
}
7166

7267
@Benchmark
7368
public int sumTimedWithRegistryLookup() {
74-
return registry.timer("timer").record(this::sum);
69+
return registry.timer("timer").record(this::doSomething);
7570
}
7671

77-
@Benchmark
78-
public int sum() {
79-
return x + y;
72+
int doSomething() {
73+
return 923 + 123;
8074
}
8175

8276
}

0 commit comments

Comments
 (0)