理解 TPTP 分析结果所需的帮助
我是分析新手。我决定从 Eclipse TPTP 开始,因为它看起来简单且易于配置,
我从这个基本应用程序开始
public class As {
public static void main(String args[]) {
Two t = new Two();
t.two();
}
}
=====================
public class Two
{
public void two() {
System.out.println("Two");
}
}
==============
在使用 Profile As JavaApplication 在 As.java 上运行 Profiler 后。 屏幕截图以这种方式出现:
请在此处查看屏幕截图
http://imageshack.us/ f/11/shareb.jpg/
请告诉我“基准时间”、“平均基准时间”和“累积时间”是什么意思。
I am new to Profiling . i decided to start with Eclipse TPTP as its looks simple and easily configurable
I started with this basic APplication
public class As {
public static void main(String args[]) {
Two t = new Two();
t.two();
}
}
=====================
public class Two
{
public void two() {
System.out.println("Two");
}
}
==============
After running the Profiler on As.java using Profile As JavaApplication .
The screen shot appeared in this way :
Please see the screen shot here
http://imageshack.us/f/11/shareb.jpg/
Please let me know what is meant by Base Time , Average Base Time and Cumulative Time .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基准时间:方法执行所花费的时间(以秒为单位)。不包括从此方法调用的任何其他方法的执行时间。
平均基准时间:执行该方法一次所需的平均基准时间。
累计基本时间:该方法执行所花费的时间(以秒为单位)。包括从此方法调用的任何其他方法的执行时间。
调用:调用该方法的次数。
您可能需要查看以下教程,其中包含此信息: 分析 Java 应用程序简介
Base Time: The amount of time (in seconds) the method has taken to execute. Not including the execution time of any other methods called from this method.
Average base time: The average base time required to execute this method once.
Cumulative base time: The amount of time (in seconds) this method took to execute. Including the execution time of any other methods called from this method.
Calls: The number of times this method was invoked.
You may want to have a look at the following Tutorial, where this information is located: An introduction to profiling Java applications
实际有用的信息是累积时间占总时间的百分比。
这是例程在堆栈上的时间百分比,即执行自身或调用其他函数,无论调用了多少次。
这个数字之所以有用,是因为如果这样的函数可以大幅加速,那么这个百分比可以告诉您总时间可以减少多少。
例如,如果例程 A 的累积百分比时间为 10%,那么即使您可以将其时间减少到零,总时间也只会减少 10%。
为了使软件运行得更快,您必须找到可以压缩的高累积百分比的例程,通常是通过减少对子例程的调用来实现。
例程的调用计数和平均执行时间仅在帮助您计算累积百分比时才有用。
此外,测量的精度并不重要,只是可以帮助您找到想要优化的功能。
当你优化一个函数时,节省的时间就是它的实际情况,无论事先测量得多么仔细。
The information that's actually useful is cumulative time as a percent of total time.
That is the percent of time the routine is on the stack, i.e. either executing itself or calling other functions, regardless of how many times it is called.
The reason that number is useful is because if such a function could be speeded up by a large amount, that percent tells you how much the total time could be reduced.
For example, if routine A has a cumulative percent time of 10%, then even if you could reduce its time to zero, the total time would only go down by 10%.
To make software go faster, you have to find routines of high cumulative percent that you can squeeze, often by doing fewer calls to subroutines.
Call counts and average execution time of routines is only useful to the extent that it helps you figure out cumulative percent.
Also, the precision of the measurement is not really important except to help you locate the functions you want to optimize.
When you optimize a function, the amount of time saved is what it is, regardless of how carefully it was measured beforehand.