Extending Android Systrace Tool [closed]
Asked Answered
J

3

6

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 !

Jahveh answered 22/11, 2012 at 8:49 Comment(0)
R
5

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

Refluent answered 28/11, 2012 at 6:32 Comment(2)
L
1

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.

Logos answered 22/11, 2012 at 9:43 Comment(3)
Thanks ! Apparently that information is good for debugging but we're interested in making tracing.Jahveh
Ah, I was expecting this anwser. It's a bit tricky to understand it by just looking at the code it like that, but it seems that every property that is annotated "DebugProperty" is automatically "traced". And that is the elegancy of this trace mecanism. Look at the header : "Debug can create log files that give details about an application, such as a call stack and start/stop times for any running methods. See Traceview: A Graphical Log Viewer for information about reading trace files."Logos
Now I understand, after many months of work. From Linux developers: "Definition : Tracing is similar to logging: it consists in recording events that happen in a system. However, it usually records much lowerlevel events that occur much more frequently."Jahveh
M
1

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

Mcadams answered 24/9, 2014 at 16:43 Comment(2)
You should summarize the contents of your links. This ensures that your answer will still be useful if the linked content changes or becomes unreachable.Sining
It looks cool, however that didn't exist when I posted the question so I had to do it by hand. ;-) Regards,Jahveh

© 2022 - 2024 — McMap. All rights reserved.