Android 开发者页面:了解 TraceView 分析示例

发布于 2025-01-07 21:15:44 字数 483 浏览 3 评论 0原文

我正在查看此页面:使用 Traceview 和 dmtracedump 进行分析

下“配置文件面板”具有以下文本,引用文本下方的示例分析结果:

表中的最后一列显示了对此方法的调用次数加上递归调用的次数。最后一列显示对该方法的调用总数中的调用次数。在此视图中,我们可以看到有 14 次调用 LoadListener.nativeFinished();查看时间线面板可以发现其中一个调用花费了异常长的时间。

我对这个描述感到困惑。首先,这句话的前两句话似乎指的是同一列。那么最后一栏实际上包含什么?其次,我不明白我必须在“时间线面板”中的具体位置查看它“显示其中一个调用花费了异常长的时间”。

你能帮我理解这段文字吗?

I am looking at this page: Profiling with Traceview and 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(); 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萧瑟寒风 2025-01-14 21:15:44

首先,同一篇文章告诉我们:

父母以紫色背景显示,孩子以黄色背景显示

因此 LoadListener.nativeFinished 是父函数,其下方的所有缩进行都是子函数,或者子函数家长已打来电话。

配置文件面板

以下是文章中的配置文件面板剪辑:

配置文件面板剪辑

表中的最后一列显示对此方法的调用次数加上递归调用的次数。

第一行的最后一列(父行)表示对此函数进行的调用和递归调用的次数:14 次迭代调用和 0 次递归调用,以加号分隔 (14+14)。

我认为这篇文章的作者不小心漏了几句话,结果下一行有点混乱:

最后一列显示对该方法的调用总数中的调用次数。

在父行下方的黄色背景子行中,最后一列实际上并不表示“呼叫+录音”。请注意符号的变化 - 使用分数与加号语法。对于LoadListener.tearDown,14/14表示父函数调用了LoadListener.tearDown 14次。在此跟踪中,LoadListener.tearDown 函数总共被调用了 14 次,因此 LoadListener.nativeFinished 是此跟踪中唯一调用 LoadListener.tearDown 的函数。

让我们看看另一行。 (子)函数 View.invalidate 的最后一列的值为 2413/2853。这并不意味着 View.invalidate 被迭代调用了 2413 次,递归调用了 2853 次。相反,这意味着父函数 LoadListener.nativeFinished 调用了 View.invalidate 2413 次。

现在看一下第 6 行,您会发现 View.invalidate 被迭代调用了 2853 次,递归调用了 0 次。因此,父函数 LoadListener.nativeFinished 是此跟踪中唯一调用过 LoadListener.tearDown 的函数。

时间轴面板

这是文章中时间轴面板的剪辑:

时间轴面板的剪辑

来自同一篇文章,

第一行下方的细线显示对所选方法的所有调用的范围(进入到退出)

请注意,在主线程突出显示部分的正下方水平延伸的类似大括号的粉红色细线。最左边的粉色大括号很短;这些代表对 LoadListener.nativeFinished 的 13/14 次调用,相对较快地完成。最后一个支架 - 最右边的一个 - 比其他任何支架都要长得多。这是对 LoadListener.nativeFinished 的调用“花费了异常长的时间”。

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.

Profile Panel

Here's a clip of the Profile Panel from the article:

Clip of the Profile Panel

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).

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. 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. 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.

Let's look at the another row. The last column of the (child) function View.invalidate has a value of 2413/2853. This doesn't mean that View.invalidate was called 2413 times iteratively and 2853 times recursively. Instead it means that the parent function, LoadListener.nativeFinished, called View.invalidate 2413 times.

Now take a look at row #6 and you'll see that View.invalidate was called 2853 times iteratively and 0 times recursively. Therefore the parent function, LoadListener.nativeFinished, is the only function to have ever called LoadListener.tearDown within this trace.

Timeline Panel

Here's a clip of the Timeline Panel from the article:

Clip of the Timeline Panel

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. 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."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文