2

I am trying to profile an application with jvisualvm. The application consists of a loop, in which data is loaded from a database and then some complex calculations are performed on the data. When a set of data is processed, the next set is loaded and calculated.

When I start my application and attach jvisualvm, I set up a filter on the CPU profiling page ("Sart profiling from classes" and "Do not profile classes"), since I am not interested in anything that relates to the database access, and other input/output related stuff.

The filter works - almost. My problem is, that the profiler reports most of the time is spent in sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(), even though sun.* is entered into the "Do not profile classes" filter. This is the only method in sun.* appearing in my profiling results.

Has anyone seen this before and knows how to get rid of it? Problem is, all other methods show up only with tiny amounts (<1%) in the "Self Time" column, most are displayed with 0%.

The jvisualvm version used is 1.3.2.

Thanks in advance, Axel

Axel
  • 13,939
  • 5
  • 50
  • 79
  • Don't look at "Self Time". [It's practically meaningless.](http://stackoverflow.com/questions/1777556/alternatives-to-gprof/1779343#1779343) – Mike Dunlavey Aug 25 '11 at 13:23
  • Interesting link, but given that the only columns to display are "Self Time", "Self Time [%]", and "Invocations" there's not much left to look at... :-) – Axel Aug 25 '11 at 14:30
  • There must be a way to get inclusive time. It might be called "cumulative" or "total" time. – Mike Dunlavey Aug 26 '11 at 16:16

2 Answers2

1

Sounds like most of the time is spent waiting from the database. If you want to profile the rest of the stuff, you can either

  • stub the database so that it returns quickly (thus making the rest of your code take most of the time), or
  • use a better profiler such as YourKit or JProfiler (paid, definitely support what you want) or TPTP (free, but I'm not sure how powerful it us)
artbristol
  • 32,010
  • 5
  • 70
  • 103
  • Well then I'll go with your first suggestion. I have used TPTP before, but it isn't available any more Indigo. If nothing helps, I think I'll have to keep a separate Helios installation for profiling. – Axel Aug 26 '11 at 07:00
  • [YourKit](http://www.yourkit.com/) is paid, correct but it has ~2-weeks trial period. I used its trial to profile an urgent problem - after that _trial_ I was more than happy to get paid version. – gnat Sep 03 '11 at 10:17
0

Uncheck 'Profile new Runnables' on the CPU profiling page. To answer your other question with "Self Time" - you need to take a CPU snapshot of profiled data. The snapshot contains total method time info.

Tomas Hurka
  • 6,723
  • 29
  • 38