# HG changeset patch # User Doug Simon # Date 1407494002 -7200 # Node ID c880fb576c97b2f574f6511e1b05f57bc7510b77 # Parent 46eaf7cd8275076490db7ee59d82483e58c65e22 add support for CompileTheWorld based memory usage analysis diff -r 46eaf7cd8275 -r c880fb576c97 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Fri Aug 08 12:29:07 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Fri Aug 08 12:33:22 2014 +0200 @@ -23,6 +23,8 @@ package com.oracle.graal.hotspot.test; import static com.oracle.graal.debug.internal.MemUseTrackerImpl.*; +import static com.oracle.graal.hotspot.CompileTheWorld.*; +import static com.oracle.graal.hotspot.CompileTheWorld.Options.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.nodes.StructuredGraph.*; @@ -31,15 +33,24 @@ import com.oracle.graal.debug.*; import com.oracle.graal.debug.internal.*; import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.CompileTheWorld.Config; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.printer.*; /** - * Used to benchmark memory usage during Graal compilation. Run with: + * Used to benchmark memory usage during Graal compilation. + * + * To benchmark: * *
  *     mx vm -XX:-UseGraalClassLoader -cp @com.oracle.graal.hotspot.test com.oracle.graal.hotspot.test.MemoryUsageBenchmark
  * 
+ * + * Memory analysis for a {@link CompileTheWorld} execution can also be performed. For example: + * + *
+ *     mx --vm server vm -XX:-UseGraalClassLoader -G:CompileTheWorldClasspath=$HOME/SPECjvm2008/SPECjvm2008.jar -cp @com.oracle.graal.hotspot.test com.oracle.graal.hotspot.test.MemoryUsageBenchmark
+ * 
*/ public class MemoryUsageBenchmark extends GraalCompilerTest { @@ -149,7 +160,16 @@ } public void run() { + compileAndTime("simple"); compileAndTime("complex"); - compileAndTime("simple"); + if (CompileTheWorldClasspath.getValue() != SUN_BOOT_CLASS_PATH) { + CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), new Config(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(), + CompileTheWorldStopAt.getValue(), CompileTheWorldVerbose.getValue()); + try { + ctw.compile(); + } catch (Throwable e) { + e.printStackTrace(); + } + } } }