changeset 57:b299e21b3ae3

Making more benchmarks.
author shade
date Fri, 31 May 2013 14:47:42 +0400
parents a36185bcdf0d
children 5058ac94c040
files jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/NanotimeBench.java
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/NanotimeBench.java	Fri May 31 14:47:26 2013 +0400
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/NanotimeBench.java	Fri May 31 14:47:42 2013 +0400
@@ -39,10 +39,21 @@
     private long last;
 
     @GenerateMicroBenchmark(BenchmarkType.AverageTimePerOp)
-    public long latency() {
+    public long latency_avg() {
         return System.nanoTime();
     }
 
+    @GenerateMicroBenchmark(BenchmarkType.AverageTimePerOp)
+    public long granularity_avg() {
+        long lst = last;
+        long cur;
+        do {
+            cur = System.nanoTime();
+        } while (cur == lst);
+        last = cur;
+        return cur;
+    }
+
     @GenerateMicroBenchmark(BenchmarkType.SampleTimePerOp)
     public long granularity() {
         long lst = last;