Author: jsong
Date: Tue Feb 22 13:55:48 2005
New Revision: 154899

URL: http://svn.apache.org/viewcvs?view=rev&rev=154899
Log:
Contributed by Jamie Zyskowski: adding more perf scenarios, implement table 
view for result sets

Added:
    
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControl.java
    
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlImpl.java
    
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlListener.java
    
incubator/beehive/trunk/controls/test/perf/src/org/apache/beehive/controls/perf/standalone/StrlenEventPgmTest.java
    
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/
    
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlen/
    
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlen/Controller.jpf
    
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlenST/
    
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlenST/Controller.jpf
    
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/programmatic/strlenEvent/
    
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/programmatic/strlenEvent/Controller.jpf
    
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/tableview.jsp
Modified:
    incubator/beehive/trunk/controls/test/perf/build.xml
    incubator/beehive/trunk/controls/test/perf/cases/controls-perf.xml
    
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/Controller.jpf
    incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/index.jsp

Modified: incubator/beehive/trunk/controls/test/perf/build.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/build.xml?view=diff&r1=154898&r2=154899
==============================================================================
--- incubator/beehive/trunk/controls/test/perf/build.xml (original)
+++ incubator/beehive/trunk/controls/test/perf/build.xml Tue Feb 22 13:55:48 
2005
@@ -5,7 +5,7 @@
                <echo>
 Usage:
 bootstrap - for report web only (downloads cewolf jars)
-doc - build javadocs
+doc.build - build javadocs
 [re]build - builds everything
 [re]build.tests - build tests and utils
 [re]build.controls - build controls only

Modified: incubator/beehive/trunk/controls/test/perf/cases/controls-perf.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/cases/controls-perf.xml?view=diff&r1=154898&r2=154899
==============================================================================
--- incubator/beehive/trunk/controls/test/perf/cases/controls-perf.xml 
(original)
+++ incubator/beehive/trunk/controls/test/perf/cases/controls-perf.xml Tue Feb 
22 13:55:48 2005
@@ -24,6 +24,33 @@
                                        <timeout>10000</timeout>
                                </controlsperf>
       </test>
+                       <test name="StrlenDclTest_jpf">
+        <controlsperf>
+                                       
<url>http://%{test.hostname}:%{test.port}/controlsPerfWeb/jpf/test/controls/performance/declarative/strlen/Controller.jpf</url>
+                                       <hash>-1989672960</hash>
+                                       <bar>4026</bar>
+                                       <drift>0.20</drift>
+                                       <timeout>10000</timeout>
+                               </controlsperf>
+      </test>
+                       <test name="StrlenEventPgmTest_standalone">
+        <controlsperf>
+                                       <cmdline>%{control.perf.root}/bin/perf 
StrlenEventPgmTest</cmdline>
+                                       <hash>-1989672960</hash>
+                                       <bar>4026</bar>
+                                       <drift>0.20</drift>
+                                       <timeout>10000</timeout>
+                               </controlsperf>
+      </test>
+                       <test name="StrlenEventPgmTest_jpf">
+        <controlsperf>
+                                       
<url>http://%{test.hostname}:%{test.port}/controlsPerfWeb/jpf/test/controls/performance/programmatic/strlenEvent/Controller.jpf</url>
+                                       <hash>-1989672960</hash>
+                                       <bar>4026</bar>
+                                       <drift>0.20</drift>
+                                       <timeout>10000</timeout>
+                               </controlsperf>
+      </test>
                        <test name="StrlenSTPgmTest_standalone">
         <controlsperf>
                                        <cmdline>%{control.perf.root}/bin/perf 
StrlenSTPgmTest</cmdline>
@@ -36,6 +63,15 @@
                        <test name="StrlenSTPgmTest_jpf">
         <controlsperf>
                                        
