Scala 分析器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1340082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Scala profiler?
提问by Phil
I started to program in Scala recently. I'm looking for a free Scala profiler. Reading from the language's official site led me to YourKit, but the program was not a free one.
我最近开始在 Scala 中编程。我正在寻找免费的 Scala 分析器。从该语言的官方网站阅读使我找到了YourKit,但该程序不是免费的。
Googling "scala profiler" didnt give me any relevant result.
谷歌搜索“scala profiler”没有给我任何相关结果。
So how do I profile my program written in Scala? I prefer a graphical plugin for Netbeans or Eclipse. But if there is no such thing, then a console one will be fine.
那么我如何分析我用 Scala 编写的程序?我更喜欢 Netbeans 或 Eclipse 的图形插件。但是如果没有这样的东西,那么控制台就可以了。
Thanks :)
谢谢 :)
采纳答案by oxbow_lakes
Given that Scala runs on the Java Virtual Machine (JVM), you can use the JVMtools JConsoleand VisualVMto profile the application. Alternatively anyJava profiler should work (e.g. YourKit, as you've already mentioned)
鉴于对Java虚拟机运行斯卡拉(JVM),您可以使用JVM的工具JConsole和VisualVM分析的应用程序。或者,任何Java 分析器都可以工作(例如 YourKit,正如您已经提到的)
VisualVMhas been bundled with the JDK since 1.6.0_10and it is based on the NetBeans profiler. You can capture memory usage, code performance hotspots etc:
VisualVM从那时起1.6.0_10,它就与 JDK 捆绑在一起,它基于 NetBeans 分析器。您可以捕获内存使用情况、代码性能热点等:
C:> %JAVA_HOME%\bin\jvisualvm
回答by ogrisel
I have tried with jvisualvm (both inside and outside netbeans) but I cannot see any scala method call in the profiling reports (only the underlying java libraries method calls). To me it looks like a bug but I might have missed snomething obvious. Anyway here is a issue report I wrote on netbeans.org with the details:171388
我已经尝试过 jvisualvm(在 netbeans 内部和外部),但在分析报告中看不到任何 Scala 方法调用(只有底层的 java 库方法调用)。对我来说,它看起来像一个错误,但我可能错过了一些明显的东西。无论如何,这是我在 netbeans.org 上写的问题报告,其中包含详细信息:171388
If anybody here has successfully used JVisualVM to CPU-profile Scala code please let me know.
如果这里有人成功地使用 JVisualVM 来对 Scala 代码进行 CPU 配置,请告诉我。

