tags:

views:

999

answers:

2
+10  Q: 

Scala profiler?

Hi, 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.

Googling "scala profiler" didnt give me any relevant result.

So how do I profile my program written in Scala? I prefer a graphical plugin to Netbeans or Eclipse. But if there is no such thing, then a console one will be fine.

Thanks :)

+17  A: 

Given that Scala runs on the Java Virtual Machine (JVM), you can use the JVM tools JConsole and JVisualVM to profile the application. Alternatively any Java profiler should work (e.g. YourKit, as you've already mentioned)

JVisualVM has been bundled with the JDK since 1.6.0_10 and it is based on the NetBeans profiler. You can capture memory usage, code performance hotspots etc:

C:> %JAVA_HOME%\bin\jvisualvm
oxbow_lakes
Many thanks. I'll check that out
Po
Thank you. I downloaded JVisualVM then followed the guide here https://visualvm.dev.java.net/gettingstarted.html, and it works.
Po
One more problem: The program only displayed where is the hotspot. How do I make it display in the "hierarchical" mode? i.e. which function calls which. Can JVisualVM do that?Thanks :)
Po
@Phuc: yes, you need to take a snapshot for this functionality. The button is above the list of hotspots.
Joachim Sauer
Oh thanks Joachim
Po
+4  A: 

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

If anybody here has successfully used JVisualVM to CPU-profile Scala code please let me know.

ogrisel
I'm having the same problem. I don't see any Scala methods.
Seun Osewa