commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bur...@apache.org
Subject svn commit: r158174 - in jakarta/commons/sandbox/benchmark/trunk/src: java/org/apache/commons/benchmark/xmlrpc/BenchmarkHandler.java test/org/apache/commons/benchmark/Test1.java
Date Sat, 19 Mar 2005 00:53:11 GMT
Author: burton
Date: Fri Mar 18 16:53:10 2005
New Revision: 158174

URL: http://svn.apache.org/viewcvs?view=rev&rev=158174
Log:
more unit tests... more javadoc...

Modified:
    jakarta/commons/sandbox/benchmark/trunk/src/java/org/apache/commons/benchmark/xmlrpc/BenchmarkHandler.java
    jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java

Modified: jakarta/commons/sandbox/benchmark/trunk/src/java/org/apache/commons/benchmark/xmlrpc/BenchmarkHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/benchmark/trunk/src/java/org/apache/commons/benchmark/xmlrpc/BenchmarkHandler.java?view=diff&r1=158173&r2=158174
==============================================================================
--- jakarta/commons/sandbox/benchmark/trunk/src/java/org/apache/commons/benchmark/xmlrpc/BenchmarkHandler.java
(original)
+++ jakarta/commons/sandbox/benchmark/trunk/src/java/org/apache/commons/benchmark/xmlrpc/BenchmarkHandler.java
Fri Mar 18 16:53:10 2005
@@ -54,6 +54,11 @@
                            .getTracker1().getLast().getMeanDuration() );
     }
 
+    /**
+     * Get an individual benchmark as a hashtable with all values exposed.
+     *
+     * @author <a href="mailto:burton@rojo.com">Kevin A. Burton</a>
+     */
     public Hashtable getBenchmarkAsHashtable( String name ) {
 
         Benchmark benchmark = Benchmark.getBenchmark( name );
@@ -66,16 +71,20 @@
         //map.put( "1min.now.duration", new Double( benchmark.getTracker1().getNow().duration
) );
         //map.put( "1min.last.duration", new Double( benchmark.getTracker1().getNow().duration
) );
 
-        addHashtableMetrics( map, benchmark.getTracker1().getLast(), "1min.last." );
-        addHashtableMetrics( map, benchmark.getTracker5().getLast(), "5min.last." );
-        addHashtableMetrics( map, benchmark.getTracker15().getLast(), "15min.last." );
+        addHashtableMetrics( map, benchmark.getTracker1().getLast(), "1min." );
+        addHashtableMetrics( map, benchmark.getTracker5().getLast(), "5min." );
+        addHashtableMetrics( map, benchmark.getTracker15().getLast(), "15min." );
         
         return map;
         
     }
 
     /**
-     * @see Benchmark.getBenchmarks()
+     *
+     * Get all current benchmarks that have been defined in the system. We
+     * return the data as a Hashtable with the name of the benchmark and the
+     * associated values.
+     * 
      * @author <a href="mailto:burton1@rojo.com">Kevin A. Burton</a>
      */
     public Map getBenchmarks() {

Modified: jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java?view=diff&r1=158173&r2=158174
==============================================================================
--- jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
(original)
+++ jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
Fri Mar 18 16:53:10 2005
@@ -33,6 +33,21 @@
         super(testName);
     }
 
+    public void testChild() throws Exception {
+
+        Benchmark b = new Benchmark();
+
+        Benchmark child = b.child( "foo" );
+
+        assertTrue( "child not setup", child.getName().indexOf( "foo" ) != -1 );
+
+        child.start();
+        child.complete();
+
+        assertEquals( 1, child.getTracker1().now.completed );
+
+    }
+    
     //FIXME: write unit test for PERFORMANCE.  With it enabled/disabled we
     //should be able to call it FREQUENTLY without killing the CPU.
     



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


Mime
View raw message