Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Systrace tool internally uses strace or ftrace?

Systrace Android tool calls internally a tool called atrace which is and extension of ftrace or strace (Linux tools).

If we connect via the emulator console (ADB shell) to Android Jelly Bean we can execute strace tool but we can not execute ftrace tool (command not installed).

Doing some reseach over the Internet I found that strace is a predecessor of ftrace: http://crtags.blogspot.de/2012/04/dtrace-ftrace-ltrace-strace-so-many-to.html

Looking to Android Source Code, the most "internal" reference that I found is Trace.h file: http://androidxref.com/4.1.1/xref/frameworks/native/include/utils/Trace.h

I think that this file is then resolved to a native Linux driver.

However, I'm still unable to know if this implementation driver belongs to strace or ftrace. "Normally", it should be ftrace because it is newer, but in that case I don't know why we can not run ftrace from the emulator. In contrast, strace is completely available from the emulator.

Then, does someone knows if Systrace Android tool uses at a very low level strace or ftrace?

Thank you!

like image 951
Rodmar Conde Avatar asked Apr 08 '13 12:04

Rodmar Conde


1 Answers

I've follow the instructions found here, related to ftrace,: http://www.linuxforu.com/2010/11/kernel-tracing-with-ftrace-part-1/

Everything works perfect. I wasn't able to execute ftrace before because interacting and retrieving data is done via logical paths.

To execute ftrace, after correctly configuration (many steps...), inside adb shell:

root@android:# cat /sys/kernel/debug/tracing/trace > mytracefile.txt

atrace makes configuration process easier, so we can access to trace information the following way:

root@android:# atrace -s -w -t 100 > mytracefile.txt

On the other hand, I've found information about executing strace here: http://www.hokstad.com/5-simple-ways-to-troubleshoot-using-strace

All indicated examples were successfully executed in my environment using adb shell.

Interaction and access to results of both tools are very different.

Now I can say that systrace Android tool is based in atrace which in turn is based in ftrace.

strace is also supported but serves to another purposes and is not related to systrace.

Regards,

like image 166
Rodmar Conde Avatar answered Oct 07 '22 11:10

Rodmar Conde