KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > measurements > suites > JVMAIMeasurement


1 // $Id: JVMAIMeasurement.java,v 1.3 2004/05/12 17:26:53 anicoara Exp $
2
// =====================================================================
3
//
4
// (history at end)
5
//
6

7 package measurements.suites;
8
9 import java.lang.reflect.Field JavaDoc;
10 import java.lang.reflect.Method JavaDoc;
11
12 import junit.framework.Assert;
13 import junit.framework.Test;
14 import ch.ethz.inf.iks.jvmai.jvmdi.FieldAccessJoinPointImpl;
15 import ch.ethz.inf.util.junit.PerformanceTest;
16 import ch.ethz.inf.util.junit.PerformanceTestSuite;
17 import ch.ethz.jvmai.*;
18
19 /**
20  * Performance testcase for measuring the dispatching speed of the debugger.
21  * <p>
22  * In this testcase,the column <code>RUNS</code> (the fifths)
23  * represents the time needed to breakpoint a method RUNS times.
24  * No additional functionality is called in the dispatch.
25  *
26  * @version $Revision: 1.3 $
27  * @author Andrei Popovici
28  */

29 public class JVMAIMeasurement extends PerformanceTest {
30
31   // fixture
32

33
34   public void theMethodToCall() { }
35   public int theFieldToAccess = 0;
36
37   public static class TestHook extends JoinPointHook
38   {
39     public void onFieldAccess (FieldAccessJoinPoint joinPoint) { }
40     public void onFieldModification(FieldModificationJoinPoint joinPoint) { }
41     public void onMethodEntry (MethodEntryJoinPoint joinPoint) { }
42     public void onMethodExit (MethodExitJoinPoint joinPoint) { }
43     public void onExceptionThrow (ExceptionJoinPoint joinPoint) { }
44     public void onExceptionCatch (ExceptionCatchJoinPoint joinPoint) { }
45     public void onClassLoad (Class JavaDoc cls) { }
46   }
47
48   final boolean useProse;
49
50   /**
51    * Construct test with given name.
52    * @param name test name
53    */

54   public JVMAIMeasurement(String JavaDoc name)
55     {
56       super(name);
57       String JavaDoc proseParam = System.getProperty("useprose");
58       if(proseParam==null)
59     useProse = isDebuggerEnabled();
60       else
61     useProse = proseParam.toUpperCase().equals("TRUE");
62
63       if(useProse)
64     {
65       // we either do RVM or use the debugger
66
if (isDebuggerEnabled())
67         RANGE = new int[]{ 10000};
68       else
69         RANGE = new int[]{ 1000000};
70     }
71       else
72     RANGE = new int[]{ 10000000 };
73
74     }
75
76   JVMAspectInterface aspectInterface;
77
78     Method JavaDoc method;
79     Field JavaDoc field;
80     Method JavaDoc interfaceMethod;
81     TestHook hook;
82
83   protected void setUp()
84     {
85
86       hook = new TestHook();
87       // call every method at least once ...
88
hook.onFieldAccess(null);
89       hook.onFieldModification(null);
90       hook.onMethodEntry(null);
91       hook.onMethodExit(null);
92       this.theMethodToCall();
93       int n = this.theFieldToAccess;
94       this.theFieldToAccess = 1;
95
96       if (!useProse) return;
97       try
98     {
99       String JavaDoc providerName = System.getProperty("ch.ethz.prose.JVMAIProvider");
100       Class JavaDoc providerClass = Class.forName(providerName);
101       Provider provider = (Provider)providerClass.newInstance();
102
103       aspectInterface = provider.getAspectInterface();
104
105       aspectInterface.startup(new String JavaDoc[]{"ch.ethz.prose."},true);
106
107       method = JVMAIMeasurement.class.getDeclaredMethod("theMethodToCall",new Class JavaDoc[]{});
108       interfaceMethod = TestClass1.class.getDeclaredMethod("interfaceMethodLong",
109                                    new Class JavaDoc[]{Object JavaDoc.class,
110                                        Object JavaDoc.class});
111       field = JVMAIMeasurement.class.getDeclaredField("theFieldToAccess");
112
113       // call every method at least once ...
114
aspectInterface.setJoinPointHook(hook);
115       aspectInterface.setMethodEntryWatch(method,new Object JavaDoc());
116       aspectInterface.setMethodExitWatch(method,new Object JavaDoc());
117       aspectInterface.setFieldAccessWatch(field,new Object JavaDoc());
118       aspectInterface.setFieldModificationWatch(field,new Object JavaDoc());
119       aspectInterface.clearMethodEntryWatch(method);
120       aspectInterface.clearMethodExitWatch(method);
121       aspectInterface.clearFieldAccessWatch(field);
122       aspectInterface.clearFieldModificationWatch(field);
123       aspectInterface.setJoinPointHook(null);
124       aspectInterface.suspendNotification(Thread.currentThread());
125       aspectInterface.resumeNotification(Thread.currentThread());
126
127     }
128       catch (Exception JavaDoc e)
129     {
130       Assert.fail("loading provider or initializing aspect-interface failed");
131     }
132     }
133
134   protected void tearDown()
135     {
136     }
137
138   public void testHook()
139     {
140       FieldAccessJoinPoint joinPoint = new FieldAccessJoinPointImpl(null,null);
141       JoinPointHook jpHook = hook;
142       // call every method at least once ...
143
jpHook.onFieldAccess(null);
144       jpHook.onFieldModification(null);
145       jpHook.onMethodEntry(null);
146       jpHook.onMethodExit(null);
147       startChronometer();
148       for(int i =0; i<RUNS; i++)
149     jpHook.onFieldAccess(joinPoint);
150       stopChronometer();
151     }
152
153   public void testEmptyFieldAccess()
154     {
155       int n = 0;
156
157       startChronometer();
158       for(int i =0; i<RUNS; i++)
159     n = 0;
160       stopChronometer();
161     }
162
163   public void testDoubleField()
164     {
165       startChronometer();
166       for(int i =0; i<RUNS; i++)
167     this.theFieldToAccess = this.theFieldToAccess;
168       stopChronometer();
169     }
170
171   //#####################################################################################################################
172

173   public void testMethod()
174     {
175       startChronometer();
176       for(int i =0; i<RUNS; i++)
177     this.theMethodToCall();
178       stopChronometer();
179     }
180
181   public void testMethod_Hook()
182     {
183       if(useProse)
184     {
185       aspectInterface.setJoinPointHook(hook);
186     }
187
188       startChronometer();
189       for(int i =0; i<RUNS; i++)
190     this.theMethodToCall();
191       stopChronometer();
192
193       if(useProse)
194     {
195       aspectInterface.setJoinPointHook(null);
196     }
197
198     }
199
200   public void testMethod_Suspended()
201     {
202       if(useProse)
203     {
204       aspectInterface.suspendNotification(Thread.currentThread());
205     }
206
207       startChronometer();
208       for(int i =0; i<RUNS; i++)
209     this.theMethodToCall();
210       stopChronometer();
211
212       if(useProse)
213     {
214       aspectInterface.resumeNotification(Thread.currentThread());
215     }
216     }
217
218   public void testMethod_HookSuspended()
219     {
220       if(useProse)
221     {
222       aspectInterface.suspendNotification(Thread.currentThread());
223       aspectInterface.setJoinPointHook(hook);
224     }
225
226       startChronometer();
227       for(int i =0; i<RUNS; i++)
228     this.theMethodToCall();
229       stopChronometer();
230
231       if(useProse)
232     {
233       aspectInterface.resumeNotification(Thread.currentThread());
234       aspectInterface.setJoinPointHook(null);
235     }
236     }
237
238   //#####################################################################################################################
239

240   public void testMethodEntryWatch()
241     {
242       if(useProse)
243     {
244       aspectInterface.setMethodEntryWatch(method,new Object JavaDoc());
245     }
246
247       startChronometer();
248       for(int i =0; i<RUNS; i++)
249     this.theMethodToCall();
250       stopChronometer();
251
252       if(useProse)
253     {
254       aspectInterface.clearMethodEntryWatch(method);
255     }
256
257     }
258
259   public void testMethodEntryWatch_Hook()
260     {
261       if(useProse)
262     {
263       aspectInterface.setMethodEntryWatch(method,new Object JavaDoc());
264       aspectInterface.setJoinPointHook(hook);
265     }
266
267       startChronometer();
268       for(int i =0; i<RUNS; i++)
269     this.theMethodToCall();
270       stopChronometer();
271
272       if(useProse)
273     {
274       aspectInterface.clearMethodEntryWatch(method);
275       aspectInterface.setJoinPointHook(null);
276     }
277     }
278
279   public void testMethodEntryWatch_Suspended()
280     {
281       if(useProse)
282     {
283       aspectInterface.setMethodEntryWatch(method,new Object JavaDoc());
284       aspectInterface.suspendNotification(Thread.currentThread());
285     }
286
287       startChronometer();
288       for(int i =0; i<RUNS; i++)
289     this.theMethodToCall();
290       stopChronometer();
291
292       if(useProse)
293     {
294       aspectInterface.clearMethodEntryWatch(method);
295       aspectInterface.resumeNotification(Thread.currentThread());
296     }
297     }
298
299   public void testMethodEntryWatch_HookSuspended()
300     {
301       if(useProse)
302     {
303       aspectInterface.setMethodEntryWatch(method,new Object JavaDoc());
304       aspectInterface.suspendNotification(Thread.currentThread());
305       aspectInterface.setJoinPointHook(hook);
306     }
307
308       startChronometer();
309       for(int i =0; i<RUNS; i++)
310     this.theMethodToCall();
311       stopChronometer();
312
313       if(useProse)
314     {
315       aspectInterface.clearMethodEntryWatch(method);
316       aspectInterface.resumeNotification(Thread.currentThread());
317       aspectInterface.setJoinPointHook(null);
318     }
319     }
320
321   //#####################################################################################################################
322

323   //#####################################################################################################################
324

325   public void testInterfaceMethod()
326     {
327             String JavaDoc x = "hello";
328       TestInterface obj = new TestClass1();
329       startChronometer();
330       for(int i =0; i<RUNS; i++)
331     obj.interfaceMethodLong(x,x);
332       stopChronometer();
333     }
334
335   public void testInterfaceEntryWatch()
336     {
337             String JavaDoc x = "hello";
338       TestInterface obj = new TestClass1();
339       if(useProse)
340     {
341       aspectInterface.setMethodEntryWatch(interfaceMethod,new Object JavaDoc());
342     }
343
344       startChronometer();
345       for(int i =0; i<RUNS; i++)
346     obj.interfaceMethodLong(x,x);
347       stopChronometer();
348
349       if(useProse)
350     {
351       aspectInterface.clearMethodEntryWatch(interfaceMethod);
352     }
353
354     }
355
356   public void testInterfaceEntryWatch_Hook()
357     {
358             String JavaDoc x = "hello";
359       TestInterface obj = new TestClass1();
360       if(useProse)
361     {
362       aspectInterface.setMethodEntryWatch(interfaceMethod,new Object JavaDoc());
363       aspectInterface.setJoinPointHook(hook);
364     }
365
366       startChronometer();
367       for(int i =0; i<RUNS; i++)
368     obj.interfaceMethodLong(x,x);
369       stopChronometer();
370
371       if(useProse)
372     {
373       aspectInterface.clearMethodEntryWatch(interfaceMethod);
374       aspectInterface.setJoinPointHook(null);
375     }
376     }
377
378   public void testInterfaceEntryWatch_Suspended()
379     {
380     String JavaDoc x = "hello";
381     TestInterface obj = new TestClass1();
382     if(useProse)
383         {
384         aspectInterface.setMethodEntryWatch(interfaceMethod,new Object JavaDoc());
385         aspectInterface.suspendNotification(Thread.currentThread());
386         }
387
388     startChronometer();
389     for(int i =0; i<RUNS; i++)
390         obj.interfaceMethodLong(x,x);
391     stopChronometer();
392
393     if(useProse)
394         {
395         aspectInterface.clearMethodEntryWatch(interfaceMethod);
396         aspectInterface.resumeNotification(Thread.currentThread());
397         }
398     }
399
400   public void testInterfaceEntryWatch_HookSuspended()
401     {
402             String JavaDoc x = "hello";
403       TestInterface obj = new TestClass1();
404       if(useProse)
405     {
406       aspectInterface.setMethodEntryWatch(interfaceMethod,new Object JavaDoc());
407       aspectInterface.suspendNotification(Thread.currentThread());
408       aspectInterface.setJoinPointHook(hook);
409     }
410
411       startChronometer();
412       for(int i =0; i<RUNS; i++)
413     obj.interfaceMethodLong(x,x);
414       stopChronometer();
415
416       if(useProse)
417     {
418       aspectInterface.clearMethodEntryWatch(interfaceMethod);
419       aspectInterface.resumeNotification(Thread.currentThread());
420       aspectInterface.setJoinPointHook(null);
421     }
422     }
423
424   public void testInterfaceExitWatch()
425     {
426             String JavaDoc x = "hello";
427       TestInterface obj = new TestClass1();
428       if(useProse)
429     {
430       aspectInterface.setMethodExitWatch(interfaceMethod,new Object JavaDoc());
431     }
432
433       startChronometer();
434       for(int i =0; i<RUNS; i++)
435     obj.interfaceMethodLong(x,x);
436       stopChronometer();
437
438       if(useProse)
439     {
440       aspectInterface.clearMethodExitWatch(interfaceMethod);
441     }
442
443     }
444
445   public void testInterfaceExitWatch_Hook()
446     {
447             String JavaDoc x = "hello";
448       TestInterface obj = new TestClass1();
449       if(useProse)
450     {
451       aspectInterface.setMethodExitWatch(interfaceMethod,new Object JavaDoc());
452       aspectInterface.setJoinPointHook(hook);
453     }
454
455       startChronometer();
456       for(int i =0; i<RUNS; i++)
457     obj.interfaceMethodLong(x,x);
458       stopChronometer();
459
460       if(useProse)
461     {
462       aspectInterface.clearMethodExitWatch(interfaceMethod);
463       aspectInterface.setJoinPointHook(null);
464     }
465     }
466
467   public void testInterfaceExitWatch_Suspended()
468     {
469             String JavaDoc x = "hello";
470       TestInterface obj = new TestClass1();
471       if(useProse)
472     {
473       aspectInterface.setMethodExitWatch(interfaceMethod,new Object JavaDoc());
474       aspectInterface.suspendNotification(Thread.currentThread());
475     }
476
477       startChronometer();
478       for(int i =0; i<RUNS; i++)
479     obj.interfaceMethodLong(x,x);
480       stopChronometer();
481
482       if(useProse)
483     {
484       aspectInterface.clearMethodExitWatch(interfaceMethod);
485       aspectInterface.resumeNotification(Thread.currentThread());
486     }
487     }
488
489   public void testInterfaceExitWatch_HookSuspended()
490     {
491       String JavaDoc x = "hello";
492       TestInterface obj = new TestClass1();
493       if(useProse)
494     {
495       aspectInterface.setMethodExitWatch(interfaceMethod,new Object JavaDoc());
496       aspectInterface.suspendNotification(Thread.currentThread());
497       aspectInterface.setJoinPointHook(hook);
498     }
499
500       startChronometer();
501       for(int i =0; i<RUNS; i++)
502     obj.interfaceMethodLong(x,x);
503       stopChronometer();
504
505       if(useProse)
506     {
507       aspectInterface.clearMethodExitWatch(interfaceMethod);
508       aspectInterface.resumeNotification(Thread.currentThread());
509       aspectInterface.setJoinPointHook(null);
510     }
511     }
512
513   //#####################################################################################################################
514
public void testMethodExitWatch()
515     {
516       if(useProse)
517     {
518       aspectInterface.setMethodExitWatch(method,new Object JavaDoc());
519     }
520
521       startChronometer();
522       for(int i =0; i<RUNS; i++)
523     this.theMethodToCall();
524       stopChronometer();
525
526       if(useProse)
527     {
528       aspectInterface.clearMethodExitWatch(method);
529     }
530
531     }
532
533   public void testMethodExitWatch_Hook()
534     {
535       if(useProse)
536     {
537       aspectInterface.setMethodExitWatch(method,new Object JavaDoc());
538       aspectInterface.setJoinPointHook(hook);
539     }
540
541       startChronometer();
542       for(int i =0; i<RUNS; i++)
543     this.theMethodToCall();
544       stopChronometer();
545
546       if(useProse)
547     {
548       aspectInterface.clearMethodExitWatch(method);
549       aspectInterface.setJoinPointHook(null);
550     }
551     }
552
553   public void testMethodExitWatch_Suspended()
554     {
555       if(useProse)
556     {
557       aspectInterface.setMethodExitWatch(method,new Object JavaDoc());
558       aspectInterface.suspendNotification(Thread.currentThread());
559     }
560
561       startChronometer();
562       for(int i =0; i<RUNS; i++)
563     this.theMethodToCall();
564       stopChronometer();
565
566       if(useProse)
567     {
568       aspectInterface.clearMethodExitWatch(method);
569       aspectInterface.resumeNotification(Thread.currentThread());
570     }
571     }
572
573   public void testMethodExitWatch_HookSuspended()
574     {
575       if(useProse)
576     {
577       aspectInterface.setMethodExitWatch(method,new Object JavaDoc());
578       aspectInterface.suspendNotification(Thread.currentThread());
579       aspectInterface.setJoinPointHook(hook);
580     }
581
582       startChronometer();
583       for(int i =0; i<RUNS; i++)
584     this.theMethodToCall();
585       stopChronometer();
586
587       if(useProse)
588     {
589       aspectInterface.clearMethodExitWatch(method);
590       aspectInterface.resumeNotification(Thread.currentThread());
591       aspectInterface.setJoinPointHook(null);
592     }
593     }
594   //#####################################################################################################################
595

596   public void testFieldAccess()
597     {
598       int n = 0;
599
600       startChronometer();
601       for(int i =0; i<RUNS; i++)
602     n = this.theFieldToAccess;
603       stopChronometer();
604     }
605
606   public void testFieldAccess_Hook()
607     {
608       if(useProse)
609     {
610       aspectInterface.setJoinPointHook(hook);
611     }
612       int n = 0;
613
614       startChronometer();
615       for(int i =0; i<RUNS; i++)
616     n = this.theFieldToAccess;
617       stopChronometer();
618
619       if(useProse)
620     {
621       aspectInterface.setJoinPointHook(null);
622     }
623     }
624
625   public void testFieldAccess_Suspended()
626     {
627       if(useProse)
628     {
629       aspectInterface.suspendNotification(Thread.currentThread());
630     }
631       int n = 0;
632
633       startChronometer();
634       for(int i =0; i<RUNS; i++)
635     n = this.theFieldToAccess;
636       stopChronometer();
637
638       if(useProse)
639     {
640       aspectInterface.resumeNotification(Thread.currentThread());
641     }
642     }
643
644   public void testFieldAccess_HookSuspended()
645     {
646       if(useProse)
647     {
648       aspectInterface.suspendNotification(Thread.currentThread());
649       aspectInterface.setJoinPointHook(hook);
650     }
651       int n = 0;
652
653       startChronometer();
654       for(int i =0; i<RUNS; i++)
655     n = this.theFieldToAccess;
656       stopChronometer();
657
658       if(useProse)
659     {
660       aspectInterface.resumeNotification(Thread.currentThread());
661       aspectInterface.setJoinPointHook(null);
662     }
663     }
664
665   //#####################################################################################################################
666

667   public void testFieldModification()
668     {
669       startChronometer();
670       for(int i =0; i<RUNS; i++)
671     this.theFieldToAccess = 1;
672       stopChronometer();
673     }
674
675   public void testFieldModification_Hook()
676     {
677       if(useProse)
678     {
679       aspectInterface.setJoinPointHook(hook);
680     }
681
682       startChronometer();
683       for(int i =0; i<RUNS; i++)
684     this.theFieldToAccess = 1;
685       stopChronometer();
686
687       if(useProse)
688     {
689       aspectInterface.setJoinPointHook(null);
690     }
691     }
692
693   public void testFieldModification_Suspended()
694     {
695       if(useProse)
696     {
697       aspectInterface.suspendNotification(Thread.currentThread());
698     }
699
700       startChronometer();
701       for(int i =0; i<RUNS; i++)
702     this.theFieldToAccess = 1;
703       stopChronometer();
704
705       if(useProse)
706     {
707       aspectInterface.resumeNotification(Thread.currentThread());
708     }
709     }
710
711   public void testFieldModification_HookSuspended()
712     {
713       if(useProse)
714     {
715       aspectInterface.suspendNotification(Thread.currentThread());
716       aspectInterface.setJoinPointHook(hook);
717     }
718
719       startChronometer();
720       for(int i =0; i<RUNS; i++)
721     this.theFieldToAccess = 1;
722       stopChronometer();
723
724       if(useProse)
725     {
726       aspectInterface.resumeNotification(Thread.currentThread());
727       aspectInterface.setJoinPointHook(null);
728     }
729     }
730
731   //#####################################################################################################################
732

733   public void testFieldAccessWatch()
734     {
735       if(useProse)
736     {
737       aspectInterface.setFieldAccessWatch(field,new Object JavaDoc());
738     }
739       int n = 0;
740
741       startChronometer();
742       for(int i =0; i<RUNS; i++)
743     n = this.theFieldToAccess;
744       stopChronometer();
745
746       if(useProse)
747     {
748       aspectInterface.clearFieldAccessWatch(field);
749     }
750     }
751
752   public void testFieldAccessWatch_Hook()
753     {
754       if(useProse)
755     {
756       aspectInterface.setFieldAccessWatch(field,new Object JavaDoc());
757       aspectInterface.setJoinPointHook(hook);
758     }
759       int n = 0;
760
761       startChronometer();
762       for(int i =0; i<RUNS; i++)
763     n = this.theFieldToAccess;
764       stopChronometer();
765
766       if(useProse)
767     {
768       aspectInterface.clearFieldAccessWatch(field);
769       aspectInterface.setJoinPointHook(null);
770     }
771     }
772
773   public void testFieldAccessWatch_Suspended()
774     {
775       if(useProse)
776     {
777       aspectInterface.setFieldAccessWatch(field,new Object JavaDoc());
778       aspectInterface.suspendNotification(Thread.currentThread());
779     }
780       int n = 0;
781
782       startChronometer();
783       for(int i =0; i<RUNS; i++)
784     n = this.theFieldToAccess;
785       stopChronometer();
786
787       if(useProse)
788     {
789       aspectInterface.clearFieldAccessWatch(field);
790       aspectInterface.resumeNotification(Thread.currentThread());
791     }
792     }
793
794   public void testFieldAccessWatch_HookSuspended()
795     {
796       if(useProse)
797     {
798       aspectInterface.setFieldAccessWatch(field,new Object JavaDoc());
799       aspectInterface.suspendNotification(Thread.currentThread());
800       aspectInterface.setJoinPointHook(hook);
801     }
802       int n = 0;
803
804       startChronometer();
805       for(int i =0; i<RUNS; i++)
806     n = this.theFieldToAccess;
807       stopChronometer();
808
809       if(useProse)
810     {
811       aspectInterface.clearFieldAccessWatch(field);
812       aspectInterface.resumeNotification(Thread.currentThread());
813       aspectInterface.setJoinPointHook(null);
814     }
815     }
816
817   //#####################################################################################################################
818

819   public void testFieldModificationWatch()
820     {
821       if(useProse)
822     {
823       aspectInterface.setFieldModificationWatch(field,new Object JavaDoc());
824     }
825
826       startChronometer();
827       for(int i =0; i<RUNS; i++)
828     this.theFieldToAccess = 1;
829       stopChronometer();
830
831       if(useProse)
832     {
833       aspectInterface.clearFieldModificationWatch(field);
834     }
835     }
836
837   public void testFieldModificationWatch_Hook()
838     {
839       if(useProse)
840     {
841       aspectInterface.setFieldModificationWatch(field,new Object JavaDoc());
842       aspectInterface.setJoinPointHook(hook);
843     }
844
845       startChronometer();
846       for(int i =0; i<RUNS; i++)
847     this.theFieldToAccess = 1;
848       stopChronometer();
849
850       if(useProse)
851     {
852       aspectInterface.clearFieldModificationWatch(field);
853       aspectInterface.setJoinPointHook(null);
854     }
855     }
856
857   public void testFieldModificationWatch_Suspended()
858     {
859       if(useProse)
860     {
861       aspectInterface.setFieldModificationWatch(field,new Object JavaDoc());
862       aspectInterface.suspendNotification(Thread.currentThread());
863     }
864
865       startChronometer();
866       for(int i =0; i<RUNS; i++)
867     this.theFieldToAccess = 1;
868       stopChronometer();
869
870       if(useProse)
871     {
872       aspectInterface.clearFieldModificationWatch(field);
873       aspectInterface.resumeNotification(Thread.currentThread());
874     }
875     }
876
877   public void test1FieldModificationWatch_HookSuspended()
878     {
879       if(useProse)
880     {
881       aspectInterface.setFieldModificationWatch(field,new Object JavaDoc());
882       aspectInterface.suspendNotification(Thread.currentThread());
883       aspectInterface.setJoinPointHook(hook);
884     }
885
886       startChronometer();
887       for(int i =0; i<RUNS; i++)
888     this.theFieldToAccess = 1;
889       stopChronometer();
890
891       if(useProse)
892     {
893       aspectInterface.clearFieldModificationWatch(field);
894       aspectInterface.resumeNotification(Thread.currentThread());
895       aspectInterface.setJoinPointHook(null);
896     }
897     }
898
899   //#####################################################################################################################
900

901   /**
902    * Test suite.
903    * @return test instance
904    */

905   public static Test suite()
906     {
907       return new PerformanceTestSuite(JVMAIMeasurement.class);
908     }
909
910 }
911
912
913 //======================================================================
914
//
915
// $Log: JVMAIMeasurement.java,v $
916
// Revision 1.3 2004/05/12 17:26:53 anicoara
917
// Adapt Junit tests to 3.8.1 version and the new package structure
918
//
919
// Revision 1.2 2004/05/12 09:41:53 anicoara
920
// Remove the README.RVM file
921
//
922
// Revision 1.1.1.1 2003/07/02 15:30:46 apopovic
923
// Imported from ETH Zurich
924
//
925
// Revision 1.13 2003/07/02 12:42:40 anicoara
926
// Added CatchJoinPoint Functionality (Requests, Join-Points, Filters, CatchCuts, Tests)
927
//
928
// Revision 1.12 2003/05/05 14:03:02 popovici
929
// renaming from runes to prose
930
//
931
// Revision 1.11 2003/03/04 18:36:00 popovici
932
// Organization of imprts
933
//
934
// Revision 1.10 2003/03/04 11:26:12 popovici
935
// Important refactorization step (march):
936
// - removal of 'JoinPointEvents'; JoinPoints now have the same function as events
937
// - reimplementation of the JVMAIDebuggerAspectInterface (better performance, coding conventions, removal of ProseVM
938
// structures
939
//
940
// Revision 1.9 2002/10/17 17:05:49 pschoch
941
// Added throw capabability to JVMAI
942
//
943
// Revision 1.8 2002/05/06 09:08:11 popovici
944
// all _test now real test cases; JVMAI measurement enhanced with interface testing
945
//
946
// Revision 1.7 2002/03/18 12:47:25 popovici
947
// *** empty log message ***
948
//
949
// Revision 1.6 2002/03/11 11:02:53 smarkwal
950
// JVMInfoInterface and JoinPointHook changed to abstract classes
951
//
952
// Revision 1.5 2002/02/28 17:37:12 smarkwal
953
// precompilation of TestHook-methods ensured.
954
//
955
// Revision 1.4 2002/02/21 12:55:47 popovici
956
// null aop tags replaced with Object aop tags to let tests run with both rvm & runes
957
//
958
// Revision 1.3 2002/02/15 12:29:31 smarkwal
959
// doesn't rely anymore on Provider.getProvider(). test testEmtpy removed.
960
//
961
// Revision 1.2 2002/02/11 12:16:48 smarkwal
962
// many more tests added
963
//
964
// Revision 1.1 2002/02/05 11:24:12 smarkwal
965
// JVMDIMeasurement renamed to JVMAIMeasurement, JVMDI-based code replaced by JVMAI
966
//
967
// Revision 1.1.1.1 2001/11/29 18:13:34 popovici
968
// Sources from runes
969
//
970
// Revision 1.1.2.3 2001/11/21 11:56:42 popovici
971
//
972
// -The sun.tools.agent and ch.ethz.inf.util.JVMDIUtil functionality
973
// replaced with the iks.jvmdi package. References to this old
974
// functionality replaced throughout the code.
975
// -Partial reimplementation of the ch.ethz.inf.iks.runes classes,
976
// part of their functionality moved to the ch.ethz.prose.reflect
977
// abstract classes. New classes and functionality added to the
978
// ch.ethz.prose.reflect package, partially to reflect the
979
// more stable features taken from the iks.runes packages, partially
980
// to reflect the structure of the VM (constant pool, etc). Functionality in
981
// ch.ethz.prose.crosscut and the junit classes adapted to use the
982
// new form of the ch.ethz.prose.reflect package
983
//
984
// Revision 1.1.2.2 2001/02/22 16:23:32 popovici
985
// ProseSystem.setup replaced with startup; teardown introduced
986
//
987
// Revision 1.1.2.1 2001/01/22 07:28:20 popovici
988
// Initial Revision
989
//
990
Popular Tags