在 Jelly Bean 中使用 systrace 失败

Posted

技术标签:

【中文标题】在 Jelly Bean 中使用 systrace 失败【英文标题】:Failed to use systrace in Jelly Bean 【发布时间】:2012-07-22 01:20:58 【问题描述】:

我尝试使用 jelly bean 版本中的新 systrace,但没有成功。

我在 I/O 会话等开发设置中启用了图形和视图跟踪,并尝试调用 systrace,我得到的只是这个。

$ ./systrace.py               
error opening /sys/kernel/debug/tracing/options/overwrite: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/sched/sched_switch/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/power/cpu_frequency/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/power/cpu_idle/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/buffer_size_kb: No such file or directory (2)
error opening /sys/kernel/debug/tracing/trace_clock: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/workqueue/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/block/block_rq_issue/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/block/block_rq_complete/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/tracing_on: No such file or directory (2)
error: unable to start trace
error opening /sys/kernel/debug/tracing/tracing_on: No such file or directory (2)
error opening /sys/kernel/debug/tracing/options/overwrite: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/sched/sched_switch/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/power/cpu_frequency/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/trace_clock: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/workqueue/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/block/block_rq_issue/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/block/block_rq_complete/enable: No such file or directory (2)
unable to start tracing
error opening /sys/kernel/debug/tracing/buffer_size_kb: No such file or directory (2)
An error occured while capturing the trace.  Output file was not written.

我已经在我的 Desire Hd (ace) 上尝试了模拟器和自定义固件。有什么想法吗?

【问题讨论】:

nope...好像我以前用过错误的内核,没有跟踪功能 这个帖子可能有你需要解决的信息http://***.com/questions/15684715/android-systrace-trace-file-format/ 【参考方案1】:

尝试以下命令:

adb root(不确定是否有必要), adb shell mount -t debugfs nodev /sys/kernel/debug

在这些命令下,脚本应该可以正常运行,尽管对我来说,html 文件只包含每个 CPU 的行,而不是单个组件,例如表面抛掷器,这在 google IO 会谈视频中可见。

【讨论】:

我得到“挂载:设备或资源繁忙”是预期的吗? adb root 这是否意味着它只适用于有根设备!

以上是关于在 Jelly Bean 中使用 systrace 失败的主要内容,如果未能解决你的问题,请参考以下文章

WifiManager.getScanResults() 未在 Android Jelly Bean 上提供 SSID

为 Lollipop 使用 Android SDK 18 (Jelly Bean)

JQuery Mobile CSS在Jelly Bean中将整个页面变成黑色

使用 HttpURLConnection 的 Android Jelly Bean 4.1 上的 HTTP 基本身份验证问题

Jelly Bean webview 应用程序无法完美响应 touchend 事件

Android OS 4.1 (Jelly Bean) 是不是使用 HWUI 或 SKIA?