You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2015/08/22 16:05:12 UTC

logging-log4j2 git commit: Revert: I mistakenly committed code intended to be a one-off simulation of cache misses

Repository: logging-log4j2
Updated Branches:
  refs/heads/master d1f494eca -> 087df2f29


Revert: I mistakenly committed code intended to be a one-off simulation
of cache misses

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/087df2f2
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/087df2f2
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/087df2f2

Branch: refs/heads/master
Commit: 087df2f29ea017fb4953fa1d5452235c038c93fb
Parents: d1f494e
Author: rpopma <rp...@apache.org>
Authored: Sat Aug 22 23:05:06 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Aug 22 23:05:06 2015 +0900

----------------------------------------------------------------------
 .../perf/jmh/ThreadsafeDateFormatBenchmark.java | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/087df2f2/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadsafeDateFormatBenchmark.java
----------------------------------------------------------------------
diff --git a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadsafeDateFormatBenchmark.java b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadsafeDateFormatBenchmark.java
index d6865a3..c62ea68 100644
--- a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadsafeDateFormatBenchmark.java
+++ b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadsafeDateFormatBenchmark.java
@@ -135,8 +135,8 @@ public class ThreadsafeDateFormatBenchmark {
     private final long currentTimestamp = 0;
     private String cachedTime = null;
 
-    private final AtomicReference<CachedTimeFastFormat> cachedTimeFastFmt = new AtomicReference<>(new CachedTimeFastFormat(System.nanoTime()));
-    private final AtomicReference<CachedTimeFixedFmt> cachedTimeFixedFmt = new AtomicReference<>(new CachedTimeFixedFmt(System.nanoTime()));
+    private final AtomicReference<CachedTimeFastFormat> cachedTimeFastFmt = new AtomicReference<>(new CachedTimeFastFormat(System.currentTimeMillis()));
+    private final AtomicReference<CachedTimeFixedFmt> cachedTimeFixedFmt = new AtomicReference<>(new CachedTimeFixedFmt(System.currentTimeMillis()));
 
     public static void main(final String[] args) {
     }
@@ -151,7 +151,7 @@ public class ThreadsafeDateFormatBenchmark {
     @BenchmarkMode(Mode.SampleTime)
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     public String synchronizedSimpleDateFmt() {
-        final long timestamp = System.nanoTime();
+        final long timestamp = System.currentTimeMillis();
         synchronized (simpleDateFormat) {
             if (timestamp != currentTimestamp) {
                 cachedTime = simpleDateFormat.format(date);
@@ -164,7 +164,7 @@ public class ThreadsafeDateFormatBenchmark {
     @BenchmarkMode(Mode.SampleTime)
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     public String threadLocalSimpleDateFmt() {
-        final long timestamp = System.nanoTime();
+        final long timestamp = System.currentTimeMillis();
         return threadLocalSDFormat.get().format(timestamp);
     }
 
@@ -172,7 +172,7 @@ public class ThreadsafeDateFormatBenchmark {
     @BenchmarkMode(Mode.SampleTime)
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     public String cachedThrdLocalSimpleDateFmt() {
-        final long timestamp = System.nanoTime();
+        final long timestamp = System.currentTimeMillis();
         return threadLocalCachedSDFormat.get().format(timestamp);
     }
 
@@ -180,7 +180,7 @@ public class ThreadsafeDateFormatBenchmark {
     @BenchmarkMode(Mode.SampleTime)
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     public String cachedThrdLocalCustomFormat() {
-        final long timestamp = System.nanoTime();
+        final long timestamp = System.currentTimeMillis();
         return formatFixedReuseBuffer.format(timestamp);
     }
 
@@ -188,21 +188,21 @@ public class ThreadsafeDateFormatBenchmark {
     @BenchmarkMode(Mode.SampleTime)
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     public String fastDateFormat() {
-        return fastDateFormat.format(System.nanoTime());
+        return fastDateFormat.format(System.currentTimeMillis());
     }
 
     @Benchmark
     @BenchmarkMode(Mode.SampleTime)
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     public String fixedDateFormat() {
-        return fixedDateFormat.format(System.nanoTime());
+        return fixedDateFormat.format(System.currentTimeMillis());
     }
 
     @Benchmark
     @BenchmarkMode(Mode.SampleTime)
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     public String atomicFastFormat() {
-        final long timestamp = System.nanoTime();
+        final long timestamp = System.currentTimeMillis();
         final CachedTimeFastFormat current = cachedTimeFastFmt.get();
         if (timestamp != current.timestamp) {
             final CachedTimeFastFormat newTime = new CachedTimeFastFormat(timestamp);
@@ -220,7 +220,7 @@ public class ThreadsafeDateFormatBenchmark {
     @BenchmarkMode(Mode.SampleTime)
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     public String atomicFixedFormat() {
-        final long timestamp = System.nanoTime();
+        final long timestamp = System.currentTimeMillis();
         final CachedTimeFixedFmt current = cachedTimeFixedFmt.get();
         if (timestamp != current.timestamp) {
             final CachedTimeFixedFmt newTime = new CachedTimeFixedFmt(timestamp);