You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/09/12 11:22:36 UTC

svn commit: r1624483 - /tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java

Author: markt
Date: Fri Sep 12 09:22:36 2014
New Revision: 1624483

URL: http://svn.apache.org/r1624483
Log:
Focus timing on BCEL parts of code.

Modified:
    tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java

Modified: tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java?rev=1624483&r1=1624482&r2=1624483&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java Fri Sep 12 09:22:36 2014
@@ -18,6 +18,7 @@ package org.apache.tomcat.util.bcel;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.util.HashSet;
 import java.util.Locale;
@@ -47,7 +48,7 @@ public class TesterPerformance {
             jarURLs.add(new URL("jar:" + new File (libDir, lib).toURI().toURL().toExternalForm() + "!/"));
         }
 
-        long start = System.nanoTime();
+        long duration = 0;
 
         for (URL jarURL : jarURLs) {
             Jar jar = JarFactory.newInstance(jarURL);
@@ -55,16 +56,17 @@ public class TesterPerformance {
             String jarEntryName = jar.getEntryName();
             while (jarEntryName != null) {
                 if (jarEntryName.endsWith(".class")) {
-                    ClassParser cp = new ClassParser(jar.getEntryInputStream(), jarEntryName);
+                    InputStream is = jar.getEntryInputStream();
+                    long start = System.nanoTime();
+                    ClassParser cp = new ClassParser(is, jarEntryName);
                     cp.parse();
+                    duration += System.nanoTime() - start;
                 }
                 jar.nextEntry();
                 jarEntryName = jar.getEntryName();
             }
         }
 
-        long duration = System.nanoTime() - start;
-
         System.out.println("ClassParser performance test took: " + duration + "ns");
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org