# HG changeset patch # User Doug Simon # Date 1407493747 -7200 # Node ID 46eaf7cd8275076490db7ee59d82483e58c65e22 # Parent 88c72965bdfa0c2b5b07029d57983fac2d6bb2f1 added memory usage analysis to CompileTheWorld diff -r 88c72965bdfa -r 46eaf7cd8275 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Thu Aug 07 17:33:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Fri Aug 08 12:29:07 2014 +0200 @@ -23,6 +23,7 @@ package com.oracle.graal.hotspot; import static com.oracle.graal.compiler.common.GraalOptions.*; +import static com.oracle.graal.debug.internal.MemUseTrackerImpl.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.nodes.StructuredGraph.*; @@ -158,6 +159,7 @@ private int classFileCounter = 0; private int compiledMethodsCounter = 0; private long compileTime = 0; + private long memoryUsed = 0; private boolean verbose; private final Config config; @@ -311,7 +313,7 @@ } println(); - println("CompileTheWorld : Done (%d classes, %d methods, %d ms)", classFileCounter, compiledMethodsCounter, compileTime); + println("CompileTheWorld : Done (%d classes, %d methods, %d ms, %d bytes of memory used)", classFileCounter, compiledMethodsCounter, compileTime, memoryUsed); } class CTWCompilationTask extends CompilationTask { @@ -346,11 +348,13 @@ private void compileMethod(HotSpotResolvedJavaMethod method) { try { long start = System.currentTimeMillis(); + long allocatedAtStart = getCurrentThreadAllocatedBytes(); HotSpotBackend backend = runtime.getHostBackend(); CompilationTask task = new CTWCompilationTask(backend, method); task.runCompilation(); + memoryUsed += getCurrentThreadAllocatedBytes() - allocatedAtStart; compileTime += (System.currentTimeMillis() - start); compiledMethodsCounter++; method.reprofile(); // makes the method also not-entrant