2

i am trying to analyze the CPU usage for a Java UI application running on Windows. I connected it to VisualVM, but it looks like the highest percentage for CPU usage is being used by

sum.rmi.transport.tcp.TCPTransport$ConnectionHandler.run();

I believe this is being used to supply information to VisualVM and hence VisualVM is skewing the results that i'm trying to investigate. Does any one have a way to get a better indication of what is occurring or a better method to determine what in a running java application is taking up so much CPU.

richs
  • 4,699
  • 10
  • 43
  • 56
  • [Here's a way](http://stackoverflow.com/questions/266373/one-could-use-a-profiler-but-why-not-just-halt-the-program/317160#317160) to get a good idea of what the program is doing. Basically, think of the software as a clock. The second method is called by the minute method, by the hour method, by the day method. If you just take a snapshot of it, you're find out what it's doing by examining all the levels. Do it several times in succession, and you'll know what it's spending time at. – Mike Dunlavey Apr 02 '11 at 16:41
  • By snap shot i'm assuming you mean stack trace. How can you tell what threads are running? versus what threads are blocking? versus what threads are waiting to be scheduled? – richs Apr 04 '11 at 19:00
  • Grab 'em all, and study each one. You can easily tell what each one is doing. Most you can easily disregard. You can tell which one you care about by what it's doing, no matter if it's crunching or if it's waiting for some IO, or sleeping, whatever. There's no educated guessing required. – Mike Dunlavey Apr 05 '11 at 01:56

2 Answers2

1

Try to use sampler first. For detailed information use the profiler and set root methods. See Profiling With VisualVM, Part 1 and Profiling With VisualVM, Part 2 for more information about CPU and Memory profiling.

coding_idiot
  • 13,526
  • 10
  • 65
  • 116
Tomas Hurka
  • 6,723
  • 29
  • 38
0

That sounds awfully suspicious. Try cross referencing the data with results from hprof. You won't need any external applications running, and the data will simply be dumped to a text file from your own process. Are you connecting to your process remotely?

Amir Afghani
  • 37,814
  • 16
  • 84
  • 124