Source Code Cross Referenced for AllLocationsMeasurement.java in  » Byte-Code » PROSE » measurements » suites » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Byte Code » PROSE » measurements.suites 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // $Id: AllLocationsMeasurement.java,v 1.2 2004/05/12 17:26:52 anicoara Exp $
002:        // =====================================================================
003:        //
004:        // (history at end)
005:        //
006:
007:        package measurements.suites;
008:
009:        import junit.framework.Assert;
010:        import junit.framework.Test;
011:        import ch.ethz.inf.util.junit.PerformanceTest;
012:        import ch.ethz.inf.util.junit.PerformanceTestSuite;
013:        import ch.ethz.prose.*;
014:        import ch.ethz.prose.crosscut.Crosscut;
015:        import ch.ethz.prose.crosscut.MethodCut;
016:        import ch.ethz.prose.filter.*;
017:
018:        /**
019:         * JUnit performs a suite of measurements for local interceptions
020:         * of a method using <em>AllLocationsCrosscut</em>.
021:         *
022:         * The test can be used both in native and in runes mode.
023:         * In both native and runes mode, the test
024:         * <code>testLocalCall</code> calls a number of <code>RUNS</code>
025:         * time a void method.
026:         *
027:         * If RUNES in enabled, the following measurements are meaningfull
028:         * <ul>
029:         * <li> <code>testLocalCallsNormal</code>: measure how much it takes
030:         * to call RUNS times a trapped function while extracting argument values
031:         * <li> <code>testLocalCallsFast</code>: measure how much it takes
032:         * to call RUNS times a trapped function without retrieving the actual
033:         * arguments from the stack.
034:         * </ul>
035:         *
036:         * @version	$Revision: 1.2 $
037:         * @author	Andrei Popovici
038:         */
039:        public class AllLocationsMeasurement extends PerformanceTest {
040:
041:            // fixture
042:            public void theMethodToCall() {
043:                int a;
044:                a = 1;
045:            };
046:
047:            public static class TrapMethodAspect1 extends DefaultAspect {
048:                public static class TrapMethodCrossc1 extends MethodCut {
049:                    public void METHOD_ARGS() {
050:                    }
051:
052:                    protected PointCutter pointCutter() {
053:                        PointCutter x = Executions.before().AND(
054:                                Within.method("theMethodToCall"));
055:                        return x.AND(Within.type("AllLocationsMeasurement"));
056:                    }
057:                }
058:
059:                public Crosscut c1 = new TrapMethodCrossc1();
060:            }
061:
062:            public static class TrapMethodAspect2 extends DefaultAspect {
063:                public static class TrapMethodCrossc2 extends MethodCut {
064:
065:                    public void METHOD_ARGS() {
066:                    }
067:
068:                    protected PointCutter pointCutter() {
069:                        PointCutter x = Executions.before().AND(
070:                                Within.method("theMethodToCall"));
071:                        return x.AND(Within.type("AllLocationsMeasurement"));
072:                    }
073:
074:                    public void joinPointAction(
075:                            ch.ethz.jvmai.MethodEntryJoinPoint x) {
076:                    }
077:                }
078:
079:                public Crosscut c2 = new TrapMethodCrossc2();
080:            }
081:
082:            Aspect x1;
083:            Aspect x2;
084:            final boolean useProse;
085:
086:            /**
087:             * Construct test with given name.
088:             * @param name test name
089:             */
090:            public AllLocationsMeasurement(String name) {
091:                super (name);
092:
093:                String proseParam = System.getProperty("useprose");
094:                if (proseParam == null)
095:                    useProse = isDebuggerEnabled();
096:                else
097:                    useProse = proseParam.toUpperCase().equals("TRUE");
098:
099:                if (useProse)
100:                    RANGE = new int[] { 1000000 };
101:                else
102:                    RANGE = new int[] { 1000000 };
103:
104:            }
105:
106:            /**
107:             * Set up fixture.
108:             */
109:            protected void setUp() {
110:                if (!useProse)
111:                    return;
112:
113:                x1 = new TrapMethodAspect1();
114:                x2 = new TrapMethodAspect2();
115:                try {
116:                    ProseSystem.startup();
117:                } catch (Exception e) {
118:                    Assert.fail("ProseSystem.startup() failed");
119:                }
120:            }
121:
122:            protected void tearDown() {
123:                if (!useProse)
124:                    return;
125:
126:                try {
127:                    ProseSystem.teardown();
128:                } catch (Exception e) {
129:                    Assert.fail("ProseSystem.teardown() failed");
130:                }
131:            }
132:
133:            public void testLocalCallsNormal() {
134:                if (useProse)
135:                    ProseSystem.getAspectManager().insert(x1);
136:
137:                startChronometer();
138:                for (int i = 0; i < RUNS; i++)
139:                    this .theMethodToCall();
140:                stopChronometer();
141:
142:                if (useProse)
143:                    ProseSystem.getAspectManager().withdraw(x1);
144:            }
145:
146:            public void testLocalCallsFast() {
147:                if (useProse)
148:                    ProseSystem.getAspectManager().insert(x2);
149:
150:                startChronometer();
151:                for (int i = 0; i < RUNS; i++)
152:                    this .theMethodToCall();
153:                stopChronometer();
154:
155:                if (useProse)
156:                    ProseSystem.getAspectManager().withdraw(x2);
157:            }
158:
159:            /**
160:             * Test suite.
161:             * @return test instance
162:             */
163:            public static Test suite() {
164:                return new PerformanceTestSuite(AllLocationsMeasurement.class);
165:            }
166:
167:        }
168:
169:        //======================================================================
170:        //
171:        // $Log: AllLocationsMeasurement.java,v $
172:        // Revision 1.2  2004/05/12 17:26:52  anicoara
173:        // Adapt Junit tests to 3.8.1 version and the new package structure
174:        //
175:        // Revision 1.1.1.1  2003/07/02 15:30:45  apopovic
176:        // Imported from ETH Zurich
177:        //
178:        // Revision 1.18  2003/05/05 14:03:03  popovici
179:        // renaming from runes to prose
180:        //
181:        // Revision 1.17  2003/04/27 13:08:58  popovici
182:        // Specializers renamed to PointCutter
183:        //
184:        // Revision 1.16  2003/04/17 15:14:53  popovici
185:        // Extension->Aspect renaming
186:        //
187:        // Revision 1.15  2003/04/17 13:54:30  popovici
188:        // Refactorization of 'ExecutionS' into 'Within' and 'Executions'.
189:        // Method names refer now to 'types'
190:        //
191:        // Revision 1.14  2003/04/17 12:49:17  popovici
192:        // Refactoring of the crosscut package
193:        //  ExceptionCut renamed to ThrowCut
194:        //  McutSignature is now SignaturePattern
195:        //
196:        // Revision 1.13  2003/04/17 08:46:56  popovici
197:        // Important functionality additions
198:        //  - Cflow specializers
199:        //  - Restructuring of the MethodCut, SetCut, ThrowCut, and GetCut (they are much smaller)
200:        //  - Transactional capabilities
201:        //  - Total refactoring of Specializer evaluation, which permits fine-grained distinction
202:        //    between static and dynamic specializers.
203:        //  - Functionality pulled up in abstract classes
204:        //  - Uniformization of advice methods patterns and names
205:        //
206:        // Revision 1.12  2003/03/04 18:35:59  popovici
207:        // Organization of imprts
208:        //
209:        // Revision 1.11  2003/03/04 11:26:08  popovici
210:        // Important refactorization step (march):
211:        // - removal of 'JoinPointEvents'; JoinPoints now have the same function as events
212:        // - reimplementation of the JVMAIDebuggerAspectInterface (better performance, coding conventions, removal of ProseVM
213:        //   structures
214:        //
215:        // Revision 1.10  2002/11/26 17:15:49  pschoch
216:        // RootComponent now added (replaces RootComponent now added (replaces old ProseSystem)
217:        // ProseSystem now owns and starts the Aspect interface.
218:        // ProseSystem now containes  a 'test' AspectManager
219:        // AspectManager now owns the JoinPointManager.
220:        // ExtensionManger can be 'connected' to the JVM, or disconnected. The
221:        // JoinPointManager of a connected Ext.Mgr enables joinpoints; the
222:        // JoinPointManger of a disconnected Ext.Mgr never enables join-points
223:        // Documentation updated accordingly.
224:        //
225:        // Revision 1.9  2002/06/06 18:53:51  popovici
226:        // 1. Bug fix: methodAdvice is now public; the constructor works for all subclasses.
227:        // 2. Feature change/bug fix: ADVICE_NAME is now a protected method
228:        //
229:        // Revision 1.8  2002/06/06 14:39:50  popovici
230:        // Renamings: FunctionalCrosscut->MethodCut
231:        // AllFields->SetCut
232:        // SetCu.fieldModiticationAdvice -> SetCut.setAdvice
233:        //
234:        // Revision 1.7  2002/06/04 12:36:09  popovici
235:        // AllLocations occurences replaced with FunctionalCrosscut
236:        //
237:        // Revision 1.6  2002/05/22 11:00:33  popovici
238:        // ClasseS replaced with DeclarationS
239:        //
240:        // Revision 1.5  2002/03/12 09:50:13  popovici
241:        // Initial version of the Benchmark measurements
242:        //
243:        // Revision 1.4  2002/02/15 12:31:08  smarkwal
244:        // minor changes like spaces/tabs, setUp
245:        //
246:        // Revision 1.3  2002/02/05 13:39:04  smarkwal
247:        // spaces/tabs clean-up
248:        //
249:        // Revision 1.2  2002/02/05 11:22:30  smarkwal
250:        // modifications to test JVMAI-based implementation
251:        //
252:        // Revision 1.1.1.1  2001/11/29 18:13:34  popovici
253:        // Sources from runes
254:        //
255:        // Revision 1.1.2.3  2001/11/21 11:56:40  popovici
256:        //
257:        // -The sun.tools.agent and ch.ethz.inf.util.JVMDIUtil functionality
258:        // replaced with the iks.jvmdi package. References to this old
259:        // functionality replaced throughout the code.
260:        // -Partial reimplementation of the ch.ethz.inf.iks.runes classes,
261:        // part of their functionality moved to the ch.ethz.prose.reflect
262:        // abstract classes. New classes and functionality added to the
263:        // ch.ethz.prose.reflect package, partially to reflect the
264:        // more stable features taken from the iks.runes packages, partially
265:        // to reflect the structure of the VM (constant pool, etc). Functionality in
266:        // ch.ethz.prose.crosscut and the junit classes adapted to use the
267:        // new form of the ch.ethz.prose.reflect package
268:        //
269:        // Revision 1.1.2.2  2001/02/22 16:22:27  popovici
270:        // ProseSystem.setup replaced with startup; teardown introduced
271:        //
272:        // Revision 1.1.2.1  2001/01/22 07:26:37  popovici
273:        // Initial Revision
274:        //
275:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.