hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r919418 - in /httpcomponents/httpclient/trunk/httpclient-benchmark: pom.xml src/main/java/org/apache/http/client/benchmark/Benchmark.java
Date Fri, 05 Mar 2010 14:00:59 GMT
Author: olegk
Date: Fri Mar  5 14:00:58 2010
New Revision: 919418

URL: http://svn.apache.org/viewvc?rev=919418&view=rev
Log:
Benchmark tweaks

Modified:
    httpcomponents/httpclient/trunk/httpclient-benchmark/pom.xml
    httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/Benchmark.java

Modified: httpcomponents/httpclient/trunk/httpclient-benchmark/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-benchmark/pom.xml?rev=919418&r1=919417&r2=919418&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-benchmark/pom.xml (original)
+++ httpcomponents/httpclient/trunk/httpclient-benchmark/pom.xml Fri Mar  5 14:00:58 2010
@@ -55,6 +55,11 @@
       <version>${pom.version}</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore</artifactId>
+      <version>4.1-alpha2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
       <groupId>commons-httpclient</groupId>
       <artifactId>commons-httpclient</artifactId>
       <version>3.1</version>
@@ -105,6 +110,23 @@
           <showDeprecations>${maven.compile.deprecation}</showDeprecations>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.1.1</version>
+        <executions>
+          <execution>
+            <id>test-run</id>
+            <phase>test</phase>
+            <goals>
+              <goal>java</goal>
+            </goals>
+            <configuration>
+              <mainClass>org.apache.http.client.benchmark.Benchmark</mainClass>
       
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 

Modified: httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/Benchmark.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/Benchmark.java?rev=919418&r1=919417&r2=919418&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/Benchmark.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/Benchmark.java
Fri Mar  5 14:00:58 2010
@@ -30,7 +30,6 @@
 import java.io.OutputStream;
 import java.io.Writer;
 import java.net.URI;
-import java.util.Random;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -76,8 +75,10 @@
        };
 
        byte[] content = new byte[contentLen];
-       Random rnd = new Random();
-       rnd.nextBytes(content);
+       int r = Math.abs(content.hashCode());
+       for (int i = 0; i < content.length; i++) {
+           content[i] = (byte) ((r + i) % 96 + 32);
+       }
 
        URI target1 = new URI("http", null, "localhost", port, "/rnd", "c=" + contentLen,
null);
        URI target2 = new URI("http", null, "localhost", port, "/echo", null, null);
@@ -174,6 +175,7 @@
            InputStream instream = request.getInputStream();
            if (instream != null) {
                IO.copy(instream, buffer);
+               buffer.flush();
            }
            byte[] content = buffer.getBuf();
            



Mime
View raw message