<url>http://%{test.hostname}:%{test.port}/controlsPerfWeb/jpf/test/controls/performance/programmatic/strlenST/Controller.jpf</url>
+                                       <hash>-1989672960</hash>
+                                       <bar>16062</bar>
+                                       <drift>0.20</drift>
+                                       <timeout>10000</timeout>
+                               </controlsperf>
+      </test>
+                       <test name="StrlenSTDclTest_jpf">
+        <controlsperf>
+                                       
<url>http://%{test.hostname}:%{test.port}/controlsPerfWeb/jpf/test/controls/performance/declarative/strlenST/Controller.jpf</url>
                                        <hash>-1989672960</hash>
                                        <bar>16062</bar>
                                        <drift>0.20</drift>

Added: 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControl.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControl.java?view=auto&rev=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControl.java
 (added)
+++ 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControl.java
 Tue Feb 22 13:55:48 2005
@@ -0,0 +1,16 @@
+package org.apache.beehive.controls.perf.controls.custom;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.events.EventSet;
+
[EMAIL PROTECTED]
+public interface StrlenEventControl
+{
+    @EventSet()
+    public interface EventSet0
+    {
+       public void setLength(int p_val);
+    }
+       
+       public int stringLength(String input);
+}

Added: 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlImpl.java?view=auto&rev=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlImpl.java
 (added)
+++ 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlImpl.java
 Tue Feb 22 13:55:48 2005
@@ -0,0 +1,20 @@
+package org.apache.beehive.controls.perf.controls.custom;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Threading;
+import org.apache.beehive.controls.api.bean.ThreadingPolicy;
+import org.apache.beehive.controls.api.events.Client;
+
[EMAIL PROTECTED]
[EMAIL PROTECTED](ThreadingPolicy.MULTI_THREADED)
+public class StrlenEventControlImpl implements StrlenEventControl
+{
+       @Client
+       static StrlenEventControl.EventSet0 eventSet0;
+       
+       public int stringLength(String input){ 
+               //System.out.println("PERF**** calling setLength with: 
"+input.length());
+               eventSet0.setLength(input.length());
+               return input.length();
+       }
+}

Added: 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlListener.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlListener.java?view=auto&rev=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlListener.java
 (added)
+++ 
incubator/beehive/trunk/controls/test/perf/ctlsrc/org/apache/beehive/controls/perf/controls/custom/StrlenEventControlListener.java
 Tue Feb 22 13:55:48 2005
@@ -0,0 +1,11 @@
+package org.apache.beehive.controls.perf.controls.custom;
+
+public class StrlenEventControlListener implements StrlenEventControl.EventSet0
+{
+       private transient int _length = -1;
+       public void setLength(int p_val){
+               //System.out.println("setting val to:"+p_val);
+               _length = p_val;
+       }
+       public int getLength(){return _length;}
+}

Added: 
incubator/beehive/trunk/controls/test/perf/src/org/apache/beehive/controls/perf/standalone/StrlenEventPgmTest.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/src/org/apache/beehive/controls/perf/standalone/StrlenEventPgmTest.java?view=auto&rev=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/src/org/apache/beehive/controls/perf/standalone/StrlenEventPgmTest.java
 (added)
+++ 
incubator/beehive/trunk/controls/test/perf/src/org/apache/beehive/controls/perf/standalone/StrlenEventPgmTest.java
 Tue Feb 22 13:55:48 2005
