# HG changeset patch # User Lukas Stadler # Date 1401295449 -7200 # Node ID a62590637801843519ddaf6cab030fa6ed71fcb4 # Parent 7c7cfc44cc61f3ee90c0d8764714db3685a83459 track memory usage in TruffleCompilerImpl diff -r 7c7cfc44cc61 -r a62590637801 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Wed May 28 17:47:23 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Wed May 28 18:44:09 2014 +0200 @@ -36,6 +36,7 @@ import com.oracle.graal.compiler.target.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; +import com.oracle.graal.debug.DebugMemUseTracker.Closeable; import com.oracle.graal.debug.internal.*; import com.oracle.graal.java.*; import com.oracle.graal.lir.asm.*; @@ -102,6 +103,10 @@ public static final DebugTimer CompilationTime = Debug.timer("CompilationTime"); public static final DebugTimer CodeInstallationTime = Debug.timer("CodeInstallation"); + public static final DebugMemUseTracker PartialEvaluationMemUse = Debug.memUseTracker("TrufflePartialEvaluationMemUse"); + public static final DebugMemUseTracker CompilationMemUse = Debug.memUseTracker("TruffleCompilationMemUse"); + public static final DebugMemUseTracker CodeInstallationMemUse = Debug.memUseTracker("TruffleCodeInstallationMemUse"); + public void compileMethodImpl(final OptimizedCallTarget compilable) { final StructuredGraph graph; @@ -111,7 +116,7 @@ long timeCompilationStarted = System.nanoTime(); Assumptions assumptions = new Assumptions(true); - try (TimerCloseable a = PartialEvaluationTime.start()) { + try (TimerCloseable a = PartialEvaluationTime.start(); Closeable c = PartialEvaluationMemUse.start()) { graph = partialEvaluator.createGraph(compilable, assumptions); } @@ -156,7 +161,7 @@ } CompilationResult result = null; - try (TimerCloseable a = CompilationTime.start(); Scope s = Debug.scope("TruffleGraal.GraalCompiler", graph, providers.getCodeCache())) { + try (TimerCloseable a = CompilationTime.start(); Scope s = Debug.scope("TruffleGraal.GraalCompiler", graph, providers.getCodeCache()); Closeable c = CompilationMemUse.start()) { CodeCacheProvider codeCache = providers.getCodeCache(); CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false); CompilationResult compilationResult = new CompilationResult(name); @@ -183,7 +188,7 @@ result.setAssumptions(newAssumptions); InstalledCode installedCode; - try (Scope s = Debug.scope("CodeInstall", providers.getCodeCache()); TimerCloseable a = CodeInstallationTime.start()) { + try (Scope s = Debug.scope("CodeInstall", providers.getCodeCache()); TimerCloseable a = CodeInstallationTime.start(); Closeable c = CodeInstallationMemUse.start()) { installedCode = providers.getCodeCache().addMethod(graph.method(), result, speculationLog, predefinedInstalledCode); } catch (Throwable e) { throw Debug.handle(e);