What does Netbeans profiler's “Self Time” actually mean?

陌路散爱 提交于 2019-12-22 04:34:16

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/11581686/what-does-netbeans-profilers-self-time-actually-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!