While selecting any slice in an android systrace, I see a value for self time. What does self time mean?
What does Self Time stand for in Android systrace?
541 views Asked by pacific At
2
There are 2 answers
0
On
For a Method or function at the top of the bottom up tree (top node)
Represents the total time the method or function spent executing its own code and not that of its callees. Compared to the top down tree, this timing information represents a sum of all calls to this method or function over the duration of the recording.
For Callers (sub-nodes)
Represents the total self time of the callee when being called by the caller. Using the bottom up tree in figure 9 as an example, the self time for method B would equal the sum of the self times for each execution of method C when called by B.
Additional resources: https://developer.android.com/studio/profile/cpu-profiler
In addition to myselfmiqdad's answer, you can check out this talk from Android Dev Summit '19: https://youtu.be/v4kCRZ_O4Lc, which walks through the computation of self time, children time and total time in detail.
As for systrace, although it shows trace events instead of call stacks, they are organized in a tree similar to a call stack. So the concept for self time still applies:
self_time = total_time - sum(children_total_time)