Netbeans探查器的“自拍时间"是什么?真的是什么意思? [英] What does Netbeans profiler's "Self Time" actually mean?

查看:89
本文介绍了Netbeans探查器的“自拍时间"是什么?真的是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对我的简单游戏需要运行的时间感兴趣,因此我使用了Netbeans Java profiler(Java 1.7),并且可以在热点"选项卡中看到自发时间"和调用"列.

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.

例如,我的render方法具有:

For example, my render method has:

自拍时间:1025毫秒

调用:2311

因此,据我所知,这实际上是否意味着所有渲染方法调用的总时间总计为1025毫秒,而一个方法执行的平均时间为1025/2311 = 0.44毫秒?

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?

如果是这样,我可以强制IDE显示平均时间而不是总时间吗?

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

推荐答案

通常,自身时间"是指在方法主体内 所花费的时间,不包括在其调用的方法中所花费的时间.例如,假设您有一个简单的方法来检索已排序的用户getUsers,它调用了两个自身不会进行任何其他调用的方法.

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());
}

由于getUsers不起作用,因此即使调用该方法很昂贵,其自耗时间也将非常短.

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

这是基于我使用过的其他配置文件而不是NetBeans.希望有人可以对NetBeans本身进行确认或拒绝.

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

这篇关于Netbeans探查器的“自拍时间"是什么?真的是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