在android应用程序代码中使用systrace
android中的文档说在android应用程序代码中使用systrace,android,trace,systrace,Android,Trace,Systrace,android中的文档说 you can use the methods of the Trace class to add instrumentation to your application code and see the results in a Systrace report. 我已将以下方法添加到我的代码中 Trace.beginSection("test-trace"); // block of code Trace.endSection(); 现在我在哪里可以检查
you can use the methods of the Trace class to add instrumentation to
your application code and see the results in a Systrace report.
我已将以下方法添加到我的代码中
Trace.beginSection("test-trace");
// block of code
Trace.endSection();
现在我在哪里可以检查这部分的结果。我从android设备监视器启动systrace工具,并记录了30秒(执行按钮点击以执行上面的块)。它生成trace.html文件,但如何从该html文件获取上述部分信息systrace输出仅包括命令行上列出的标记。对于特定于应用程序的跟踪,这意味着添加一个
--app=package name
参数。这是必要的,因为systrace记录整个系统,您不希望它自动获取每个应用程序和组件的跟踪
你可以找到一个例子。对于包名为com.faddensoft.multicoretest
的程序,可以使用如下命令行:
python systrace.py --app=com.faddensoft.multicoretest gfx view sched dalvik
这样,跟踪应该出现在发出跟踪调用的线程的行中。(在web浏览器中打开HTML文件;可能需要使用Chrome。)它就在那里,我自己搜索了大约一个小时:D 若您只有一个线程,它将显示在UI线程行中,否则它将显示在您定义的线程行中 如果找不到,请使用搜索工具箱,在页面右上角键入“test trace”,它将详细显示开始时间 :)
可能您录制的时间太长,请确保使用-b命令增加缓冲区大小,或者只需遵循以下示例:
python systrace.py -app=package_name sched freq idle am wm gfx view dalvik input binder_driver -t 30 -o test.html -b 30384
我明白这一点,但这并不能回答我的问题。我不知道如何更具体。跟踪显示在进行跟踪调用的线程的行中。你没看到吗?