diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2010-12-16 15:24:30 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2010-12-16 15:24:30 +0000 |
commit | 5c6c2c243c3ba8d4e54af448ef96ed0d8ced3e42 (patch) | |
tree | 38fa206e4ba6c2d1f379e86d6f07bd0b9cf3b10f /src | |
parent | 30e72647ed0d9e7705e551553b81722d642a7f7d (diff) | |
download | scala-5c6c2c243c3ba8d4e54af448ef96ed0d8ced3e42.tar.gz scala-5c6c2c243c3ba8d4e54af448ef96ed0d8ced3e42.tar.bz2 scala-5c6c2c243c3ba8d4e54af448ef96ed0d8ced3e42.zip |
Added advanceGeneration for memory profiling, a...
Added advanceGeneration for memory profiling, and resident-mode profile
option. review by extempore.
Diffstat (limited to 'src')
4 files changed, 18 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 327de376c0..45fb691904 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -655,6 +655,12 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable /** To be initialized from firstPhase. */ private var terminalPhase: Phase = NoPhase + if (settings.YprofileRes.value) { + System.gc(); + println("Saving snapshot") + profiler.captureSnapshot() + } + /** Whether compilation should stop at or skip the phase with given name. */ protected def stopPhase(name: String) = settings.stop contains name protected def skipPhase(name: String) = settings.skip contains name diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 1e03de44a0..372c216d7a 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -117,6 +117,7 @@ trait ScalaSettings extends AbsScalaSettings with StandardScalaSettings { // Not actually doing anything, so disabled. // val nopredefs = BooleanSetting ("-Yno-predefs", "Compile without any implicit predefined values.") val Yprofile = PhasesSetting ("-Yprofile", "(Requires jvm -agentpath to contain yjgpagent) Profile") + val YprofileRes = BooleanSetting ("-Yprofile-resident", "Profile memory, get heap snapshot after each compiler run (requires yjpagent, see above).") val YprofileClass = StringSetting ("-Yprofile-class", "class", "Name of profiler class.", "scala.tools.util.YourkitProfiling") val Yrecursion = IntSetting ("-Yrecursion", "Set recursion depth used when locking symbols.", 0, Some(0, Int.MaxValue), (_: String) => None) val selfInAnnots = BooleanSetting ("-Yself-in-annots", "Include a \"self\" identifier inside of annotations.") diff --git a/src/compiler/scala/tools/util/Profiling.scala b/src/compiler/scala/tools/util/Profiling.scala index 3b45762bd8..e0a1a0e2a0 100644 --- a/src/compiler/scala/tools/util/Profiling.scala +++ b/src/compiler/scala/tools/util/Profiling.scala @@ -29,4 +29,11 @@ abstract class Profiling { captureSnapshot() result } + + /** Advance the current object generation. + * + * Each object on the heap is associated to a generation number. Generations + * start at 1, and are automatically advanced on each snapshot capture. + */ + def advanceGeneration(desc: String = ""): Unit } diff --git a/src/yourkit/scala/tools/util/YourkitProfiling.scala b/src/yourkit/scala/tools/util/YourkitProfiling.scala index d66cdc9ee1..9d166d9a03 100644 --- a/src/yourkit/scala/tools/util/YourkitProfiling.scala +++ b/src/yourkit/scala/tools/util/YourkitProfiling.scala @@ -32,5 +32,9 @@ class YourkitProfiling extends Profiling { active = false } + def advanceGeneration(desc: String) { + controller.advanceGeneration(desc) + } + def isActive = active }
\ No newline at end of file |