@@ -0,0 +1,60 @@
+package org.apache.beehive.controls.perf.standalone;
+
+import org.apache.beehive.controls.perf.utils.Constants;
+import org.apache.beehive.controls.perf.utils.PerfUtil;
+
+// custom control
+import org.apache.beehive.controls.perf.controls.custom.StrlenEventControlBean;
+import 
org.apache.beehive.controls.perf.controls.custom.StrlenEventControlListener;
+
+public class StrlenEventPgmTest
+{
+  public static void main(String[] args) throws Exception
+  {
+    final int iterations = Constants.STRLEN_ITERATIONS;
+    String input = "";
+
+    PerfUtil util = new PerfUtil();
+    if(args.length == 0){
+      input = util.createString(Constants.DEFAULT_STR_SIZE);
+    }
+    else{
+      input = util.createString(Integer.parseInt(args[0]));
+    }
+  
+    StrlenEventPgmTest test = new StrlenEventPgmTest();
+    long cputime;
+    int stringSum = 0;
+
+    // programatically instantiate the control to be used by the test
+    StrlenEventControlBean control = 
(StrlenEventControlBean)java.beans.Beans.instantiate(null,"org.apache.beehive.controls.perf.controls.custom.StrlenEventControlBean");
+    StrlenEventControlListener listener = new StrlenEventControlListener();
+    control.addEventSet0Listener(listener);
+    
+    // warm up the vm
+    cputime = System.currentTimeMillis();
+    for(int i=0; i<iterations; i++){
+      stringSum += test.run(input,control,listener);
+    }
+    cputime = System.currentTimeMillis() - cputime;
+
+    // run it again for the real measurement
+    cputime = System.currentTimeMillis();
+    for(int i=0; i<iterations; i++){
+      stringSum += test.run(input,control,listener);
+    }
+    cputime = System.currentTimeMillis() - cputime;
+
+    // print the results
+    System.out.print(Constants.DELIM+test.getClass().getSimpleName()+" ");
+    System.out.print("hash "+stringSum+" ");
+    System.out.println("time "+cputime);
+
+  }
+
+  private int run(String input, StrlenEventControlBean 
control,StrlenEventControlListener listener) throws Exception
+  {
+       control.stringLength(input);
+    return listener.getLength();
+  }
+}

Added: 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlen/Controller.jpf
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlen/Controller.jpf?view=auto&rev=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlen/Controller.jpf
 (added)
+++ 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlen/Controller.jpf
 Tue Feb 22 13:55:48 2005
@@ -0,0 +1,108 @@
+/*
+ *
+ * N E T U I
+ *
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * All Rights Reserved. Unpublished rights reserved under the copyright laws
+ * of the United States. The software contained on this media is proprietary
+ * to and embodies the confidential technology of BEA Systems, Inc. The
+ * possession or receipt of this information does not convey any right to
+ * disclose its contents, reproduce it, or use,  or license the use,
+ * for manufacture or sale, the information or anything described
+ * therein. Any use, disclosure, or reproduction without BEA System's
+ * prior written permission is strictly prohibited.
+ *
+ * $Header:$
+ */
+package jpf.test.controls.performance.declarative.strlen;
+
+// logging
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.log4j.BasicConfigurator;
+
+// controls framework
+import org.apache.beehive.controls.api.bean.Control;
+
+// netui
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+// test tools
+import org.apache.beehive.test.tools.milton.common.Report;
+import org.apache.beehive.controls.perf.utils.Constants;
+import org.apache.beehive.controls.perf.utils.PerfUtil;
+
+// control used in scenario
+import org.apache.beehive.controls.perf.controls.custom.StrlenControlBean;
+
[EMAIL PROTECTED](
+               forwards = {
+                               @Jpf.Forward(name=Report.RESULTS, path = 
Report.RESULTSJSP) 
+               })
+public class Controller extends PageFlowController
+{
+       // declare the control - instantiated by controls framework
+       @Control
+       public StrlenControlBean control;
+       
+       private Report _report = new Report();
+       private transient Logger logger = Logger.getRootLogger();
+       
+       @Jpf.Action()
+       protected Forward begin()
+       {
+               BasicConfigurator.configure();
+               try
+               {                       
+                       final int iterations = Constants.STRLEN_ITERATIONS;
+                       PerfUtil util = new PerfUtil();
+                       String input = 
util.createString(Constants.DEFAULT_STR_SIZE);
+                       
+                       log("TEST: StrlenDclJpfTest");
+                       long cputime;
+                       int hash = 0;
+                       
+                       // warm up the vm
+                       cputime = System.currentTimeMillis();
+                       for(int i=0; i<iterations; i++){
+                               hash += run(input, control);
+                       }
+                       cputime = System.currentTimeMillis() - cputime;
+                       
+                       // run it again for the real measurement
+                       cputime = System.currentTimeMillis();
+                       for(int i=0; i<iterations; i++){
+                               hash += run(input, control);
+                       }
+                       cputime = System.currentTimeMillis() - cputime;
+                       
+                       // log the results
+                       log("hash "+hash);
+                       log("time "+cputime);
+                       _report.setStatus(Report.PASS);
+               }
+               catch(Exception e)
+               {
+                       _report.setStatus(Report.FAIL);
+                       _report.setExceptionStack(e);
+               }
+               
+               logger = null;
+               return new Forward(Report.RESULTS, Report.KEY, _report);
+       }
+       
+       
+       private int run(String p_input, StrlenControlBean p_control)
+       {
+               return p_control.stringLength(p_input);
+       }
+       
+       private void log(String message)
+       {
+               logger.info("PERF "+message);
+               _report.addMessage(message);
+       }
+               }

