KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > beans > test > MemoryPerformanceTest


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.beans.test;
8
9
10 //import java.beans.*;
11
//import java.lang.reflect.*;
12

13 import junit.framework.TestCase;
14
15 //import com.inversoft.beans.*;
16

17
18 /**
19  * This class contains all memory performance tests for the entire
20  * package
21  * @author Brian Pontarelli
22  */

23 public class MemoryPerformanceTest extends TestCase {
24
25     public MemoryPerformanceTest(String JavaDoc name) {
26         super(name);
27     }
28
29     public void testBeanPropertyMemory() {
30
31         /*
32         try {
33             Bean1 bean = new Bean1();
34             BeanProperty [] properties = new BeanProperty[ITERATIONS];
35             Runtime runtime = Runtime.getRuntime();
36             long memoryBefore = runtime.totalMemory() - runtime.freeMemory();
37
38             for (int i = 0; i < ITERATIONS; i++) {
39                 properties[i] = new BeanProperty("integer1", Bean1.class);
40             }
41
42             long memoryAfter = runtime.totalMemory() - runtime.freeMemory();
43             System.err.println("The number of bytes for 10,000 jBeans BeanProperty's: "
44                 + (memoryAfter - memoryBefore));
45         } catch (BeanException be) {
46             fail(be.toString());
47         }
48         
49         try {
50             Bean1 bean = new Bean1();
51             PropertyDescriptor [] properties = new PropertyDescriptor[ITERATIONS];
52             Runtime runtime = Runtime.getRuntime();
53             long memoryBefore = runtime.totalMemory() - runtime.freeMemory();
54
55             for (int i = 0; i < ITERATIONS; i++) {
56                 properties[i] = new PropertyDescriptor("integer1", Bean1.class);
57             }
58
59             long memoryAfter = runtime.totalMemory() - runtime.freeMemory();
60             System.err.println("The number of bytes for 10,000 java.beans PropertyDescriptor's: "
61                 + (memoryAfter - memoryBefore));
62         } catch (IntrospectionException ie) {
63             fail(ie.toString());
64         }
65         */

66     }
67 }
68
Popular Tags