在优化Android启动过程时,同事给出一种打印出调用栈的函数。分享一下- java.util.Map ts = Thread.getAllStackTraces();
- StackTraceElement[] ste = ts.get(Thread.currentThread());
- for (StackTraceElement s : ste) {
- android.util.Slog.e("SS ", s.toString());
- }
为了打印出在android启动时,Zygote启动的所有java应用。在
-
- private final void startProcessLocked(ProcessRecord app,
- String hostingType, String hostingNameStr) {
-
- java.util.Map ts = Thread.getAllStackTraces();
- StackTraceElement[] ste = ts.get(Thread.currentThread());
- for (StackTraceElement s : ste) {
- android.util.Slog.e("SS ", s.toString());
- }
- }
就可以在终端中使用命令
logcat来查看打印出的调用栈了
http://blog.csdn.net/maeom/article/details/6660809
阅读(1483) | 评论(0) | 转发(0) |