Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Netbeans profiler's "Self Time" actually mean?

I have been interested in time my simple game needs to run so I have used the Netbeans Java profiler (Java 1.7) and I can see the "Self Time" and "Invocations" columns in "Hot Spots" tab.

For example, my render method has:

Self Time: 1025 ms

Invocations: 2311

So, if I understand well, does it actually mean that the TOTAL amount of time of ALL render method invocations together gives 1025 ms and the average time of one method execution is 1025 / 2311 = 0,44 ms?

If so, can I force the IDE to display average times instead of total times?

like image 782
Miroslav Mares Avatar asked Jul 20 '12 14:07

Miroslav Mares


1 Answers

Typically, "self time" measures the time spent inside the method body--excluding the time spent in the methods it calls. For example, say you had a simple method to retrieve the sorted users, getUsers, which called two methods that didn't make any other calls themselves.

UserList getUsers() {
    return sortUsers(loadUsers());
}

Since getUsers does no work, its self time would be very low even though calling the method is expensive.

Method       Self Time  Call Time
-----------  ---------  ---------
getUsers          3 ms   1,184 ms
loadUsers       923 ms     923 ms
sortUsers       258 ms     258 ms

This is based on other profiles I've used--not NetBeans. Hopefully someone can confirm or deny this for NetBeans itself.

like image 193
David Harkness Avatar answered Nov 25 '22 12:11

David Harkness