Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Systrace work with 4.1.2 device on Mac

I have been struggling a long time to just use systrace.

My device runs 4.1.2 (LT28i) and I'm on a Mac. I am bouncing SO questions with similar issues none of whom have a clear answer.

I want let's say to trace views and graphics

Method 1, eclipse:

enter image description here

error:

enter image description here

method 2, terminal:

$ python systrace.py --cpu-load --time=10 -o mytracefile.html
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/events/cpufreq_interactive/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/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)
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.
dionyses-lorentzoss-imac:systrace dionysis_lorentzos$ mount -o rw,remount -t debugfs none /sys/kernel/debug
mount: realpath /sys: No such file or directory

I also try the command below and get an error but according to the google docs root is needed only in some of the tracing.

$ adb root
adbd cannot run as root in production builds

How can I generate a simple systrace for views or graphics?

Debugging in phone is ofc enabled and also the "enable tracing" is (either by command line or via the phone itself).

like image 705
Diolor Avatar asked Dec 05 '25 16:12

Diolor


1 Answers

It looks like your cellphone is running a boot(kernel) image that does not support systrace.

"error opening /sys/kernel/debug/tracing/options/overwrite: No such file or directory (2)"

This error message means adb daemon (the adb module running on device side) could not find /sys/kernel/debug/tracing/options/overwrite on your device's file system. systrace works over adb and communicates with kernel though sysfs nodes under /sys/kernel/debug/tracing. If these nodes are not exposed on you phone for whatever reason, systrace just will not work.

So you should first get a shell on your device using:

adb shell

Then browse to confirm if /sys exists at all and if /sys/kernel/debug/tracing exists.

If they are there which is extremely unlikely, you have to debug systrace.py to figure out how come systrace think the nodes were not there. Otherwise, you need to flash a different boot image which has systrace support, because sysfs is controlled by kernel(mostly by configurations at compile time) and init.rc , both of which are part of boot image.

Flashing a different boot image might involve unlocking/rooting the device. You probably have to go to fan sites like xdadeveloper for information and image. Another option is to download the source of kernel for your device, compile kernel and make the boot image yourself. Linux is under GPL thus manufacturer of your device is obligated to release the source code of the specialized kernel they use.

like image 125
xiay Avatar answered Dec 07 '25 05:12

xiay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!