mqliang opened a new issue #7866:
URL: https://github.com/apache/pinot/issues/7866
Benchmark code
```
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Measurement(iterations = 5, time = 30)
@Fork(1)
@State(Scope.Benchmark)
public class BenchmarkTimer {
public static void main(String[] args)
throws Exception {
ChainedOptionsBuilder opt = new
OptionsBuilder().include(BenchmarkTimer.class.getSimpleName());
new Runner(opt.build()).run();
}
@Benchmark
public void benchmarkThreadCpuTimer() {
ThreadTimer threadTimer = new ThreadTimer();
long totalThreadCpuTimeNs = threadTimer.getThreadTimeNs();
}
@Benchmark
public void benchmarkSystemCurrentTimeMillis() {
long startWallClockTimeMs = System.currentTimeMillis();
long totalWallClockTimeMs = System.currentTimeMillis() -
startWallClockTimeMs;
long totalWallClockTimeNs =
TimeUnit.MILLISECONDS.toNanos(totalWallClockTimeMs);
}
@Benchmark
public void benchmarkSystemNanoTime() {
long startWallClockTimeNs = System.nanoTime();
long totalWallClockTimeNs = System.nanoTime() - startWallClockTimeNs;
}
}
```
Benchmark result of adoptopenjdk-11.jdk on macOS Monterey v12.0.1
```
Benchmark Mode Cnt Score Error
Units
BenchmarkTimer.benchmarkSystemCurrentTimeMillis avgt 5 54.111 ± 12.025
ns/op
BenchmarkTimer.benchmarkSystemNanoTime avgt 5 61.704 ± 0.645
ns/op
BenchmarkTimer.benchmarkThreadCpuTimer avgt 5 0.526 ± 0.023
ns/op
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]