[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.28-25-gd88160e

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Tue Mar 15 18:47:49 CET 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  d88160e448083dcf5524bf926b45b91cf4ebb1a1 (commit)
      from  f23196e82fa25ef60ea80ad0470e6dd074cdc3ae (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=d88160e448083dcf5524bf926b45b91cf4ebb1a1
http://github.com/ceki/logback/commit/d88160e448083dcf5524bf926b45b91cf4ebb1a1

commit d88160e448083dcf5524bf926b45b91cf4ebb1a1
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Tue Mar 15 18:41:26 2011 +0100

    dabbling in yoda time

diff --git a/logback-core/pom.xml b/logback-core/pom.xml
index 51bb098..03383ed 100644
--- a/logback-core/pom.xml
+++ b/logback-core/pom.xml
@@ -84,6 +84,13 @@
           <artifactId>scala-library</artifactId>
           <scope>test</scope>
         </dependency>
+
+        <dependency>
+          <groupId>joda-time</groupId>
+          <artifactId>joda-time</artifactId>
+          <optional>true</optional>
+         </dependency>
+
     </dependencies>
 
 
diff --git a/logback-core/src/test/java/ch/qos/logback/core/time/DateFormattingThroughputTest.java b/logback-core/src/test/java/ch/qos/logback/core/time/DateFormattingThroughputTest.java
new file mode 100644
index 0000000..624390d
--- /dev/null
+++ b/logback-core/src/test/java/ch/qos/logback/core/time/DateFormattingThroughputTest.java
@@ -0,0 +1,99 @@
+package ch.qos.logback.core.time;
+
+import ch.qos.logback.core.contention.RunnableWithCounterAndDone;
+import ch.qos.logback.core.contention.ThreadedThroughputCalculator;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+
+ at Ignore
+public class DateFormattingThroughputTest {
+
+
+  ThreadedThroughputCalculator t;
+
+  static int THREAD_COUNT = 30;
+  static long OVERALL_DURATION_IN_MILLIS = 2000;
+
+  static String PATTERN = "yyyy-MM-dd'T'HH:mm:ss";
+
+  @Test
+  public void sdf() throws InterruptedException {
+    ThreadedThroughputCalculator tp = new ThreadedThroughputCalculator(
+            OVERALL_DURATION_IN_MILLIS);
+
+    SimpleDateFormat sdf = new SimpleDateFormat(PATTERN);
+    RunnableWithCounterAndDone[] sdfRunnables = buildSDFRunnables(sdf);
+    tp.execute(sdfRunnables);
+    tp.printThroughput("SDF with synchronization:   ", true);
+  }
+
+  RunnableWithCounterAndDone[] buildSDFRunnables(SimpleDateFormat sdf) {
+    RunnableWithCounterAndDone[] runnables = new RunnableWithCounterAndDone[THREAD_COUNT];
+    for (int i = 0; i < THREAD_COUNT; i++) {
+      runnables[i] = new SDFRunnabable(sdf);
+    }
+    return runnables;
+  }
+
+  @Test
+  public void yoda() throws InterruptedException {
+    ThreadedThroughputCalculator tp = new ThreadedThroughputCalculator(
+            OVERALL_DURATION_IN_MILLIS);
+
+    DateTimeFormatter fmt = DateTimeFormat.forPattern(PATTERN);
+    RunnableWithCounterAndDone[] yodaRunnables = buildYodaRunnables(fmt);
+    tp.execute(yodaRunnables);
+    tp.printThroughput("Yoda:   ", true);
+  }
+
+  RunnableWithCounterAndDone[] buildYodaRunnables(DateTimeFormatter fmt) {
+    RunnableWithCounterAndDone[] runnables = new RunnableWithCounterAndDone[THREAD_COUNT];
+    for (int i = 0; i < THREAD_COUNT; i++) {
+      runnables[i] = new YodaTimeRunnable(fmt);
+    }
+    return runnables;
+  }
+
+
+  class SDFRunnabable extends RunnableWithCounterAndDone {
+
+    SimpleDateFormat sdf;
+
+    SDFRunnabable(SimpleDateFormat sdf) {
+      this.sdf = sdf;
+    }
+
+    public void run() {
+      while (!done) {
+        synchronized (sdf) {
+          sdf.format(new Date());
+        }
+        counter++;
+      }
+    }
+  }
+
+  class YodaTimeRunnable extends RunnableWithCounterAndDone {
+
+    DateTimeFormatter yodaDTFt;
+
+    YodaTimeRunnable(DateTimeFormatter dtf) {
+      this.yodaDTFt = dtf;
+    }
+
+    public void run() {
+      while (!done) {
+        long now = System.currentTimeMillis();
+        yodaDTFt.print(now);
+        counter++;
+      }
+    }
+  }
+
+}
diff --git a/pom.xml b/pom.xml
index 514ea01..6a30698 100755
--- a/pom.xml
+++ b/pom.xml
@@ -167,6 +167,12 @@
         <version>${scala.version}</version>
       </dependency>
 
+      <dependency>
+         <groupId>joda-time</groupId>
+         <artifactId>joda-time</artifactId>
+         <version>1.6.2</version>
+      </dependency>
+
     </dependencies>
   </dependencyManagement>
   

-----------------------------------------------------------------------

Summary of changes:
 logback-core/pom.xml                               |    7 ++
 .../core/time/DateFormattingThroughputTest.java    |   99 ++++++++++++++++++++
 pom.xml                                            |    6 +
 3 files changed, 112 insertions(+), 0 deletions(-)
 create mode 100644 logback-core/src/test/java/ch/qos/logback/core/time/DateFormattingThroughputTest.java


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list