Skip to content

Instantly share code, notes, and snippets.

@x2c3z4
Forked from peat-psuwit/qcamerasvr_wrapper.sh
Created March 19, 2021 10:44
Show Gist options
  • Save x2c3z4/2e1eedc06c8550fa5498f84fa6163428 to your computer and use it in GitHub Desktop.
Save x2c3z4/2e1eedc06c8550fa5498f84fa6163428 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