Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending Android Systrace Tool [closed]

We're working in extending the systrace tool to add customized information for our devices. We're specifically interested in knowing how does android support TRACE generation. What is the architecture and mechanisms that are involved in tracing events, zigote, finders, jvm starting, android starting, linux calls, hardware calls, etc.

Can anybody please help us with some links or manuals about this information ?

We will specially appreciate technical documentation for adb atrace tool and any other related module.

Information of trace file format is also of our interest, where can we find this trace files and how can we extend them to add more information ?

Detail :

In systrace.py line 81 we find:

atrace_args = ['adb', 'shell', 'atrace', '-z']

We know that this generates some tracing files in /sys/kernel/debug/tracing/

Our main interest is to know where, when and how are these files generated ?

Thank you very much !

like image 944
Rodmar Conde Avatar asked Nov 22 '12 08:11

Rodmar Conde


3 Answers

I have done research in systrace, as you mentioned it uses the atrace. Atrace internally uses ftrace. So to understand kernel events read about ftrace. So understand Android framework tags, they manually added tags in the Android framework, where they felt it will be useful to trace.

You can refer these to get better clarity

http://androidxref.com/4.1.1/xref/system/extras/atrace/atrace.c

http://androidxref.com/4.1.1/xref/frameworks/native/libs/utils/Trace.cpp

like image 114
Krishna Avatar answered Nov 03 '22 18:11

Krishna


Grepcode is your friend. I think a good starting point is the debug class : http://www.grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/android/os/Debug.java?av=f

There is an interesting part that describes a list of debug properties :

1085            final String TAG = "DebugProperties";
1086            final String[] files = { "/system/debug.prop", "/debug.prop", "/data/debug.prop" };

Each property must be declared with a specific annotation :

android.os.Debug.DebugProperty

It seems to be available only to plateform developpers though.

like image 32
Gomoku7 Avatar answered Nov 03 '22 19:11

Gomoku7


I am working on similar task and use this. It helps me browse and understand the Java/c++/kernel level api and how it is implemented.

http://www.srcmap.org/p/1/857623b50f7e/Android_Jellybean_systrace__atrace__ftrace_code_study.html

like image 27
Y_Yen Avatar answered Nov 03 '22 19:11

Y_Yen