Added: 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlenST/Controller.jpf
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlenST/Controller.jpf?view=auto&rev=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlenST/Controller.jpf
 (added)
+++ 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/declarative/strlenST/Controller.jpf
 Tue Feb 22 13:55:48 2005
@@ -0,0 +1,106 @@
+/*
+ *
+ * N E T U I
+ *
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * All Rights Reserved. Unpublished rights reserved under the copyright laws
+ * of the United States. The software contained on this media is proprietary
+ * to and embodies the confidential technology of BEA Systems, Inc. The
+ * possession or receipt of this information does not convey any right to
+ * disclose its contents, reproduce it, or use,  or license the use,
+ * for manufacture or sale, the information or anything described
+ * therein. Any use, disclosure, or reproduction without BEA System's
+ * prior written permission is strictly prohibited.
+ *
+ * $Header:$
+ */
+package jpf.test.controls.performance.declarative.strlenST;
+
+//for logging
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.log4j.BasicConfigurator;
+
+//controls framework
+import org.apache.beehive.controls.api.bean.Control;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.test.tools.milton.common.Report;
+//perf imports
+import org.apache.beehive.controls.perf.controls.custom.StrlenControlSTBean;
+import org.apache.beehive.controls.perf.utils.Constants;
+import org.apache.beehive.controls.perf.utils.PerfUtil;
+
[EMAIL PROTECTED](
+               forwards = {
+                               @Jpf.Forward(name=Report.RESULTS, path = 
Report.RESULTSJSP) 
+               })
+public class Controller extends PageFlowController
+{
+       
+       // declare the control - instantiated by controls framework
+       @Control
+       public StrlenControlSTBean control;
+       
+       private Report _report = new Report();
+       private transient Logger logger = Logger.getRootLogger();
+       
+       @Jpf.Action()
+       protected Forward begin()
+       {
+               BasicConfigurator.configure();
+               try
+               {
+                       
+                       final int iterations = Constants.STRLEN_ITERATIONS;
+                       PerfUtil util = new PerfUtil();
+                       String input = 
util.createString(Constants.DEFAULT_STR_SIZE);
+                       
+                       log("TEST: StrlenSTDclJpfTest");
+                       long cputime;
+                       int hash = 0;
+                       
+                       // warm up the vm
+                       cputime = System.currentTimeMillis();
+                       for(int i=0; i<iterations; i++){
+                               hash += run(input, control);
+                       }
+                       cputime = System.currentTimeMillis() - cputime;
+                       
+                       // run it again for the real measurement
+                       cputime = System.currentTimeMillis();
+                       for(int i=0; i<iterations; i++){
+                               hash += run(input, control);
+                       }
+                       cputime = System.currentTimeMillis() - cputime;
+                       
+                       // log the results
+                       log("hash "+hash);
+                       log("time "+cputime);
+                       _report.setStatus(Report.PASS);
+               }
+               catch(Exception e)
+               {
+                       _report.setStatus(Report.FAIL);
+                       _report.setExceptionStack(e);
+               }
+               
+               logger = null;
+               return new Forward(Report.RESULTS, Report.KEY, _report);
+       }
+       
+       
+       private int run(String p_input, StrlenControlSTBean p_control)
+       {
+               return p_control.stringLength(p_input);
+       }
+       
+       private void log(String message)
+       {
+               logger.info("PERF "+message);
+               _report.addMessage(message);
+       }
+               }

