Getting call stack trace "overhead"

33 views
Skip to first unread message

Jaebaek Seo

unread,
Jan 5, 2015, 9:45:54 PM1/5/15
to android-...@googlegroups.com
Hi, I have a question about "overhead" of getting call stack trace.
Based on my understanding of dalvik code (ArrayObject* dvmDdmGetStackTraceById(u4 threadId) in dalvik/vm/Ddm.cpp file),
call stack trace are tracked after all other threads are suspended.

However, "suspend" does not mean suspending all other threads but it means "just wait until all other threads sleep themselves".

So my questions are:

1. To make all other threads sleeping themselves, does dalvik VM do some special actions such as periodically suspend all threads or something?
How all other threads sleeping themselves? In Unix kernel, timer interrupt enforces all threads to sleep periodically. How it works in dalvik VM?

2. Does "just wait until all other threads sleep themselves" imply that getting call stack trace does not interfere other threads and does not have any impact on the performance of other threads?
Thus, does it just have overhead of "waiting time until all other threads sleep themselves" + "tracking call stack trace"?

If someone answer clearly these questions, it would be very helpful to me.
Thanks very much!

Jaebaek Seo

unread,
Jan 6, 2015, 2:44:46 AM1/6/15
to android-...@googlegroups.com
I had mistakes that it does not suspend all other threads. It just suspends the target thread.

So my questions are:

1. To make a thread sleeping itself, does dalvik VM do some special actions such as periodically suspend a thread or something?
How a thread sleeping itself? In Unix kernel, timer interrupt enforces all threads to sleep periodically. How it works in dalvik VM?

2. Does "just wait until a thread sleeps itself" imply that getting call stack trace does not interfere other threads and does not have any impact on the performance of other threads?
Thus, it just have overhead of "waiting time until the thread sleeps itself" + "tracking call stack trace"?

2015년 1월 6일 화요일 오전 11시 45분 54초 UTC+9, Jaebaek Seo 님의 말:

Ian Rogers

unread,
Jan 6, 2015, 1:10:53 PM1/6/15
to android-...@googlegroups.com
Every thread in Dalvik has a suspend count which thread's running Java code periodically read. When the suspend count value is non-zero the thread will voluntarily suspend itself. A thread not running Java code is considered suspended. Thread suspension is not just used for debugging, but also profiling and garbage collection. For (1) the answer is yes, as just explained. For (2) there won't be overhead for other threads for a request to suspend one thread.

Thanks,
Ian

Jaebaek Seo

unread,
Jan 6, 2015, 8:38:29 PM1/6/15
to android-...@googlegroups.com
Thanks very much :)


Ph.D candidate at CS dept of KAIST

Jaebaek Seo


--
You received this message because you are subscribed to a topic in the Google Groups "android-platform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-platform/whS6tV6AOUk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages