Source Code Cross Referenced for JVMAIMeasurement.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: JVMAIMeasurement.java,v 1.3 2004/05/12 17:26:53 anicoara Exp $
002:        // =====================================================================
003:        //
004:        // (history at end)
005:        //
006:
007:        package measurements.suites;
008:
009:        import java.lang.reflect.Field;
010:        import java.lang.reflect.Method;
011:
012:        import junit.framework.Assert;
013:        import junit.framework.Test;
014:        import ch.ethz.inf.iks.jvmai.jvmdi.FieldAccessJoinPointImpl;
015:        import ch.ethz.inf.util.junit.PerformanceTest;
016:        import ch.ethz.inf.util.junit.PerformanceTestSuite;
017:        import ch.ethz.jvmai.*;
018:
019:        /**
020:         * Performance testcase for measuring the dispatching speed of the debugger.
021:         * <p>
022:         * In this testcase,the column <code>RUNS</code> (the fifths)
023:         * represents the time needed to breakpoint a method RUNS times.
024:         * No additional functionality is called in the dispatch.
025:         *
026:         * @version	$Revision: 1.3 $
027:         * @author	Andrei Popovici
028:         */
029:        public class JVMAIMeasurement extends PerformanceTest {
030:
031:            // fixture
032:
033:            public void theMethodToCall() {
034:            }
035:
036:            public int theFieldToAccess = 0;
037:
038:            public static class TestHook extends JoinPointHook {
039:                public void onFieldAccess(FieldAccessJoinPoint joinPoint) {
040:                }
041:
042:                public void onFieldModification(
043:                        FieldModificationJoinPoint joinPoint) {
044:                }
045:
046:                public void onMethodEntry(MethodEntryJoinPoint joinPoint) {
047:                }
048:
049:                public void onMethodExit(MethodExitJoinPoint joinPoint) {
050:                }
051:
052:                public void onExceptionThrow(ExceptionJoinPoint joinPoint) {
053:                }
054:
055:                public void onExceptionCatch(ExceptionCatchJoinPoint joinPoint) {
056:                }
057:
058:                public void onClassLoad(Class cls) {
059:                }
060:
061:                public void onConstructor(ConstructorJoinPoint joinPoint) {
062:                }
063:            }
064:
065:            final boolean useProse;
066:
067:            /**
068:             * Construct test with given name.
069:             * @param name test name
070:             */
071:            public JVMAIMeasurement(String name) {
072:                super (name);
073:                String proseParam = System.getProperty("useprose");
074:                if (proseParam == null)
075:                    useProse = isDebuggerEnabled();
076:                else
077:                    useProse = proseParam.toUpperCase().equals("TRUE");
078:
079:                if (useProse) {
080:                    // we either do RVM or use the debugger
081:                    if (isDebuggerEnabled())
082:                        RANGE = new int[] { 10000 };
083:                    else
084:                        RANGE = new int[] { 1000000 };
085:                } else
086:                    RANGE = new int[] { 10000000 };
087:
088:            }
089:
090:            JVMAspectInterface aspectInterface;
091:
092:            Method method;
093:            Field field;
094:            Method interfaceMethod;
095:            TestHook hook;
096:
097:            protected void setUp() {
098:
099:                hook = new TestHook();
100:                // call every method at least once ...
101:                hook.onFieldAccess(null);
102:                hook.onFieldModification(null);
103:                hook.onMethodEntry(null);
104:                hook.onMethodExit(null);
105:                this .theMethodToCall();
106:                int n = this .theFieldToAccess;
107:                this .theFieldToAccess = 1;
108:
109:                if (!useProse)
110:                    return;
111:                try {
112:                    String providerName = System
113:                            .getProperty("ch.ethz.prose.JVMAIProvider");
114:                    Class providerClass = Class.forName(providerName);
115:                    Provider provider = (Provider) providerClass.newInstance();
116:
117:                    aspectInterface = provider.getAspectInterface();
118:
119:                    aspectInterface.startup(new String[] { "ch.ethz.prose." },
120:                            true);
121:
122:                    method = JVMAIMeasurement.class.getDeclaredMethod(
123:                            "theMethodToCall", new Class[] {});
124:                    interfaceMethod = TestClass1.class.getDeclaredMethod(
125:                            "interfaceMethodLong", new Class[] { Object.class,
126:                                    Object.class });
127:                    field = JVMAIMeasurement.class
128:                            .getDeclaredField("theFieldToAccess");
129:
130:                    // call every method at least once ...
131:                    aspectInterface.setJoinPointHook(hook);
132:                    aspectInterface.setMethodEntryWatch(method, new Object());
133:                    aspectInterface.setMethodExitWatch(method, new Object());
134:                    aspectInterface.setFieldAccessWatch(field, new Object());
135:                    aspectInterface.setFieldModificationWatch(field,
136:                            new Object());
137:                    aspectInterface.clearMethodEntryWatch(method);
138:                    aspectInterface.clearMethodExitWatch(method);
139:                    aspectInterface.clearFieldAccessWatch(field);
140:                    aspectInterface.clearFieldModificationWatch(field);
141:                    aspectInterface.setJoinPointHook(null);
142:                    aspectInterface.suspendNotification(Thread.currentThread());
143:                    aspectInterface.resumeNotification(Thread.currentThread());
144:
145:                } catch (Exception e) {
146:                    Assert
147:                            .fail("loading provider or initializing aspect-interface failed");
148:                }
149:            }
150:
151:            protected void tearDown() {
152:            }
153:
154:            public void testHook() {
155:                FieldAccessJoinPoint joinPoint = new FieldAccessJoinPointImpl(
156:                        null, null);
157:                JoinPointHook jpHook = hook;
158:                // call every method at least once ...
159:                jpHook.onFieldAccess(null);
160:                jpHook.onFieldModification(null);
161:                jpHook.onMethodEntry(null);
162:                jpHook.onMethodExit(null);
163:                startChronometer();
164:                for (int i = 0; i < RUNS; i++)
165:                    jpHook.onFieldAccess(joinPoint);
166:                stopChronometer();
167:            }
168:
169:            public void testEmptyFieldAccess() {
170:                int n = 0;
171:
172:                startChronometer();
173:                for (int i = 0; i < RUNS; i++)
174:                    n = 0;
175:                stopChronometer();
176:            }
177:
178:            public void testDoubleField() {
179:                startChronometer();
180:                for (int i = 0; i < RUNS; i++)
181:                    this .theFieldToAccess = this .theFieldToAccess;
182:                stopChronometer();
183:            }
184:
185:            //#####################################################################################################################
186:
187:            public void testMethod() {
188:                startChronometer();
189:                for (int i = 0; i < RUNS; i++)
190:                    this .theMethodToCall();
191:                stopChronometer();
192:            }
193:
194:            public void testMethod_Hook() {
195:                if (useProse) {
196:                    aspectInterface.setJoinPointHook(hook);
197:                }
198:
199:                startChronometer();
200:                for (int i = 0; i < RUNS; i++)
201:                    this .theMethodToCall();
202:                stopChronometer();
203:
204:                if (useProse) {
205:                    aspectInterface.setJoinPointHook(null);
206:                }
207:
208:            }
209:
210:            public void testMethod_Suspended() {
211:                if (useProse) {
212:                    aspectInterface.suspendNotification(Thread.currentThread());
213:                }
214:
215:                startChronometer();
216:                for (int i = 0; i < RUNS; i++)
217:                    this .theMethodToCall();
218:                stopChronometer();
219:
220:                if (useProse) {
221:                    aspectInterface.resumeNotification(Thread.currentThread());
222:                }
223:            }
224:
225:            public void testMethod_HookSuspended() {
226:                if (useProse) {
227:                    aspectInterface.suspendNotification(Thread.currentThread());
228:                    aspectInterface.setJoinPointHook(hook);
229:                }
230:
231:                startChronometer();
232:                for (int i = 0; i < RUNS; i++)
233:                    this .theMethodToCall();
234:                stopChronometer();
235:
236:                if (useProse) {
237:                    aspectInterface.resumeNotification(Thread.currentThread());
238:                    aspectInterface.setJoinPointHook(null);
239:                }
240:            }
241:
242:            //#####################################################################################################################
243:
244:            public void testMethodEntryWatch() {
245:                if (useProse) {
246:                    aspectInterface.setMethodEntryWatch(method, new Object());
247:                }
248:
249:                startChronometer();
250:                for (int i = 0; i < RUNS; i++)
251:                    this .theMethodToCall();
252:                stopChronometer();
253:
254:                if (useProse) {
255:                    aspectInterface.clearMethodEntryWatch(method);
256:                }
257:
258:            }
259:
260:            public void testMethodEntryWatch_Hook() {
261:                if (useProse) {
262:                    aspectInterface.setMethodEntryWatch(method, new Object());
263:                    aspectInterface.setJoinPointHook(hook);
264:                }
265:
266:                startChronometer();
267:                for (int i = 0; i < RUNS; i++)
268:                    this .theMethodToCall();
269:                stopChronometer();
270:
271:                if (useProse) {
272:                    aspectInterface.clearMethodEntryWatch(method);
273:                    aspectInterface.setJoinPointHook(null);
274:                }
275:            }
276:
277:            public void testMethodEntryWatch_Suspended() {
278:                if (useProse) {
279:                    aspectInterface.setMethodEntryWatch(method, new Object());
280:                    aspectInterface.suspendNotification(Thread.currentThread());
281:                }
282:
283:                startChronometer();
284:                for (int i = 0; i < RUNS; i++)
285:                    this .theMethodToCall();
286:                stopChronometer();
287:
288:                if (useProse) {
289:                    aspectInterface.clearMethodEntryWatch(method);
290:                    aspectInterface.resumeNotification(Thread.currentThread());
291:                }
292:            }
293:
294:            public void testMethodEntryWatch_HookSuspended() {
295:                if (useProse) {
296:                    aspectInterface.setMethodEntryWatch(method, new Object());
297:                    aspectInterface.suspendNotification(Thread.currentThread());
298:                    aspectInterface.setJoinPointHook(hook);
299:                }
300:
301:                startChronometer();
302:                for (int i = 0; i < RUNS; i++)
303:                    this .theMethodToCall();
304:                stopChronometer();
305:
306:                if (useProse) {
307:                    aspectInterface.clearMethodEntryWatch(method);
308:                    aspectInterface.resumeNotification(Thread.currentThread());
309:                    aspectInterface.setJoinPointHook(null);
310:                }
311:            }
312:
313:            //#####################################################################################################################
314:
315:            //#####################################################################################################################
316:
317:            public void testInterfaceMethod() {
318:                String x = "hello";
319:                TestInterface obj = new TestClass1();
320:                startChronometer();
321:                for (int i = 0; i < RUNS; i++)
322:                    obj.interfaceMethodLong(x, x);
323:                stopChronometer();
324:            }
325:
326:            public void testInterfaceEntryWatch() {
327:                String x = "hello";
328:                TestInterface obj = new TestClass1();
329:                if (useProse) {
330:                    aspectInterface.setMethodEntryWatch(interfaceMethod,
331:                            new Object());
332:                }
333:
334:                startChronometer();
335:                for (int i = 0; i < RUNS; i++)
336:                    obj.interfaceMethodLong(x, x);
337:                stopChronometer();
338:
339:                if (useProse) {
340:                    aspectInterface.clearMethodEntryWatch(interfaceMethod);
341:                }
342:
343:            }
344:
345:            public void testInterfaceEntryWatch_Hook() {
346:                String x = "hello";
347:                TestInterface obj = new TestClass1();
348:                if (useProse) {
349:                    aspectInterface.setMethodEntryWatch(interfaceMethod,
350:                            new Object());
351:                    aspectInterface.setJoinPointHook(hook);
352:                }
353:
354:                startChronometer();
355:                for (int i = 0; i < RUNS; i++)
356:                    obj.interfaceMethodLong(x, x);
357:                stopChronometer();
358:
359:                if (useProse) {
360:                    aspectInterface.clearMethodEntryWatch(interfaceMethod);
361:                    aspectInterface.setJoinPointHook(null);
362:                }
363:            }
364:
365:            public void testInterfaceEntryWatch_Suspended() {
366:                String x = "hello";
367:                TestInterface obj = new TestClass1();
368:                if (useProse) {
369:                    aspectInterface.setMethodEntryWatch(interfaceMethod,
370:                            new Object());
371:                    aspectInterface.suspendNotification(Thread.currentThread());
372:                }
373:
374:                startChronometer();
375:                for (int i = 0; i < RUNS; i++)
376:                    obj.interfaceMethodLong(x, x);
377:                stopChronometer();
378:
379:                if (useProse) {
380:                    aspectInterface.clearMethodEntryWatch(interfaceMethod);
381:                    aspectInterface.resumeNotification(Thread.currentThread());
382:                }
383:            }
384:
385:            public void testInterfaceEntryWatch_HookSuspended() {
386:                String x = "hello";
387:                TestInterface obj = new TestClass1();
388:                if (useProse) {
389:                    aspectInterface.setMethodEntryWatch(interfaceMethod,
390:                            new Object());
391:                    aspectInterface.suspendNotification(Thread.currentThread());
392:                    aspectInterface.setJoinPointHook(hook);
393:                }
394:
395:                startChronometer();
396:                for (int i = 0; i < RUNS; i++)
397:                    obj.interfaceMethodLong(x, x);
398:                stopChronometer();
399:
400:                if (useProse) {
401:                    aspectInterface.clearMethodEntryWatch(interfaceMethod);
402:                    aspectInterface.resumeNotification(Thread.currentThread());
403:                    aspectInterface.setJoinPointHook(null);
404:                }
405:            }
406:
407:            public void testInterfaceExitWatch() {
408:                String x = "hello";
409:                TestInterface obj = new TestClass1();
410:                if (useProse) {
411:                    aspectInterface.setMethodExitWatch(interfaceMethod,
412:                            new Object());
413:                }
414:
415:                startChronometer();
416:                for (int i = 0; i < RUNS; i++)
417:                    obj.interfaceMethodLong(x, x);
418:                stopChronometer();
419:
420:                if (useProse) {
421:                    aspectInterface.clearMethodExitWatch(interfaceMethod);
422:                }
423:
424:            }
425:
426:            public void testInterfaceExitWatch_Hook() {
427:                String x = "hello";
428:                TestInterface obj = new TestClass1();
429:                if (useProse) {
430:                    aspectInterface.setMethodExitWatch(interfaceMethod,
431:                            new Object());
432:                    aspectInterface.setJoinPointHook(hook);
433:                }
434:
435:                startChronometer();
436:                for (int i = 0; i < RUNS; i++)
437:                    obj.interfaceMethodLong(x, x);
438:                stopChronometer();
439:
440:                if (useProse) {
441:                    aspectInterface.clearMethodExitWatch(interfaceMethod);
442:                    aspectInterface.setJoinPointHook(null);
443:                }
444:            }
445:
446:            public void testInterfaceExitWatch_Suspended() {
447:                String x = "hello";
448:                TestInterface obj = new TestClass1();
449:                if (useProse) {
450:                    aspectInterface.setMethodExitWatch(interfaceMethod,
451:                            new Object());
452:                    aspectInterface.suspendNotification(Thread.currentThread());
453:                }
454:
455:                startChronometer();
456:                for (int i = 0; i < RUNS; i++)
457:                    obj.interfaceMethodLong(x, x);
458:                stopChronometer();
459:
460:                if (useProse) {
461:                    aspectInterface.clearMethodExitWatch(interfaceMethod);
462:                    aspectInterface.resumeNotification(Thread.currentThread());
463:                }
464:            }
465:
466:            public void testInterfaceExitWatch_HookSuspended() {
467:                String x = "hello";
468:                TestInterface obj = new TestClass1();
469:                if (useProse) {
470:                    aspectInterface.setMethodExitWatch(interfaceMethod,
471:                            new Object());
472:                    aspectInterface.suspendNotification(Thread.currentThread());
473:                    aspectInterface.setJoinPointHook(hook);
474:                }
475:
476:                startChronometer();
477:                for (int i = 0; i < RUNS; i++)
478:                    obj.interfaceMethodLong(x, x);
479:                stopChronometer();
480:
481:                if (useProse) {
482:                    aspectInterface.clearMethodExitWatch(interfaceMethod);
483:                    aspectInterface.resumeNotification(Thread.currentThread());
484:                    aspectInterface.setJoinPointHook(null);
485:                }
486:            }
487:
488:            //#####################################################################################################################
489:            public void testMethodExitWatch() {
490:                if (useProse) {
491:                    aspectInterface.setMethodExitWatch(method, new Object());
492:                }
493:
494:                startChronometer();
495:                for (int i = 0; i < RUNS; i++)
496:                    this .theMethodToCall();
497:                stopChronometer();
498:
499:                if (useProse) {
500:                    aspectInterface.clearMethodExitWatch(method);
501:                }
502:
503:            }
504:
505:            public void testMethodExitWatch_Hook() {
506:                if (useProse) {
507:                    aspectInterface.setMethodExitWatch(method, new Object());
508:                    aspectInterface.setJoinPointHook(hook);
509:                }
510:
511:                startChronometer();
512:                for (int i = 0; i < RUNS; i++)
513:                    this .theMethodToCall();
514:                stopChronometer();
515:
516:                if (useProse) {
517:                    aspectInterface.clearMethodExitWatch(method);
518:                    aspectInterface.setJoinPointHook(null);
519:                }
520:            }
521:
522:            public void testMethodExitWatch_Suspended() {
523:                if (useProse) {
524:                    aspectInterface.setMethodExitWatch(method, new Object());
525:                    aspectInterface.suspendNotification(Thread.currentThread());
526:                }
527:
528:                startChronometer();
529:                for (int i = 0; i < RUNS; i++)
530:                    this .theMethodToCall();
531:                stopChronometer();
532:
533:                if (useProse) {
534:                    aspectInterface.clearMethodExitWatch(method);
535:                    aspectInterface.resumeNotification(Thread.currentThread());
536:                }
537:            }
538:
539:            public void testMethodExitWatch_HookSuspended() {
540:                if (useProse) {
541:                    aspectInterface.setMethodExitWatch(method, new Object());
542:                    aspectInterface.suspendNotification(Thread.currentThread());
543:                    aspectInterface.setJoinPointHook(hook);
544:                }
545:
546:                startChronometer();
547:                for (int i = 0; i < RUNS; i++)
548:                    this .theMethodToCall();
549:                stopChronometer();
550:
551:                if (useProse) {
552:                    aspectInterface.clearMethodExitWatch(method);
553:                    aspectInterface.resumeNotification(Thread.currentThread());
554:                    aspectInterface.setJoinPointHook(null);
555:                }
556:            }
557:
558:            //#####################################################################################################################
559:
560:            public void testFieldAccess() {
561:                int n = 0;
562:
563:                startChronometer();
564:                for (int i = 0; i < RUNS; i++)
565:                    n = this .theFieldToAccess;
566:                stopChronometer();
567:            }
568:
569:            public void testFieldAccess_Hook() {
570:                if (useProse) {
571:                    aspectInterface.setJoinPointHook(hook);
572:                }
573:                int n = 0;
574:
575:                startChronometer();
576:                for (int i = 0; i < RUNS; i++)
577:                    n = this .theFieldToAccess;
578:                stopChronometer();
579:
580:                if (useProse) {
581:                    aspectInterface.setJoinPointHook(null);
582:                }
583:            }
584:
585:            public void testFieldAccess_Suspended() {
586:                if (useProse) {
587:                    aspectInterface.suspendNotification(Thread.currentThread());
588:                }
589:                int n = 0;
590:
591:                startChronometer();
592:                for (int i = 0; i < RUNS; i++)
593:                    n = this .theFieldToAccess;
594:                stopChronometer();
595:
596:                if (useProse) {
597:                    aspectInterface.resumeNotification(Thread.currentThread());
598:                }
599:            }
600:
601:            public void testFieldAccess_HookSuspended() {
602:                if (useProse) {
603:                    aspectInterface.suspendNotification(Thread.currentThread());
604:                    aspectInterface.setJoinPointHook(hook);
605:                }
606:                int n = 0;
607:
608:                startChronometer();
609:                for (int i = 0; i < RUNS; i++)
610:                    n = this .theFieldToAccess;
611:                stopChronometer();
612:
613:                if (useProse) {
614:                    aspectInterface.resumeNotification(Thread.currentThread());
615:                    aspectInterface.setJoinPointHook(null);
616:                }
617:            }
618:
619:            //#####################################################################################################################
620:
621:            public void testFieldModification() {
622:                startChronometer();
623:                for (int i = 0; i < RUNS; i++)
624:                    this .theFieldToAccess = 1;
625:                stopChronometer();
626:            }
627:
628:            public void testFieldModification_Hook() {
629:                if (useProse) {
630:                    aspectInterface.setJoinPointHook(hook);
631:                }
632:
633:                startChronometer();
634:                for (int i = 0; i < RUNS; i++)
635:                    this .theFieldToAccess = 1;
636:                stopChronometer();
637:
638:                if (useProse) {
639:                    aspectInterface.setJoinPointHook(null);
640:                }
641:            }
642:
643:            public void testFieldModification_Suspended() {
644:                if (useProse) {
645:                    aspectInterface.suspendNotification(Thread.currentThread());
646:                }
647:
648:                startChronometer();
649:                for (int i = 0; i < RUNS; i++)
650:                    this .theFieldToAccess = 1;
651:                stopChronometer();
652:
653:                if (useProse) {
654:                    aspectInterface.resumeNotification(Thread.currentThread());
655:                }
656:            }
657:
658:            public void testFieldModification_HookSuspended() {
659:                if (useProse) {
660:                    aspectInterface.suspendNotification(Thread.currentThread());
661:                    aspectInterface.setJoinPointHook(hook);
662:                }
663:
664:                startChronometer();
665:                for (int i = 0; i < RUNS; i++)
666:                    this .theFieldToAccess = 1;
667:                stopChronometer();
668:
669:                if (useProse) {
670:                    aspectInterface.resumeNotification(Thread.currentThread());
671:                    aspectInterface.setJoinPointHook(null);
672:                }
673:            }
674:
675:            //#####################################################################################################################
676:
677:            public void testFieldAccessWatch() {
678:                if (useProse) {
679:                    aspectInterface.setFieldAccessWatch(field, new Object());
680:                }
681:                int n = 0;
682:
683:                startChronometer();
684:                for (int i = 0; i < RUNS; i++)
685:                    n = this .theFieldToAccess;
686:                stopChronometer();
687:
688:                if (useProse) {
689:                    aspectInterface.clearFieldAccessWatch(field);
690:                }
691:            }
692:
693:            public void testFieldAccessWatch_Hook() {
694:                if (useProse) {
695:                    aspectInterface.setFieldAccessWatch(field, new Object());
696:                    aspectInterface.setJoinPointHook(hook);
697:                }
698:                int n = 0;
699:
700:                startChronometer();
701:                for (int i = 0; i < RUNS; i++)
702:                    n = this .theFieldToAccess;
703:                stopChronometer();
704:
705:                if (useProse) {
706:                    aspectInterface.clearFieldAccessWatch(field);
707:                    aspectInterface.setJoinPointHook(null);
708:                }
709:            }
710:
711:            public void testFieldAccessWatch_Suspended() {
712:                if (useProse) {
713:                    aspectInterface.setFieldAccessWatch(field, new Object());
714:                    aspectInterface.suspendNotification(Thread.currentThread());
715:                }
716:                int n = 0;
717:
718:                startChronometer();
719:                for (int i = 0; i < RUNS; i++)
720:                    n = this .theFieldToAccess;
721:                stopChronometer();
722:
723:                if (useProse) {
724:                    aspectInterface.clearFieldAccessWatch(field);
725:                    aspectInterface.resumeNotification(Thread.currentThread());
726:                }
727:            }
728:
729:            public void testFieldAccessWatch_HookSuspended() {
730:                if (useProse) {
731:                    aspectInterface.setFieldAccessWatch(field, new Object());
732:                    aspectInterface.suspendNotification(Thread.currentThread());
733:                    aspectInterface.setJoinPointHook(hook);
734:                }
735:                int n = 0;
736:
737:                startChronometer();
738:                for (int i = 0; i < RUNS; i++)
739:                    n = this .theFieldToAccess;
740:                stopChronometer();
741:
742:                if (useProse) {
743:                    aspectInterface.clearFieldAccessWatch(field);
744:                    aspectInterface.resumeNotification(Thread.currentThread());
745:                    aspectInterface.setJoinPointHook(null);
746:                }
747:            }
748:
749:            //#####################################################################################################################
750:
751:            public void testFieldModificationWatch() {
752:                if (useProse) {
753:                    aspectInterface.setFieldModificationWatch(field,
754:                            new Object());
755:                }
756:
757:                startChronometer();
758:                for (int i = 0; i < RUNS; i++)
759:                    this .theFieldToAccess = 1;
760:                stopChronometer();
761:
762:                if (useProse) {
763:                    aspectInterface.clearFieldModificationWatch(field);
764:                }
765:            }
766:
767:            public void testFieldModificationWatch_Hook() {
768:                if (useProse) {
769:                    aspectInterface.setFieldModificationWatch(field,
770:                            new Object());
771:                    aspectInterface.setJoinPointHook(hook);
772:                }
773:
774:                startChronometer();
775:                for (int i = 0; i < RUNS; i++)
776:                    this .theFieldToAccess = 1;
777:                stopChronometer();
778:
779:                if (useProse) {
780:                    aspectInterface.clearFieldModificationWatch(field);
781:                    aspectInterface.setJoinPointHook(null);
782:                }
783:            }
784:
785:            public void testFieldModificationWatch_Suspended() {
786:                if (useProse) {
787:                    aspectInterface.setFieldModificationWatch(field,
788:                            new Object());
789:                    aspectInterface.suspendNotification(Thread.currentThread());
790:                }
791:
792:                startChronometer();
793:                for (int i = 0; i < RUNS; i++)
794:                    this .theFieldToAccess = 1;
795:                stopChronometer();
796:
797:                if (useProse) {
798:                    aspectInterface.clearFieldModificationWatch(field);
799:                    aspectInterface.resumeNotification(Thread.currentThread());
800:                }
801:            }
802:
803:            public void test1FieldModificationWatch_HookSuspended() {
804:                if (useProse) {
805:                    aspectInterface.setFieldModificationWatch(field,
806:                            new Object());
807:                    aspectInterface.suspendNotification(Thread.currentThread());
808:                    aspectInterface.setJoinPointHook(hook);
809:                }
810:
811:                startChronometer();
812:                for (int i = 0; i < RUNS; i++)
813:                    this .theFieldToAccess = 1;
814:                stopChronometer();
815:
816:                if (useProse) {
817:                    aspectInterface.clearFieldModificationWatch(field);
818:                    aspectInterface.resumeNotification(Thread.currentThread());
819:                    aspectInterface.setJoinPointHook(null);
820:                }
821:            }
822:
823:            //#####################################################################################################################
824:
825:            /**
826:             * Test suite.
827:             * @return test instance
828:             */
829:            public static Test suite() {
830:                return new PerformanceTestSuite(JVMAIMeasurement.class);
831:            }
832:
833:        }
834:
835:        //======================================================================
836:        //
837:        // $Log: JVMAIMeasurement.java,v $
838:        // Revision 1.3  2004/05/12 17:26:53  anicoara
839:        // Adapt Junit tests to 3.8.1 version and the new package structure
840:        //
841:        // Revision 1.2  2004/05/12 09:41:53  anicoara
842:        // Remove the README.RVM file
843:        //
844:        // Revision 1.1.1.1  2003/07/02 15:30:46  apopovic
845:        // Imported from ETH Zurich
846:        //
847:        // Revision 1.13  2003/07/02 12:42:40  anicoara
848:        // Added CatchJoinPoint Functionality (Requests, Join-Points, Filters, CatchCuts, Tests)
849:        //
850:        // Revision 1.12  2003/05/05 14:03:02  popovici
851:        // renaming from runes to prose
852:        //
853:        // Revision 1.11  2003/03/04 18:36:00  popovici
854:        // Organization of imprts
855:        //
856:        // Revision 1.10  2003/03/04 11:26:12  popovici
857:        // Important refactorization step (march):
858:        // - removal of 'JoinPointEvents'; JoinPoints now have the same function as events
859:        // - reimplementation of the JVMAIDebuggerAspectInterface (better performance, coding conventions, removal of ProseVM
860:        //   structures
861:        //
862:        // Revision 1.9  2002/10/17 17:05:49  pschoch
863:        // Added throw capabability to JVMAI
864:        //
865:        // Revision 1.8  2002/05/06 09:08:11  popovici
866:        // all _test now real test cases; JVMAI measurement enhanced with interface testing
867:        //
868:        // Revision 1.7  2002/03/18 12:47:25  popovici
869:        // *** empty log message ***
870:        //
871:        // Revision 1.6  2002/03/11 11:02:53  smarkwal
872:        // JVMInfoInterface and JoinPointHook changed to abstract classes
873:        //
874:        // Revision 1.5  2002/02/28 17:37:12  smarkwal
875:        // precompilation of TestHook-methods ensured.
876:        //
877:        // Revision 1.4  2002/02/21 12:55:47  popovici
878:        // null aop tags replaced with Object aop tags to let tests run with both rvm & runes
879:        //
880:        // Revision 1.3  2002/02/15 12:29:31  smarkwal
881:        // doesn't rely anymore on Provider.getProvider(). test testEmtpy removed.
882:        //
883:        // Revision 1.2  2002/02/11 12:16:48  smarkwal
884:        // many more tests added
885:        //
886:        // Revision 1.1  2002/02/05 11:24:12  smarkwal
887:        // JVMDIMeasurement renamed to JVMAIMeasurement, JVMDI-based code replaced by JVMAI
888:        //
889:        // Revision 1.1.1.1  2001/11/29 18:13:34  popovici
890:        // Sources from runes
891:        //
892:        // Revision 1.1.2.3  2001/11/21 11:56:42  popovici
893:        //
894:        // -The sun.tools.agent and ch.ethz.inf.util.JVMDIUtil functionality
895:        // replaced with the iks.jvmdi package. References to this old
896:        // functionality replaced throughout the code.
897:        // -Partial reimplementation of the ch.ethz.inf.iks.runes classes,
898:        // part of their functionality moved to the ch.ethz.prose.reflect
899:        // abstract classes. New classes and functionality added to the
900:        // ch.ethz.prose.reflect package, partially to reflect the
901:        // more stable features taken from the iks.runes packages, partially
902:        // to reflect the structure of the VM (constant pool, etc). Functionality in
903:        // ch.ethz.prose.crosscut and the junit classes adapted to use the
904:        // new form of the ch.ethz.prose.reflect package
905:        //
906:        // Revision 1.1.2.2  2001/02/22 16:23:32  popovici
907:        // ProseSystem.setup replaced with startup; teardown introduced
908:        //
909:        // Revision 1.1.2.1  2001/01/22 07:28:20  popovici
910:        // Initial Revision
911:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.