Skip to content

Instantly share code, notes, and snippets.

@peat-psuwit
Created August 21, 2019 07:10
Show Gist options
  • Save peat-psuwit/b987df72a01ef58cfbb7d3e3cf307e64 to your computer and use it in GitHub Desktop.
Save peat-psuwit/b987df72a01ef58cfbb7d3e3cf307e64 to your computer and use it in GitHub Desktop.
How to run a daemon and collect ftrace from it. (The example is mm-qcamera-daemon)
#!/system/bin/sh
echo 'function_graph' >/sys/kernel/debug/tracing/current_tracer
echo 96000 > /d/tracing/buffer_size_kb
echo $$ > /sys/kernel/debug/tracing/set_ftrace_pid
echo 1 > /sys/kernel/debug/tracing/tracing_on
(
sleep 10 # stop tracing after this second.
echo 0 > /sys/kernel/debug/tracing/tracing_on
cat /sys/kernel/debug/tracing/trace >/data/local/tmp/strace/qcamerasvr.ftrace
echo 'nop' >/sys/kernel/debug/tracing/current_tracer
) &
exec /system/bin/mm-qcamera-daemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment