3

I have a fairly complex Java application that is utilizing a lot of CPU, and would like to know if there is any recommendation on a profile tool that I could use to determine the cause of the CPU utilization. My goal is to pinpoint the location in the code where it is using most of the CPU time.

5
  • Any Java profiler will run on Linux. Commented Mar 5, 2010 at 16:29
  • Are you using an IDE? Most good IDEs have profilers either built in or available as modules. Commented Mar 5, 2010 at 16:29
  • Nope, I am not running an IDE. My application actually is started my another application. Commented Mar 5, 2010 at 16:32
  • What Java version are you running? Is it 1.6 update 7 or newer? Commented Mar 5, 2010 at 16:34
  • 1
    If you have JDK 1.6.0_07 or newer, it comes with JVisualVM; that's why I ask. Commented Mar 5, 2010 at 17:43

6 Answers 6

3

I've used jProfiler and YourKit on Linux. But you might find the information you're looking for by running the jconsole that comes with recent JDKs. Good information on how to use it: http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

Sign up to request clarification or add additional context in comments.

Comments

0

Netbeans has good built-in profiler. NB runs quite well on Ubuntu 9.10

If your issue cannot be observed in developement, you can attach the profiler to a remote JVM (your production environment). You have to configure the host JVM to accept the JMS/JConsole connections from the profilers. The JMS/JConsole realtime monitoring visualization charts look pretty awesome.

Comments

0

I have used Visual VM in the eclipse IDE. If you are not on an IDE, jhat and jconsole will help. Google jhat for more info

Comments

0

If you are comfortable with Eclipse, I'd recommend TPTP.

Comments

0

If you use Sun Java 6 then learn to use jvisualvm in the JDK on the machine running the troublesome program.

It will answer most of your questions, can attach effortlessly to an already running program and is gratis.

Comments

-1

This method is low-tech but works best. Here's a short explanation why.

Since you are not running under an IDE, you can use pstack or lsstack to get stack samples. If the app is using lots more time than it should, then most likely the problem is one or a few rogue function calls, which will be clearly visible on most of the stack samples.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.