Added: 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/programmatic/strlenEvent/Controller.jpf
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/programmatic/strlenEvent/Controller.jpf?view=auto&rev=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/programmatic/strlenEvent/Controller.jpf
 (added)
+++ 
incubator/beehive/trunk/controls/test/perf/webapps/controlsPerfWeb/jpf/test/controls/performance/programmatic/strlenEvent/Controller.jpf
 Tue Feb 22 13:55:48 2005
@@ -0,0 +1,106 @@
+/*
+ *
+ * N E T U I
+ *
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * All Rights Reserved. Unpublished rights reserved under the copyright laws
+ * of the United States. The software contained on this media is proprietary
+ * to and embodies the confidential technology of BEA Systems, Inc. The
+ * possession or receipt of this information does not convey any right to
+ * disclose its contents, reproduce it, or use,  or license the use,
+ * for manufacture or sale, the information or anything described
+ * therein. Any use, disclosure, or reproduction without BEA System's
+ * prior written permission is strictly prohibited.
+ *
+ * $Header:$
+ */
+package jpf.test.controls.performance.programmatic.strlenEvent;
+
+//for logging
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.log4j.BasicConfigurator;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.test.tools.milton.common.Report;
+//perf imports
+import org.apache.beehive.controls.perf.controls.custom.StrlenEventControlBean;
+import 
org.apache.beehive.controls.perf.controls.custom.StrlenEventControlListener;
+import org.apache.beehive.controls.perf.utils.Constants;
+import org.apache.beehive.controls.perf.utils.PerfUtil;
+
[EMAIL PROTECTED](
+               forwards = {
+                               @Jpf.Forward(name=Report.RESULTS, path = 
Report.RESULTSJSP) 
+               })
+public class Controller extends PageFlowController
+{
+       private Report _report = new Report();
+       private transient Logger logger = Logger.getRootLogger();
+       
+       @Jpf.Action()
+       protected Forward begin()
+       {
+               BasicConfigurator.configure();
+               try
+               {
+                       // instantiate the control
+                       StrlenEventControlBean control 
=(StrlenEventControlBean)java.beans.Beans.instantiate(
+                                       
Thread.currentThread().getContextClassLoader(),
+                       
"org.apache.beehive.controls.perf.controls.custom.StrlenEventControlBean");
+                   StrlenEventControlListener listener = new 
StrlenEventControlListener();
+                   control.addEventSet0Listener(listener);
+                       
+                       final int iterations = Constants.STRLEN_ITERATIONS;
+                       PerfUtil util = new PerfUtil();
+                       String input = 
util.createString(Constants.DEFAULT_STR_SIZE);
+                       
+                       log("TEST: StrlenEventPgmJpfTest");
+                       long cputime;
+                       int hash = 0;
+                       
+                       // warm up the vm
+                       cputime = System.currentTimeMillis();
+                       for(int i=0; i<iterations; i++){
+                               hash += run(input, control, listener);
+                       }
+                       cputime = System.currentTimeMillis() - cputime;
+                       
+                       // run it again for the real measurement
+                       cputime = System.currentTimeMillis();
+                       for(int i=0; i<iterations; i++){
+                               hash += run(input, control, listener);
+                       }
+                       cputime = System.currentTimeMillis() - cputime;
+                       
+                       // log the results
+                       log("hash "+hash);
+                       log("time "+cputime);
+                       _report.setStatus(Report.PASS);
+               }
+               catch(Exception e)
+               {
+                       _report.setStatus(Report.FAIL);
+                       _report.setExceptionStack(e);
+               }
+               
+               logger = null;
+               return new Forward(Report.RESULTS, Report.KEY, _report);
+       }
+       
+       
+       private int run(String p_input, StrlenEventControlBean p_control, 
StrlenEventControlListener p_listener)
+       {
+               p_control.stringLength(p_input);
+               return p_listener.getLength();
+       }
+       
+       private void log(String message)
+       {
+               logger.info("PERF "+message);
+               _report.addMessage(message);
+       }
+               }

