Time spent in method

Questions about YourKit Java Profiler
Post Reply
kent37
Posts: 2
Joined: Thu Sep 09, 2004 6:26 pm

Time spent in method

Post by kent37 »

Is there a way to show the time spent in a method not counting the time in called methods? For example the Invocation Tree might show
com.skillsoft.cb.importer.ExcelImporter.importXls(String) 13,029
com.skillsoft.cb.importer.ExcelImporter.importCourses() 8,260
com.skillsoft.cb.hibernate.HibernateCbDao.clearDatabase() 2,411
com.skillsoft.rattler.data...<init>(File) 1,894
com.skillsoft.cb.importer.ExcelImporter.importCategories6() 348

The called methods only add up to 12913 meaning 116 was spent in importXls. This is not the best example; sometimes the difference is greater.

Thanks!
Kent
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

There will be no "own" time in the version 3.0 which will be released very soon. We'll re-consider this issue preparing feature list for the version next to 3.0.

By the way, how can this be used? If method a() itself takes 1 second and calls b() which takes 10 seconds, then overall time of a() is 11 seconds and isn't it better to optimize b() (or call chipper variant of b()) rather than own code of a()? I suppose that "own" times of methods in entire program will be in common case relatively uniformely distributed.
kent37
Posts: 2
Joined: Thu Sep 09, 2004 6:26 pm

Post by kent37 »

Sometimes the "own" time is dominant. For example if a() takes 10 seconds and also calls b(), c() and d() each of which are 1 second, the total time is 13 seconds which is dominated by the time in a().
jcompagner
Posts: 32
Joined: Sat Sep 11, 2004 9:18 am

Post by jcompagner »

i already requested this feature by mail. It would be very nice to see this because now you really can't see where the real holdup is.

what would be nice:

com.skillsoft.cb.importer.ExcelImporter.importXls(String) 13,029 (116)
com.skillsoft.cb.importer.ExcelImporter.importCourses() 8,260
com.skillsoft.cb.hibernate.HibernateCbDao.clearDatabase() 2,411
com.skillsoft.rattler.data...<init>(File) 1,894
com.skillsoft.cb.importer.ExcelImporter.importCategories6() 348

so: total time (in method time)

i have the same thing with object creations/what a method cost in memory. Also there i would like to see how many new Object() the method itself did and how much memory those things cost..
falk
Posts: 6
Joined: Fri Oct 08, 2004 9:50 pm

Post by falk »

Hi there.

I have registered and tried version 3.1 beta just and ONLY to check out this missing feature. I tried v2.5 and saw this feature is missing. Therefore, I throw it away. Now I got the invitation to check out 3.1 and get one free license :wink:

What shall I say?

Without the feature to compute a methods internally consumed time (w/o counting callees times which are listed anyway) and the feature to SORT by this time, a debugger is useless. Really! Just believe me. You as a profiler maker must be sort of crazy not to have started right there... Some commercial vendors are even able to list and sort by time spent by source LINE. This feature was named 'own time' in this discussion thread.

To be precise: The own time of a method would be the total time summed over all invocations spent in this method which was not spent in another method.

So please, sit down, make homework and come back to me then.

Somebody asked why this feature would be useful?

Maybe some theory may help to understand this. After all, programs are algorithms which perform work. In order to optimize, it is important to see which part of an algorithm consumes time, not how and why this part gets called.

For instance, in an XML parser, I need to see that java.lang.String.<init> () is the hot spot in order to understand that I can win be replacing it by java.lang.String.substring(). That this may happen in a SAX-event callback is completely irrelevant. So, please... Build a profiler, not a toy.
Post Reply