Index: performance/test/unit/src/memory/MeasureBaselineMemoryFootprint.java =================================================================== RCS file: /shared/data/ccvs/repository/performance/test/unit/src/memory/MeasureBaselineMemoryFootprint.java,v --- performance/test/unit/src/memory/MeasureBaselineMemoryFootprint.java 2 Jun 2005 15:12:10 -0000 1.5 +++ performance/test/unit/src/memory/MeasureBaselineMemoryFootprint.java 9 Apr 2006 12:27:13 -0000 @@ -20,6 +20,7 @@ import java.io.InputStreamReader; import java.io.LineNumberReader; +import java.lang.management.*; import java.util.StringTokenizer; /** @@ -68,14 +69,20 @@ /** Measure baseline memory footprint */ public void testMemoryFootprintAfterStart() throws IOException{ long memory; + long clzCount; try { memory = getMemoryConsumption(); - if(memory>0){ reportPerformance("Memory Consumption After Start", memory , "kB", 1); }else fail("Measured value = "+memory+"kB - it's wrong value!"); + clzCount = getClassesCount(); + if(clzCount>0){ + reportPerformance("Class Count After Start", clzCount , "", 1); + }else + fail("Measured value = "+clzCount+" loaded classes - it's wrong value!"); + }catch(Exception exc){ exc.printStackTrace(getLog()); fail("Exception rises during measurement : "+exc.toString()); @@ -90,14 +97,20 @@ } long memory; + long clzCount; try { memory = getMemoryConsumption(); - if(memory>0){ reportPerformance("Memory Consumption After Start with 10 opened files", memory , "kB", 1); }else fail("Measured value = "+memory+"kB - it's wrong value!"); + clzCount = getClassesCount(); + if(clzCount>0){ + reportPerformance("Class Count After Start", clzCount , "", 1); + }else + fail("Measured value = "+clzCount+" loaded classes - it's wrong value!"); + }catch(Exception exc){ exc.printStackTrace(getLog()); fail("Exception rises during measurement : "+exc.toString()); @@ -159,6 +172,15 @@ return 0; } + + /** + * Queries the JVM to get number of loaded classes + * @return number of loaded classes + */ + private long getClassesCount () { + ClassLoadingMXBean clbean = ManagementFactory.getClassLoadingMXBean(); + return clbean.getTotalLoadedClassCount(); + } /** * Run appropriate command against used platform.