如何查看Android原生code剖析? [英] How to View Android Native Code Profiling?

查看:165
本文介绍了如何查看Android原生code剖析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始了我的仿真器./emulator -trace轮廓-avd emulator_15。然后我找到了跟踪文件到〜/ .android / AVD / rodgers_emulator_15.avd /踪迹/ profile文件,其中有六个文件:qtrace.bb,qtrace.exc,qtrace.insn,qtrace.method,qtrace.pid,qtrace .static。我无法弄清楚如何处理这些文件。我都试过dmtracedump和traceview上的所有文件,但没有一个似乎产生任何输出我可以做任何事情。

我如何查看时间采取本地方法调用Android上的比例是多少?

解决方案

您需要使用 tracedmdump 的输出转换。这是编译/ envsetup.sh 在完整的Andr​​oid源代码中定义一个shell功能。如果你使用的SDK,而不是从一个完整的树建设,我不知道这会工作。

(如果你没有来源,并希望采取偷看在tracedmdump功能,你可以看到它<一个href="http://android.git.kernel.org/?p=platform/build.git;a=blob;f=envsetup.sh;h=4eede33334dbcdf3b8cb9903ccf26b5e1dce9ef6;hb=HEAD"相对=nofollow>这里。)

如果您使用模拟器-trace简介,你运行 tracedmdump简介。这将通过挖掘不同的二进制文件检索符号信息,并将其与跟踪数据关联起来,生成一个HTML摘要和traceview兼容的跟踪文件。

值得一提的是,虚拟机将执行更为缓慢启用分析(跨preTER有开销的每一个方法调用和返回,而且它在较慢的调试跨preTER运行),而原生code继续以全速运行,所以你必须得出结论的时候要小心。

一般性评论:不要忘记使用F9或方法的一个调用来启动/停止跟踪 - 的 -trace 标志只是启用该功能<。 / P>

I started my emulator with ./emulator -trace profile -avd emulator_15. I then tracked down the trace files to ~/.android/avd/rodgers_emulator_15.avd/traces/profile, where there are six files: qtrace.bb, qtrace.exc, qtrace.insn, qtrace.method, qtrace.pid, qtrace.static. I can't figure out what to do with these files. I've tried both dmtracedump and traceview on all of the files, but none seem to generate any output I can do anything with.

How can I view the proportion of time taken by native method calls on Android?

解决方案

You need to use tracedmdump to convert the output. This is a shell function defined in build/envsetup.sh in the full Android sources. If you're using the SDK, rather than building from a full tree, I'm not sure this will work.

(If you don't have the sources and want to take a peek at the tracedmdump function, you can see it here.)

If you used emulator -trace profile, you'd run tracedmdump profile. This will dig through various binaries to retrieve symbolic information and associate it with the trace data, generating an HTML summary and a traceview-compatible trace file.

It's worth noting that the VM will execute more slowly with profiling enabled (the interpreter has overhead on every method call and return, and it's running in the slower "debug" interpreter), while native code continues to run at full speed, so you have to be careful when drawing conclusions.

General comment: don't forget to use F9 or one of the method calls to start/stop the tracing -- the -trace flag just enables the feature.

这篇关于如何查看Android原生code剖析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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