安卓开发者页面 : understanding traceview profiling example

标签 android profiling android-traceview

我正在查看此页面:Profiling with Traceview and dmtracedump

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

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.

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

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

最佳答案

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

Parents are shown with a purple background and children with a yellow background

所以 LoadListener.nativeFinished 是父函数,它下面的所有缩进行都是,或者是父调用的函数。

个人资料面板

这是文章中配置文件面板的 fragment :

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.

第一行(parent)的最后一列表示对该函数的调用次数和递归调用次数:14次迭代和0次递归调用,用加号分隔(14+14) .

我觉得这篇文章的作者不小心说了几句话,结果下一行有点困惑:

The last column shows the number of calls out of the total number of calls made to that method.

在父级下方的黄色背景子行中,最后一列实际上并不表示 Calls+Rec。请注意符号的变化 - 使用分数而不是加号语法。对于 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 的函数。

时间轴面板

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

Clip of the Timeline Panel

来自同一篇文章,

The thin lines underneath the first row show the extent (entry to exit) of all the calls to the selected method

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

关于安卓开发者页面 : understanding traceview profiling example,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9397674/

相关文章:

android - 默认 Android EditText 高亮颜色不是橙色

xcode - 如何在 Xcode 分析和存档构建中设置 DEBUG 和 NDEBUG 宏?

c# - 如何获取内存中的对象大小?

android - Debug.startMethodTracing() 跟踪文件的目录

android - 如何将存储在设备上的电子邮件检索到我的应用程序中

android - jumboMode (dexOptions) 的优点和缺点是什么

android - 非标准不支持的图像格式可以在移动 ios/android 应用程序中使用吗

performance - 在 Firefox 中分析 Webworkers

android - Traceview 无法从 DDMS 在 Eclipse 中打开

java - 应用程序启动时间过长