incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1148627 - in /sling/trunk/bundles/engine: ./ src/test/java/org/apache/sling/engine/benchmarks/
Date Wed, 20 Jul 2011 06:17:11 GMT
Author: cziegeler
Date: Wed Jul 20 06:17:10 2011
New Revision: 1148627

URL: http://svn.apache.org/viewvc?rev=1148627&view=rev
Log:
SLING-1476  : provide number of processed requests

Added:
    sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDriver.java
  (with props)
Modified:
    sling/trunk/bundles/engine/pom.xml
    sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDirectDriver.java
    sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsViaExecutorDriver.java

Modified: sling/trunk/bundles/engine/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/pom.xml?rev=1148627&r1=1148626&r2=1148627&view=diff
==============================================================================
--- sling/trunk/bundles/engine/pom.xml (original)
+++ sling/trunk/bundles/engine/pom.xml Wed Jul 20 06:17:10 2011
@@ -223,7 +223,7 @@
                                     <param name="japex.classPath" value="${project.build.directory}/japex-dependency/*.jar"
/>
                                     <param name="japex.resultUnit" value="ms" />
                                     <param name="japex.warmupIterations" value="5" />
-                                    <param name="japex.runIterations" value="1000" />
+                                    <param name="japex.runIterations" value="100" />
                                     <param name="japex.numberOfThreads" value="50" />
                                     <driver name="AddToStatsDirect">
                                         <param name="japex.driverClass" value="org.apache.sling.engine.benchmarks.AddValueToStatisticsDirectDriver"
/>
@@ -233,6 +233,10 @@
                                         <param name="japex.driverClass" value="org.apache.sling.engine.benchmarks.AddValueToStatisticsViaExecutorDriver"
/>
                                         <param name="description" value="Add a value to
statistics via a separate thread." />
                                     </driver>
+                                    <driver name="AddToStats">
+                                        <param name="japex.driverClass" value="org.apache.sling.engine.benchmarks.AddValueToStatisticsDriver"
/>
+                                        <param name="description" value="Add a value to
statistics using atomic objects." />
+                                    </driver>
                                     <testCase name="test" />
                                 </testSuite>
                             </japexConfig>

Modified: sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDirectDriver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDirectDriver.java?rev=1148627&r1=1148626&r2=1148627&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDirectDriver.java
(original)
+++ sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDirectDriver.java
Wed Jul 20 06:17:10 2011
@@ -5,9 +5,9 @@
  * licenses this file to You under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,25 +17,30 @@
 package org.apache.sling.engine.benchmarks;
 
 import java.util.Random;
-
-import org.apache.commons.math.stat.descriptive.SynchronizedSummaryStatistics;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
 import com.sun.japex.JapexDriverBase;
 import com.sun.japex.TestCase;
 
 public class AddValueToStatisticsDirectDriver extends JapexDriverBase {
-    
-    private SynchronizedSummaryStatistics statistics;
+
+    private final Random random = new Random();
+
+    private AtomicInteger count;
+
+    private AtomicLong sum;
 
     @Override
     public void prepare(TestCase tc) {
-        this.statistics = new SynchronizedSummaryStatistics();
+        this.count = new AtomicInteger();
+        this.sum = new AtomicLong();
     }
 
     @Override
     public void run(TestCase tc) {
-        Random random = new Random();
-        statistics.addValue(random.nextLong());
+        this.count.incrementAndGet();
+        this.sum.addAndGet(random.nextLong());
     }
-    
+
 }

Added: sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDriver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDriver.java?rev=1148627&view=auto
==============================================================================
--- sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDriver.java
(added)
+++ sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDriver.java
Wed Jul 20 06:17:10 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.engine.benchmarks;
+
+import java.util.Random;
+
+import org.apache.commons.math.stat.descriptive.SynchronizedSummaryStatistics;
+
+import com.sun.japex.JapexDriverBase;
+import com.sun.japex.TestCase;
+
+public class AddValueToStatisticsDriver extends JapexDriverBase {
+
+    private final Random random = new Random();
+
+    private SynchronizedSummaryStatistics statistics;
+
+    @Override
+    public void prepare(TestCase tc) {
+        this.statistics = new SynchronizedSummaryStatistics();
+    }
+
+    @Override
+    public void run(TestCase tc) {
+        statistics.addValue(random.nextLong());
+    }
+
+}

Propchange: sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDriver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDriver.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsDriver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsViaExecutorDriver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsViaExecutorDriver.java?rev=1148627&r1=1148626&r2=1148627&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsViaExecutorDriver.java
(original)
+++ sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/benchmarks/AddValueToStatisticsViaExecutorDriver.java
Wed Jul 20 06:17:10 2011
@@ -5,9 +5,9 @@
  * licenses this file to You under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -26,7 +26,9 @@ import com.sun.japex.JapexDriverBase;
 import com.sun.japex.TestCase;
 
 public class AddValueToStatisticsViaExecutorDriver extends JapexDriverBase {
-    
+
+    private final Random random = new Random();
+
     private SynchronizedSummaryStatistics statistics;
     private ExecutorService operationExecutor;
 
@@ -38,7 +40,6 @@ public class AddValueToStatisticsViaExec
 
     @Override
     public void run(TestCase tc) {
-        Random random = new Random();
         final long value = random.nextLong();
         operationExecutor.execute(new Runnable() {
 
@@ -47,5 +48,5 @@ public class AddValueToStatisticsViaExec
             }
         });
     }
-    
+
 }



Mime
View raw message