Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running hprof from sbt

Tags:

scala

sbt

hprof

How do I run hprof from sbt?

Are there different options to profile the CPU vs. the heap?

like image 674
dsg Avatar asked Apr 08 '11 19:04

dsg


1 Answers

I assume you don't want to profile sbt itself so you'd have to use the fork mechanism and combine with the hprof options:

override def fork = forkRun("-agentlib:hprof=heap=sites" :: Nil)

or

override def fork = Some(new ForkScalaRun { 
  override def runJVMOptions = super.runJVMOptions ++
    Seq("-Xmx1999m", "-agentlib:hprof=heap=sites") 
  override def scalaJars = Seq(buildLibraryJar.asFile, buildCompilerJar.asFile)
})

Here are some sample options (use -agentlib:hprof=help for more help):

Option Name and Value  Description                    Default
---------------------  -----------                    -------
heap=dump|sites|all    heap profiling                 all
cpu=samples|times|old  CPU usage                      off
like image 154
huynhjl Avatar answered Sep 27 '22 21:09

huynhjl