Modified: 
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/Controller.jpf
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/Controller.jpf?view=diff&r1=154898&r2=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/Controller.jpf 
(original)
+++ 
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/Controller.jpf 
Tue Feb 22 13:55:48 2005
@@ -93,11 +93,39 @@
        }
        
        @Jpf.Action()
-       protected Forward tableview(ReportForm form)
+       protected Forward tableview()
        {
-               Forward f = new Forward("error");
-               getRequest().setAttribute("msg", "NYI");
-               return f;
+               try
+               {
+                       String filename = getRequest().getParameter("filename");
+                       String controlKey = 
getRequest().getParameter("controlKey");
+                       ensureControlInited(filename,controlKey);
+                       PerfResultControlBean control = 
_controls.get(controlKey);
+                       ResultSetDocument.ResultSet resultSet = 
control.getResultSet(filename);
+                       return new Forward("tableview","resultSet",resultSet);
+               
+               }
+               catch(ClassNotFoundException cnfe)
+               {
+                       Forward f = new Forward("error");
+                       getRequest().setAttribute("msg", 
"ClassNotFouncException "+cnfe.getMessage());
+                       cnfe.printStackTrace();
+                       return f;
+               }
+               catch(XmlException xe)
+               {
+                       Forward f = new Forward("error");
+                       getRequest().setAttribute("msg", "XmlException 
"+xe.getMessage());
+                       xe.printStackTrace();
+                       return f;
+               }
+               catch(IOException ioe)
+               {
+                       Forward f = new Forward("error");
+                       getRequest().setAttribute("msg", "IOException 
"+ioe.getMessage());
+                       ioe.printStackTrace();
+                       return f;
+               }               
        }
        
        @Jpf.Action()

Modified: 
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/index.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/index.jsp?view=diff&r1=154898&r2=154899
==============================================================================
--- incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/index.jsp 
(original)
+++ incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/index.jsp 
Tue Feb 22 13:55:48 2005
@@ -54,11 +54,13 @@
                                String filename = (String)xmlbeansFilenames[i];
                                allFilenames.add(filename);
                                ResultSetDocument.ResultSet xmlbeanResultSet = 
(ResultSetDocument.ResultSet)xmlbeanResultSets.get((Object)filename);
+                               String sXmlBeans = "xmlbeans";
                                %>
                                        <tr>
                                                <td id="RESULT TABLE">
                                                        <netui:anchor 
action="tableview">
                                                                
<netui:parameter name="filename" value="<%=(String)xmlbeansFilenames[i]%>"/>
+                                                               
<netui:parameter name="controlKey" value="<%=sXmlBeans%>"/>
                                                                <netui:label 
value="View"/>  
                                                        </netui:anchor>
                                                </td>
@@ -109,11 +111,13 @@
                                String filename = (String) controlFilenames[i];
                                allFilenames.add(filename);
                                ResultSetDocument.ResultSet controlResultSet = 
(ResultSetDocument.ResultSet)controlResultSets.get((Object)filename);
+                               String sControls = "controls";
                                %>
                                        <tr>
                                                <td id="RESULT TABLE">
                                                        <netui:anchor 
action="tableview">
                                                                
<netui:parameter name="filename" value="<%=(String)controlFilenames[i]%>"/>
+                                                               
<netui:parameter name="controlKey" value="<%=sControls%>"/>
                                                                <netui:label 
value="View"/>  
                                                        </netui:anchor>
                                                </td>

Added: 
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/tableview.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/tableview.jsp?view=auto&rev=154899
==============================================================================
--- 
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/tableview.jsp 
(added)
+++ 
incubator/beehive/trunk/controls/test/perf/webapps/reportWeb/jpf/tableview.jsp 
Tue Feb 22 13:55:48 2005
@@ -0,0 +1,88 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0"; 
prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0"; prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0"; 
prefix="netui-template"%>
+<%@ page 
import="org.apache.beehive.controls.perf.controls.custom.PerfResultControlBean"%>
+<%@ page import="org.openuri.perf.*"%>
+<%@ page import="java.util.Iterator"%>
+<%@ page import="java.util.HashMap"%>
+<%@ page import="java.util.Set"%>
+<%@ page import="org.apache.beehive.netui.pageflow.PageFlowUtils"%>
+
+<% 
+ResultSetDocument.ResultSet resultSet = 
(ResultSetDocument.ResultSet)PageFlowUtils.getPageInput("resultSet", request);
+%>
+
+<netui:html>
+       <head>
+               <title>Runtime Performance Results</title>
+               <link rel="stylesheet" type="text/css" 
href="../runtimePerf.css" />
+         <meta content="text/html; charset=windows-1252" 
http-equiv=Content-Type>
+       </head>
+       
+       <netui:body>
+
+               <img src="../images/runtime.jpeg" align="left">
+               <img src="../images/runtime.jpeg" align="right">
+               <h1 class=margin>Runtime Performance Result Table</h1>
+               <h2><a href="../index.jsp">Home</a></h2>
+       
+               <h4 class=margin>Result Set Environment</h4>
+               <table border="1" id="RESULT ENVIRONMENT">
+                                       <tr>
+                                               <td id="RESULT 
HEADINGS">Hostname</td>
+                                               <td id="RESULT 
HEADINGS">Date</td>
+                                               <td id="RESULT HEADINGS">OS</td>
+                                               <td id="RESULT 
HEADINGS">JVM</td>
+                                               <td id="RESULT 
HEADINGS">Note</td>
+                                       </tr>
+                                       <tr>
+                                               <td id="RESULT HOSTNAME"><% 
out.print(resultSet.getEnvironment().getHostname()); %></td>
+                                               <td id="RESULT DATE"><% 
out.print(resultSet.getEnvironment().getDate()); %></td>
+                                               <td id="RESULT OS"><% 
out.print(resultSet.getEnvironment().getOs()); %></td>
+                                               <td id="RESULT JVM"><% 
out.print(resultSet.getEnvironment().getJvm()); %></td>
+                                               <% if(null != 
resultSet.getEnvironment().getNote())
+                                               {%>
+                                                       <td id="RESULT NOTE"><% 
out.print(resultSet.getEnvironment().getNote()); %></td>
+                                               <%}
+                                               else
+                                               {%>
+                                                       <td id="RESULT 
NOTE"><%out.print(" ");%></td>
+                                               <%}%>
+                                       </tr>
+               </table>
+
+
+               <h4 class=margin>Result Set</h4>
+               <table border="1" id="RESULT SET">
+                                       <tr>
+                                               <td id="RESULT HEADINGS">Test 
Name</td>
+                                               <td id="RESULT 
HEADINGS">Time</td>
+                                               <td id="RESULT 
HEADINGS">Memory</td>
+                                               <td id="RESULT 
HEADINGS">Note</td>
+                                               <td id="RESULT HEADINGS">Custom 
Data</td>
+                                       </tr>
+               <%
+                       Result[] results = resultSet.getResultArray();
+                       for(int i=0; i<results.length; i++){
+                               %>
+                                       <tr>
+                                               <td id="RESULT TESTNAME"><% 
out.print(results[i].getName()); %></td>
+                                               <td id="RESULT TIME"><% 
out.print(results[i].getTime()); %></td>
+                                               <td id="RESULT MEMORY"><% 
out.print(results[i].getMemory()); %></td>
+                                               <td id="RESULT NOTE"><% 
out.print(results[i].getNote()); %></td>
+                                               <%
+                                                       Custom[] customs = 
results[i].getCustomArray();
+                                                       for(int j=0; 
j<customs.length; j++){
+                                                       %>
+                                                               <td id="RESULT 
CUSTOM"><% out.print(customs[j]); %></td>
+                                                       <%}
+                                               %>
+                                       </tr>
+                               <%
+                       }
+               %>
+               </table>
+
+       </netui:body>
+</netui:html>


Reply via email to