Link Here
|
20 |
import java.io.InputStreamReader; |
20 |
import java.io.InputStreamReader; |
21 |
import java.io.LineNumberReader; |
21 |
import java.io.LineNumberReader; |
22 |
|
22 |
|
|
|
23 |
import java.lang.management.*; |
23 |
import java.util.StringTokenizer; |
24 |
import java.util.StringTokenizer; |
24 |
|
25 |
|
25 |
/** |
26 |
/** |
Link Here
|
68 |
/** Measure baseline memory footprint */ |
69 |
/** Measure baseline memory footprint */ |
69 |
public void testMemoryFootprintAfterStart() throws IOException{ |
70 |
public void testMemoryFootprintAfterStart() throws IOException{ |
70 |
long memory; |
71 |
long memory; |
|
|
72 |
long clzCount; |
71 |
try { |
73 |
try { |
72 |
memory = getMemoryConsumption(); |
74 |
memory = getMemoryConsumption(); |
73 |
|
|
|
74 |
if(memory>0){ |
75 |
if(memory>0){ |
75 |
reportPerformance("Memory Consumption After Start", memory , "kB", 1); |
76 |
reportPerformance("Memory Consumption After Start", memory , "kB", 1); |
76 |
}else |
77 |
}else |
77 |
fail("Measured value = "+memory+"kB - it's wrong value!"); |
78 |
fail("Measured value = "+memory+"kB - it's wrong value!"); |
78 |
|
79 |
|
|
|
80 |
clzCount = getClassesCount(); |
81 |
if(clzCount>0){ |
82 |
reportPerformance("Class Count After Start", clzCount , "", 1); |
83 |
}else |
84 |
fail("Measured value = "+clzCount+" loaded classes - it's wrong value!"); |
85 |
|
79 |
}catch(Exception exc){ |
86 |
}catch(Exception exc){ |
80 |
exc.printStackTrace(getLog()); |
87 |
exc.printStackTrace(getLog()); |
81 |
fail("Exception rises during measurement : "+exc.toString()); |
88 |
fail("Exception rises during measurement : "+exc.toString()); |
Link Here
|
90 |
} |
97 |
} |
91 |
|
98 |
|
92 |
long memory; |
99 |
long memory; |
|
|
100 |
long clzCount; |
93 |
try { |
101 |
try { |
94 |
memory = getMemoryConsumption(); |
102 |
memory = getMemoryConsumption(); |
95 |
|
|
|
96 |
if(memory>0){ |
103 |
if(memory>0){ |
97 |
reportPerformance("Memory Consumption After Start with 10 opened files", memory , "kB", 1); |
104 |
reportPerformance("Memory Consumption After Start with 10 opened files", memory , "kB", 1); |
98 |
}else |
105 |
}else |
99 |
fail("Measured value = "+memory+"kB - it's wrong value!"); |
106 |
fail("Measured value = "+memory+"kB - it's wrong value!"); |
100 |
|
107 |
|
|
|
108 |
clzCount = getClassesCount(); |
109 |
if(clzCount>0){ |
110 |
reportPerformance("Class Count After Start", clzCount , "", 1); |
111 |
}else |
112 |
fail("Measured value = "+clzCount+" loaded classes - it's wrong value!"); |
113 |
|
101 |
}catch(Exception exc){ |
114 |
}catch(Exception exc){ |
102 |
exc.printStackTrace(getLog()); |
115 |
exc.printStackTrace(getLog()); |
103 |
fail("Exception rises during measurement : "+exc.toString()); |
116 |
fail("Exception rises during measurement : "+exc.toString()); |
Link Here
|
159 |
return 0; |
172 |
return 0; |
160 |
} |
173 |
} |
161 |
|
174 |
|
|
|
175 |
|
176 |
/** |
177 |
* Queries the JVM to get number of loaded classes |
178 |
* @return number of loaded classes |
179 |
*/ |
180 |
private long getClassesCount () { |
181 |
ClassLoadingMXBean clbean = ManagementFactory.getClassLoadingMXBean(); |
182 |
return clbean.getTotalLoadedClassCount(); |
183 |
} |
162 |
|
184 |
|
163 |
/** |
185 |
/** |
164 |
* Run appropriate command against used platform. |
186 |
* Run appropriate command against used platform. |