[jboss-cvs] JBossAS SVN: r63712 - projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/simple.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jun 28 12:23:41 EDT 2007
Author: kabir.khan at jboss.com
Date: 2007-06-28 12:23:41 -0400 (Thu, 28 Jun 2007)
New Revision: 63712
Modified:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/simple/SimpleReflectToJavassistTestCase.java
Log:
Add a few test to measure creation of Exception's vs throwing them (Time is taken creating the stack trace)
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/simple/SimpleReflectToJavassistTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/simple/SimpleReflectToJavassistTestCase.java 2007-06-28 16:22:18 UTC (rev 63711)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/stress/simple/SimpleReflectToJavassistTestCase.java 2007-06-28 16:23:41 UTC (rev 63712)
@@ -113,4 +113,63 @@
ReflectToJavassist.fieldToJavassist(f);
}
}
+
+ /**
+ * Just here to check the overhead of creating/throwing exceptions
+ */
+ public void testExceptionOverhead() throws Throwable
+ {
+ getRunner().executeScenario(new InstantiateObjectScenario());
+ getRunner().executeScenario(new CreateExceptionScenario());
+ getRunner().executeScenario(new CreateExceptionGetStackTraceScenario());
+ getRunner().executeScenario(new CallMethodWithExceptionScenario());
+ }
+
+ private class InstantiateObjectScenario extends AbstractScenario
+ {
+ public void execute(int thread, int loop) throws Exception
+ {
+ Object o = new Object();
+ }
+ }
+
+ private class CreateExceptionScenario extends AbstractScenario
+ {
+ public void execute(int thread, int loop) throws Exception
+ {
+ RuntimeException e = new RuntimeException();
+ }
+ }
+
+ private class CreateExceptionGetStackTraceScenario extends AbstractScenario
+ {
+ public void execute(int thread, int loop) throws Exception
+ {
+ RuntimeException e = new RuntimeException();
+ e.getStackTrace();
+ }
+ }
+
+
+ private class CallMethodWithExceptionScenario extends AbstractScenario
+ {
+ RuntimeException e = new RuntimeException();
+ public void execute(int thread, int loop) throws Exception
+ {
+ try
+ {
+ method();
+ }
+ catch(Exception e)
+ {
+
+ }
+ }
+
+ private void method()
+ {
+ throw e;
+ }
+ }
+
}
More information about the jboss-cvs-commits
mailing list