gpt4 book ai didi

scala - 从 sbt 运行 hprof

转载 作者:行者123 更新时间:2023-12-04 02:25:29 32 4
gpt4 key购买 nike

我如何运行 hprof来自 sbt ?

是否有不同的选项来分析 CPU 与堆?

最佳答案

我假设您不想配置文件 sbt本身,所以你必须使用 fork机制并结合hprof options :

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

或者
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)
})

以下是一些示例选项(使用 -agentlib:hprof=help 获得更多帮助):
Option Name and Value  Description                    Default
--------------------- ----------- -------
heap=dump|sites|all heap profiling all
cpu=samples|times|old CPU usage off

关于scala - 从 sbt 运行 hprof,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5600185/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com