diff options
Diffstat (limited to 'src/compiler/scala/tools/util/Profiling.scala')
-rw-r--r-- | src/compiler/scala/tools/util/Profiling.scala | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/util/Profiling.scala b/src/compiler/scala/tools/util/Profiling.scala index e0a1a0e2a0..aada795ee2 100644 --- a/src/compiler/scala/tools/util/Profiling.scala +++ b/src/compiler/scala/tools/util/Profiling.scala @@ -22,7 +22,13 @@ abstract class Profiling { def stopProfiling(): Unit def captureSnapshot(): Unit - def profile[T](body: => T): T = { + def allocationFreq: Option[Int] // record every Nth allocation + def startRecordingAllocations(): Unit + def stopRecordingAllocations(): Unit + + def profile[T](body: => T): T = profileCPU(body) + + def profileCPU[T](body: => T): T = { startProfiling() val result = body stopProfiling() @@ -30,6 +36,13 @@ abstract class Profiling { result } + def profileMem[T](body: => T): T = { + startRecordingAllocations() + val result = body + stopRecordingAllocations() + result + } + /** Advance the current object generation. * * Each object on the heap is associated to a generation number. Generations |