简体   繁体   English

Android开发者页面:了解traceview profiling示例

[英]Android developer page: understanding traceview profiling example

I am looking at this page: Profiling with Traceview and dmtracedump 我正在看这个页面: 使用Traceview和dmtracedump进行分析

Under "Profile Panel" it has the following text that refers to the sample profiling result below the text: 在“配置文件面板”下,它具有以下文本,引用文本下方的示例性能分析结果:

The last column in the table shows the number of calls to this method plus the number of recursive calls. 表中的最后一列显示了对此方法的调用次数加上递归调用的次数。 The last column shows the number of calls out of the total number of calls made to that method. 最后一列显示了对该方法的调用总数中的调用次数。 In this view, we can see that there were 14 calls to LoadListener.nativeFinished(); 在这个视图中,我们可以看到有14次调用LoadListener.nativeFinished(); looking at the timeline panel shows that one of those calls took an unusually long time. 查看时间轴面板显示其中一个电话花了很长时间。

I am confused by this description. 我对此描述感到困惑。 First, the 1st two sentences in this quote seem to be referring to the same column. 首先,本引文中的前两句似乎是指同一列。 So what does this last column actually contain? 那么最后一栏实际上包含了什么? Second, I don't understand where exactly in the "timeline panel" I have to look to see that it "shows that one of those calls took an unusually long time". 其次,我不明白“时间轴面板”的确切位置,我必须看到它“显示其中一个电话花了不寻常的时间”。

Can you please help me make sense of this text. 能帮我理解一下这篇文章吗?

First off, the same article tells us that: 首先,同一篇文章告诉我们:

Parents are shown with a purple background and children with a yellow background 父母被显示有紫色背景和孩子有黄色背景

So LoadListener.nativeFinished is the parent function and all of the indented rows underneath it are children , or functions that the parent has called. 所以LoadListener.nativeFinished是父函数 ,它下面的所有缩进行都是节点或父调用的函数。

Profile Panel 档案面板

Here's a clip of the Profile Panel from the article: 这是文章中的配置文件面板的剪辑:

配置文件面板的剪辑

The last column in the table shows the number of calls to this method plus the number of recursive calls. 表中的最后一列显示了对此方法的调用次数加上递归调用的次数。

The last column of the first row (parent) indicates the number of calls and recursive calls made to this function: 14 iterative and 0 recursive calls, separated by a plus symbol ( 14+14 ). 第一行(父)的最后一列表示对此函数进行的调用和递归调用的次数:14次迭代和0次递归调用,用加号( 14 + 14 )分隔。

I think the author of the article accidentally a few words and as a result, the next line is a bit confusing: 我认为文章的作者不小心说了几句话,结果下一行有点混乱:

The last column shows the number of calls out of the total number of calls made to that method. 最后一列显示了对该方法的调用总数中的调用次数。

In the yellow-backgrounded child rows below the parent, the last column does not actually indicate Calls+Rec. 在父级下面的黄色背景子行中,最后一列实际上不表示Calls + Rec。 Note the change in notation - a fraction is used versus the plus symbol syntax. 请注意符号的变化 - 使用分数与加号符号语法。 In the case of LoadListener.tearDown, 14/14 indicates that LoadListener.tearDown was called by the parent function 14 times. 在LoadListener.tearDown的情况下,14/14表示LoadListener.tearDown由父功能14倍调用。 The LoadListener.tearDown function was called 14 times in total within this trace, hence LoadListener.nativeFinished is the only function to have called LoadListener.tearDown in this trace. 在此跟踪中,LoadListener.tearDown函数总共调用了14次,因此LoadListener.nativeFinished是此跟踪中唯一调用LoadListener.tearDown的函数。

Let's look at the another row. 让我们看看另一行。 The last column of the (child) function View.invalidate has a value of 2413/2853. (子)函数View.invalidate的最后一列的值为2413/2853。 This doesn't mean that View.invalidate was called 2413 times iteratively and 2853 times recursively. 这并不意味着View.invalidate被迭代地调用2413次而递归调用2853次。 Instead it means that the parent function, LoadListener.nativeFinished, called View.invalidate 2413 times. 相反,它意味着父函数LoadListener.nativeFinished,调用View.invalidate 2413次。

Now take a look at row #6 and you'll see that View.invalidate was called 2853 times iteratively and 0 times recursively. 现在看一下#6行,你会看到View.invalidate被迭代地调用2853次,递归调用0次。 Therefore the parent function, LoadListener.nativeFinished, is the only function to have ever called LoadListener.tearDown within this trace. 因此,父函数LoadListener.nativeFinished是在此跟踪中调用LoadListener.tearDown的唯一函数。

Timeline Panel 时间线小组

Here's a clip of the Timeline Panel from the article: 以下是文章中时间轴面板的剪辑:

时间线面板的剪辑

From the same article, 来自同一篇文章,

The thin lines underneath the first row show the extent (entry to exit) of all the calls to the selected method 第一行下面的细线显示所选方法的所有调用的范围(进入退出)

Notice the thin, brace-like pink lines that span horizontally directly below the highlighted section of the Main thread. 注意细长的支撑状粉红色线条直接水平跨越主线程突出显示部分的下方。 The leftmost pink braces are very short; 最左边的粉色花括号很短; these represent 13/14 calls to LoadListener.nativeFinished that finished relatively quickly. 这些代表对LoadListener.nativeFinished的13/14调用,它们相对较快地完成。 The last brace - the one furthest to the right - is considerably longer than any of the others. 最后一个支架 - 最右边的支架 - 比任何其他支架长得多。 This is the call to LoadListener.nativeFinished that "took an unusually long time." 这是对LoadListener.nativeFinished的调用“花了很长时间”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM